|
eZ Publish
[trunk]
|
Tool class which has convencience functions for files and directories. More...
Static Public Member Functions | |
| static | create ($filename, $directory=false, $data=false, $atomic=false) |
| static | download ($file, $isAttachedDownload=true, $overrideFilename=false, $startOffset=0, $length=false) |
| Prepares a file for Download and terminates the execution. | |
| static | downloadContent ($file, $startOffset=0, $length=false) |
| Handles the data part of a file transfer to the client. | |
| static | downloadHeaders ($file, $isAttachedDownload=true, $overrideFilename=false, $startOffset=0, $length=false, $fileSize=false) |
| Handles the header part of a file transfer to the client. | |
| static | getContents ($filename) |
| static | isWriteable ($filename) |
| static | rename ($srcFile, $destFile, $mkdir=false, $flags=0) |
| Renames $srcFile to $destFile atomically on Unix, and provides a workaround for Windows. | |
| static | splitLines ($file) |
| Reads the whole contents of the file $file and splits it into lines which is collected into an array and returned. | |
| static | suffix ($filename) |
Public Attributes | |
| const | APPEND_DEBUG_ON_FAILURE = 2 |
| const | CLEAN_ON_FAILURE = 1 |
| Flags for file manipulation. | |
| const | READ_PACKET_SIZE = 16384 |
| Number of bytes read per fread() operation. | |
Tool class which has convencience functions for files and directories.
Definition at line 17 of file ezfile.php.
| static eZFile::create | ( | $ | filename, |
| $ | directory = false, |
||
| $ | data = false, |
||
| $ | atomic = false |
||
| ) | [static] |
Creates a file called $filename. If $directory is specified the file is placed there, the directory will also be created if missing. if $data is specified the file will created with the content of this variable.
| $atomic | If true the file contents will be written to a temporary file and renamed to the correct file. |
Definition at line 60 of file ezfile.php.
Referenced by eZMutex\clearMeta(), eZDFSFileHandlerDFSBackend\createFile(), eZStepSiteTypes\downloadFile(), eZFSFileHandler\fileStoreContents(), eZFileTransport\sendMail(), eZMutex\setMeta(), eZDBFileHandler\storeCache(), eZDFSFileHandler\storeCache(), eZDBFileHandler\storeContents(), eZFSFileHandler\storeContents(), and eZDFSFileHandler\storeContents().
| static eZFile::download | ( | $ | file, |
| $ | isAttachedDownload = true, |
||
| $ | overrideFilename = false, |
||
| $ | startOffset = 0, |
||
| $ | length = false |
||
| ) | [static] |
Prepares a file for Download and terminates the execution.
This method will:
| string | $file | Path to the local file |
| bool | $isAttachedDownload | Determines weather to download the file as an attachment ( download popup box ) or not. |
| string | $overrideFilename | |
| int | $startOffset | Offset to start transfer from, in bytes |
| int | $length | Data size to transfer |
Definition at line 231 of file ezfile.php.
| static eZFile::downloadContent | ( | $ | file, |
| $ | startOffset = 0, |
||
| $ | length = false |
||
| ) | [static] |
Handles the data part of a file transfer to the client.
| string | $file | Path to the local file |
| int | $startOffset | Offset to start transfer from, in bytes |
| int | $length | Data size to transfer |
Definition at line 315 of file ezfile.php.
Referenced by download(), eZDFSFileHandlerDFSBackend\passthrough(), and eZFSFileHandler\passthrough().
| static eZFile::downloadHeaders | ( | $ | file, |
| $ | isAttachedDownload = true, |
||
| $ | overrideFilename = false, |
||
| $ | startOffset = 0, |
||
| $ | length = false, |
||
| $ | fileSize = false |
||
| ) | [static] |
Handles the header part of a file transfer to the client.
| string | $file | Path to the local file |
| bool | $isAttachedDownload | Determines weather to download the file as an attachment ( download popup box ) or not. |
| string | $overrideFilename | Filename to send in headers instead of the actual file's name |
| int | $startOffset | Offset to start transfer from, in bytes |
| int | $length | Data size to transfer |
| string | $fileSize | The file's size. If not given, actual filesize will be queried. Required to work with clusterized files... |
Definition at line 258 of file ezfile.php.
Referenced by download(), and eZFilePassthroughHandler\handleFileDownload().
| static eZFile::getContents | ( | $ | filename | ) | [static] |
Read all content of file.
| filename |
Definition at line 112 of file ezfile.php.
| static eZFile::isWriteable | ( | $ | filename | ) | [static] |
Check if a given file is writeable
Definition at line 152 of file ezfile.php.
Referenced by eZSetupPrvtAreDirAndFilesWritable(), and eZSetupTestFilePermissions().
| static eZFile::rename | ( | $ | srcFile, |
| $ | destFile, | ||
| $ | mkdir = false, |
||
| $ | flags = 0 |
||
| ) | [static] |
Renames $srcFile to $destFile atomically on Unix, and provides a workaround for Windows.
Usage example: $srcFile = '/path/to/src/file'; $destFile = '/path/to/dest/file'; eZFile::rename( $srcFile, $destFile );
// Using flags // In following example, if rename operation fails, $srcFile will be deleted and a message will be appended in eZDebug eZFile::rename( $srcFile, $destFile, false, eZFile::APPEND_DEBUG_ON_FAILURE | eZFile::CLEAN_ON_FAILURE );
| string | $srcFile | Source file path |
| string | $destFile | Destination file path |
| bool | $mkdir | Make directory for destination file if needed |
| int | $flags | Supported flags are :
|
Definition at line 190 of file ezfile.php.
Referenced by eZDBFileHandlerMysqliBackend\_fetch(), eZDBFileHandlerMysqlBackend\_fetch(), eZDFSFileHandlerMySQLBackend\_fetch(), eZDFSFileHandlerMySQLiBackend\_fetch(), eZPHPCreator\close(), create(), eZFS2FileHandler\endCacheGeneration(), eZFileHandler\move(), eZWebDAVFileServer\move(), eZWebDAVFileServer\put(), eZSubtreeCache\renameDir(), eZDFSFileHandlerDFSBackend\renameOnDFS(), eZLog\rotateLog(), eZDebug\rotateLog(), eZINI\saveCache(), and eZStaticCache\storeCachedFile().
| static eZFile::splitLines | ( | $ | file | ) | [static] |
Reads the whole contents of the file $file and splits it into lines which is collected into an array and returned.
It will handle Unix (
), Windows (
) and Mac () style newlines.
Definition at line 43 of file ezfile.php.
| static eZFile::suffix | ( | $ | filename | ) | [static] |
Get suffix from filename
| filename |
Definition at line 140 of file ezfile.php.
Referenced by eZTSTranslator\fetchList(), eZWebDAVContentServer\fetchNodeInfo(), eZWebDAVContentBackend\fetchNodeInfo(), eZMediaType\fetchObjectAttributeHTTPInput(), eZBinaryFileType\fetchObjectAttributeHTTPInput(), eZBinaryFileType\insertRegularFile(), eZMediaType\insertRegularFile(), eZMediaType\trashStoredObjectAttribute(), eZBinaryFileType\trashStoredObjectAttribute(), eZBinaryFileType\unserializeContentObjectAttribute(), and eZMediaType\unserializeContentObjectAttribute().
| const eZFile::APPEND_DEBUG_ON_FAILURE = 2 |
Definition at line 32 of file ezfile.php.
Referenced by eZDBFileHandlerMysqliBackend\_fetch(), eZDBFileHandlerMysqlBackend\_fetch(), eZDFSFileHandlerMySQLBackend\_fetch(), eZDFSFileHandlerMySQLiBackend\_fetch(), eZSubtreeCache\renameDir(), and eZStaticCache\storeCachedFile().
| const eZFile::CLEAN_ON_FAILURE = 1 |
Flags for file manipulation.
Definition at line 31 of file ezfile.php.
Referenced by eZDBFileHandlerMysqliBackend\_fetch(), eZDBFileHandlerMysqlBackend\_fetch(), eZDFSFileHandlerMySQLBackend\_fetch(), eZDFSFileHandlerMySQLiBackend\_fetch(), eZPHPCreator\close(), create(), eZFS2FileHandler\endCacheGeneration(), and eZStaticCache\storeCachedFile().
| const eZFile::READ_PACKET_SIZE = 16384 |
Number of bytes read per fread() operation.
Definition at line 24 of file ezfile.php.
Referenced by downloadContent().