Interface

eZDFSFileHandlerDFSBackendInterface

interface eZDFSFileHandlerDFSBackendInterface

Interface for a DFS FS handler, that offers CRUD support for binary files.

Implementations of this interface can be used by DFS database backends, such as eZDFSFileHandlerMySQLiBackend, to read/write to a binary file storage medium.

Methods

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

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

Sends the contents of $filePath to default output

string|bool getContents(string $filePath)

Returns the content of $filePath

bool createFileOnDFS(string $filePath, string $contents)

Creates $filePath with $contents

bool renameOnDFS(string $oldPath, string $newPath)

Renames $oldPath to $newPath

bool existsOnDFS(string $filePath)

Checks if a file exists on the DFS

int getDfsFileSize(string $filePath)

Returns the size in bytes of $filePath

Iterator getFilesList(string $basePath)

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

string applyServerUri(string $filePath)

Transforms $filePath so that it contains a valid href to the file, wherever it is stored.

Details

at line 26
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 36
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 47
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 on DFS as well.

Return Value

bool

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

Deletes one or more files

Parameters

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

Return Value

bool true if deletion was successful, false otherwise

at line 68
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 78
public string|bool getContents(string $filePath)

Returns the content of $filePath

Parameters

string $filePath file path

Return Value

string|bool file's content, or false

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

Creates $filePath with $contents

Parameters

string $filePath
string $contents

Return Value

bool

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

Renames $oldPath to $newPath

Parameters

string $oldPath
string $newPath

Return Value

bool

at line 107
public bool existsOnDFS(string $filePath)

Checks if a file exists on the DFS

Parameters

string $filePath

Return Value

bool

at line 116
public int getDfsFileSize(string $filePath)

Returns the size in bytes of $filePath

Parameters

string $filePath

Return Value

int

at line 125
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 132
public string applyServerUri(string $filePath)

Transforms $filePath so that it contains a valid href to the file, wherever it is stored.

Parameters

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

Return Value

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