Class

eZDFSFileHandlerDFSBackend

class eZDFSFileHandlerDFSBackend implements eZDFSFileHandlerDFSBackendInterface

File containing the eZDFSFileHandlerDFSBackend class.

Methods

__construct()

supports($path)

The legacy handler supports any type of file

bool copyFromDFSToDFS(string $srcFilePath, string $dstFilePath)

Creates a copy of $srcFilePath from DFS to $dstFilePath on DFS

bool copyFromDFS(string $srcFilePath, string $dstFilePath = false)

Copies the DFS file $srcFilePath to FS

bool copyToDFS(string $srcFilePath, bool|string $dstFilePath = false)

Copies the local file $filePath to DFS under the same name, or a new name if specified

bool delete(string|array $filePath)

Deletes one or more files from DFS

bool passthrough(string $filePath, int $startOffset, bool|int $length = false)

Sends the contents of $filePath to default output

binary|bool getContents(string $filePath)

Returns the binary content of $filePath from DFS

bool createFileOnDFS(string $filePath, binary $contents)

Creates the file $filePath on DFS with content $contents

bool renameOnDFS(string $oldPath, string $newPath)

Renamed DFS file $oldPath to DFS file $newPath

bool existsOnDFS(string $filePath)

Checks if a file exists on the DFS

int getDfsFileSize(string $filePath)

Returns size of a file in the DFS backend, from a relative path.

Iterator getFilesList(string $basePath)

Returns an iterator over the files within $basePath on the backend

string applyServerUri(string $filePath)

No transformation is required since files are served from the same host

Details

at line 13
public __construct()

at line 34
public supports($path)

The legacy handler supports any type of file

Parameters

$path

at line 47
public bool copyFromDFSToDFS(string $srcFilePath, string $dstFilePath)

Creates a copy of $srcFilePath from DFS to $dstFilePath on DFS

Parameters

string $srcFilePath Local source file path
string $dstFilePath Local destination file path

Return Value

bool

at line 77
public bool copyFromDFS(string $srcFilePath, string $dstFilePath = false)

Copies the DFS file $srcFilePath to FS

Parameters

string $srcFilePath Source file path (on DFS)
string $dstFilePath Destination file path (on FS). If not specified, $srcFilePath is used

Return Value

bool

at line 122
public bool copyToDFS(string $srcFilePath, bool|string $dstFilePath = false)

Copies the local file $filePath to DFS under the same name, or a new name if specified

Parameters

string $srcFilePath Local file path to copy from
bool|string $dstFilePath Optional path to copy to. If not specified, $srcFilePath is used

Return Value

bool

at line 167
public bool delete(string|array $filePath)

Deletes one or more files from DFS

Parameters

string|array $filePath Single local filename, or array of local filenames

Return Value

bool true if deletion was successful, false otherwise

at line 206
public bool passthrough(string $filePath, int $startOffset, bool|int $length = false)

Sends the contents of $filePath to default output

Parameters

string $filePath File path
int $startOffset Starting offset
bool|int $length Length to transmit, false means everything

Return Value

bool true, or false if operation failed

at line 222
public binary|bool getContents(string $filePath)

Returns the binary content of $filePath from DFS

Parameters

string $filePath local file path

Return Value

binary|bool file's content, or false

at line 243
public bool createFileOnDFS(string $filePath, binary $contents)

Creates the file $filePath on DFS with content $contents

Parameters

string $filePath
binary $contents

Return Value

bool

at line 262
public bool renameOnDFS(string $oldPath, string $newPath)

Renamed DFS file $oldPath to DFS file $newPath

Parameters

string $oldPath
string $newPath

Return Value

bool

at line 285
public bool existsOnDFS(string $filePath)

Checks if a file exists on the DFS

Parameters

string $filePath

Return Value

bool

at line 376
public int getDfsFileSize(string $filePath)

Returns size of a file in the DFS backend, from a relative path.

Parameters

string $filePath The relative file path we want to get size of

Return Value

int

at line 388
public Iterator getFilesList(string $basePath)

Returns an iterator over the files within $basePath on the backend

Parameters

string $basePath a path relative to the mount point

Return Value

Iterator An iterator that returns a DFS File pathname as the value

at line 405
public string applyServerUri(string $filePath)

No transformation is required since files are served from the same host

Parameters

string $filePath Example: /var/site/storage/images/example.png

Return Value

string http://static.example.com/var/site/storage/images/example.png