|
eZ Publish
[4.2]
|
Interface for file handlers. More...
Inheritance diagram for eZFileHandler:Public Member Functions | |
| close () | |
| doClose () | |
| doEOF () | |
| doFlush () | |
| doOpen ($filename, $mode) | |
| doPasstrough ($closeFile=true) | |
| doRead ($length=false) | |
| doRewind () | |
| doSeek ($offset, $whence) | |
| doTell () | |
| doWrite ($data, $length=false) | |
| duplicate () | |
| eof () | |
| error () | |
| errorNumber () | |
| errorString () | |
| exists ($filename=false) | |
| eZFileHandler ($handlerIdentifier=false, $handlerName=false) | |
| filename () | |
| flush () | |
| identifier () | |
| isBinaryMode () | |
| isDirectory ($filename=false) | |
| isExecutable ($filename=false) | |
| isFile ($filename=false) | |
| isLink ($filename=false) | |
| isOpen () | |
| isReadable ($filename=false) | |
| isWriteable ($filename=false) | |
| mode () | |
| name () | |
| open ($filename, $mode, $binaryFile=true) | |
| passtrough ($closeFile=true) | |
| read ($length=false) | |
| rename ($destinationFilename, $sourceFilename=false) | |
| rewind () | |
| seek ($offset, $whence=SEEK_SET) | |
| statistics ($filename=false) | |
| tell () | |
| write ($data, $length=false) | |
Static Public Member Functions | |
| static | copy ($sourceFilename, $destinationFilename) |
| static | doExists ($filename) |
| static | doIsDirectory ($filename) |
| static | doIsExecutable ($filename) |
| static | doIsFile ($filename) |
| static | doIsLink ($filename) |
| static | doIsReadable ($filename) |
| static | doIsWriteable ($filename) |
| static | doRename ($destinationFilename, $sourceFilename) |
| static | doStatistics ($filename) |
| static | doUnlink ($filename) |
| static | instance ($identifier, $filename=false, $mode=false, $binaryFile=true) |
| Returns a shared instance of the eZFileHandler class. | |
| static | isAvailable () |
| static | link ($sourceFilename, $destinationFilename) |
| static | linkCopy ($sourceFilename, $destinationFilename, $symbolicLink=true) |
| static | move ($sourceFilename, $destinationFilename) |
| static | symlink ($sourceFilename, $destinationFilename) |
| static | unlink ($filename=false) |
Public Attributes | |
| $FileName | |
| $IsBinary | |
| $IsOpen | |
| $Mode | |
| $Name | |
Interface for file handlers.
Generic interface for all file handlers.
Using this class i divided into five areas, they are:
File handling using open(), close(), read(), write() and flush().
File position handling using seek(), tell(), rewind() and eof().
Quick output of the file using passtrough().
Error handling with error(), errorString() and errorNumber().
Creating specific handlers
The file handlers must inherit from this class and reimplement some virtual functions.
For dealing with files the following functions must be reimplemented. doOpen(), doClose(), doRead(), doWrite() and doFlush().
For dealing with file positions the following functions must be reimplemented. doSeek(), doTell(), doRewind() and doEOF().
For dealing with quick output the passtrough() function must be reimplemented, if not reimplemented the default implemententation will simply read n bytes using read() and output it with print.
Also the errorString() and errorNumber() functions must be reimplemented to provide proper error handler. The error() function is not required to be implemented since it has a default implementation, for speed it might be wise to implement the function.
This class will handle most of the generic logic, like checking that the filename is correct and if the open succeded, and give error messages based on this. The actual implementations will only have to execute the specific code and return a result.
Definition at line 78 of file ezfilehandler.php.
| eZFileHandler::close | ( | ) |
Tries to close an open file and returns true if succesful, false otherwise.
Definition at line 578 of file ezfilehandler.php.
| static eZFileHandler::copy | ( | $ | sourceFilename, |
| $ | destinationFilename | ||
| ) | [static] |
Copies the file $sourceFilename to $destinationFilename.
true if sucessful or false if the copy failed. Definition at line 385 of file ezfilehandler.php.
Referenced by eZTARArchiveHandler\_openRead(), eZPackage\appendFile(), eZPackage\appendSimpleFile(), eZImageManager\convert(), eZContentObjectPackageHandler\createDOMNodeFromFile(), eZDBPackageHandler\createInstallNode(), eZFSFileHandler\fileCopy(), eZImageAliasHandler\initializeFromFile(), eZFilePackageHandler\install(), eZContentObjectPackageHandler\installTemplates(), linkCopy(), move(), eZBinaryFileType\unserializeContentObjectAttribute(), and eZMediaType\unserializeContentObjectAttribute().
| eZFileHandler::doClose | ( | ) | [pure virtual] |
Does the actual file closing.
Implemented in eZGZIPZLIBCompressionHandler, eZGZIPShellCompressionHandler, eZForwardCompressionHandler, and eZBZIP2Handler.
Definition at line 812 of file ezfilehandler.php.
Referenced by close().
| eZFileHandler::doEOF | ( | ) | [pure virtual] |
Does the actual file eof detection.
Implemented in eZGZIPZLIBCompressionHandler, eZGZIPShellCompressionHandler, and eZForwardCompressionHandler.
Definition at line 944 of file ezfilehandler.php.
Referenced by eof().
| static eZFileHandler::doExists | ( | $ | filename | ) | [static, pure virtual] |
Does the actual file exists checking.
Definition at line 834 of file ezfilehandler.php.
Referenced by exists().
| eZFileHandler::doFlush | ( | ) | [pure virtual] |
Does the actual file flushing.
Implemented in eZGZIPZLIBCompressionHandler, eZGZIPShellCompressionHandler, eZForwardCompressionHandler, and eZBZIP2Handler.
Definition at line 992 of file ezfilehandler.php.
Referenced by flush().
| static eZFileHandler::doIsDirectory | ( | $ | filename | ) | [static, pure virtual] |
Does the actual directory checking.
Definition at line 844 of file ezfilehandler.php.
Referenced by isDirectory().
| static eZFileHandler::doIsExecutable | ( | $ | filename | ) | [static, pure virtual] |
Does the actual executable checking.
Definition at line 854 of file ezfilehandler.php.
Referenced by isExecutable().
| static eZFileHandler::doIsFile | ( | $ | filename | ) | [static, pure virtual] |
Does the actual file checking.
Definition at line 864 of file ezfilehandler.php.
Referenced by isFile().
| static eZFileHandler::doIsLink | ( | $ | filename | ) | [static, pure virtual] |
Does the actual link checking.
Definition at line 874 of file ezfilehandler.php.
Referenced by isLink().
| static eZFileHandler::doIsReadable | ( | $ | filename | ) | [static, pure virtual] |
Does the actual readable checking.
Definition at line 884 of file ezfilehandler.php.
Referenced by isReadable().
| static eZFileHandler::doIsWriteable | ( | $ | filename | ) | [static, pure virtual] |
Does the actual writeable checking.
Definition at line 894 of file ezfilehandler.php.
Referenced by isWriteable().
| eZFileHandler::doOpen | ( | $ | filename, |
| $ | mode | ||
| ) | [pure virtual] |
Does the actual file opening.
Implemented in eZGZIPShellCompressionHandler, eZGZIPZLIBCompressionHandler, eZForwardCompressionHandler, and eZBZIP2Handler.
Definition at line 801 of file ezfilehandler.php.
Referenced by open().
| eZFileHandler::doPasstrough | ( | $ | closeFile = true | ) | [pure virtual] |
Does the actual file passtrough.
Implemented in eZGZIPZLIBCompressionHandler, eZGZIPShellCompressionHandler, and eZForwardCompressionHandler.
Definition at line 954 of file ezfilehandler.php.
Referenced by passtrough().
| eZFileHandler::doRead | ( | $ | length = false | ) | [pure virtual] |
Does the actual file reading.
Implemented in eZGZIPZLIBCompressionHandler, eZGZIPShellCompressionHandler, eZForwardCompressionHandler, and eZBZIP2Handler.
Definition at line 969 of file ezfilehandler.php.
Referenced by read().
| static eZFileHandler::doRename | ( | $ | destinationFilename, |
| $ | sourceFilename | ||
| ) | [static, pure virtual] |
Does the actual file renaming.
Definition at line 1002 of file ezfilehandler.php.
Referenced by rename().
| eZFileHandler::doRewind | ( | ) |
Does the actual file rewind.
Reimplemented in eZGZIPZLIBCompressionHandler, eZGZIPShellCompressionHandler, and eZForwardCompressionHandler.
Definition at line 924 of file ezfilehandler.php.
Referenced by rewind().
| eZFileHandler::doSeek | ( | $ | offset, |
| $ | whence | ||
| ) | [pure virtual] |
Does the actual file seek.
Implemented in eZGZIPZLIBCompressionHandler, eZGZIPShellCompressionHandler, and eZForwardCompressionHandler.
Definition at line 914 of file ezfilehandler.php.
Referenced by doRewind(), and seek().
| static eZFileHandler::doStatistics | ( | $ | filename | ) | [static, pure virtual] |
Does the actual writeable checking.
Definition at line 904 of file ezfilehandler.php.
Referenced by statistics().
| eZFileHandler::doTell | ( | ) | [pure virtual] |
Does the actual file telling.
Implemented in eZGZIPZLIBCompressionHandler, eZGZIPShellCompressionHandler, and eZForwardCompressionHandler.
Definition at line 934 of file ezfilehandler.php.
Referenced by tell().
| static eZFileHandler::doUnlink | ( | $ | filename | ) | [static, pure virtual] |
Does the actual file unlinking.
Definition at line 824 of file ezfilehandler.php.
Referenced by unlink().
| eZFileHandler::doWrite | ( | $ | data, |
| $ | length = false |
||
| ) | [pure virtual] |
Does the actual file writing.
Implemented in eZGZIPZLIBCompressionHandler, eZGZIPShellCompressionHandler, eZForwardCompressionHandler, and eZBZIP2Handler.
Definition at line 979 of file ezfilehandler.php.
Referenced by write().
| eZFileHandler::duplicate | ( | ) |
Creates a copy of the current handler and returns a reference to the copy.
$this, this method must be reimplemented for specific handlers. Reimplemented in eZForwardCompressionHandler.
Definition at line 1041 of file ezfilehandler.php.
| eZFileHandler::eof | ( | ) |
true if the file pointer is at the end of the file or an error occured, otherwise false. Definition at line 769 of file ezfilehandler.php.
| eZFileHandler::error | ( | ) |
Returns error data as an associative array, the array contains:
Reimplemented in eZForwardCompressionHandler, and eZBZIP2Handler.
Definition at line 1013 of file ezfilehandler.php.
| eZFileHandler::errorNumber | ( | ) | [pure virtual] |
Implemented in eZGZIPZLIBCompressionHandler, eZGZIPShellCompressionHandler, eZForwardCompressionHandler, and eZBZIP2Handler.
Definition at line 1032 of file ezfilehandler.php.
Referenced by error().
| eZFileHandler::errorString | ( | ) | [pure virtual] |
Implemented in eZGZIPZLIBCompressionHandler, eZGZIPShellCompressionHandler, eZForwardCompressionHandler, and eZBZIP2Handler.
Definition at line 1023 of file ezfilehandler.php.
Referenced by error().
| eZFileHandler::exists | ( | $ | filename = false | ) |
true if the filename $filename exists. If $filename is not specified the filename is taken from the one used in open(). Definition at line 448 of file ezfilehandler.php.
| eZFileHandler::eZFileHandler | ( | $ | handlerIdentifier = false, |
| $ | handlerName = false |
||
| ) |
Initializes the handler. Optionally the parameters $filename and $mode may be provided to automatically open the file.
Definition at line 84 of file ezfilehandler.php.
Referenced by eZCompressionHandler\eZCompressionHandler(), and instance().
| eZFileHandler::filename | ( | ) |
Definition at line 119 of file ezfilehandler.php.
Referenced by eZGZIPZLIBCompressionHandler\doPasstrough(), and rename().
| eZFileHandler::flush | ( | ) |
Force a write of all buffered data.
true if succesful or false if something failed. Definition at line 705 of file ezfilehandler.php.
| eZFileHandler::identifier | ( | ) |
Definition at line 145 of file ezfilehandler.php.
Referenced by eZForwardCompressionHandler\duplicate().
| static eZFileHandler::instance | ( | $ | identifier, |
| $ | filename = false, |
||
| $ | mode = false, |
||
| $ | binaryFile = true |
||
| ) | [static] |
Returns a shared instance of the eZFileHandler class.
Returns the handler for the identifier $identifier. The parameters $filename, $mode and $binaryFile is passed to the handler.
false if the handler could not be created. $identifier if set is used to specify specific file handlers as defined in file.ini [FileSettings]Handlers. If $filename and later params are set, then file is opened straigt away.| $identifier | string|false Global eZFileHandler used if false |
| $filename | string|false |
| $mode | string|false set to 'r' if false |
| $binaryFile | bool binary or text mode, default true. |
Definition at line 1064 of file ezfilehandler.php.
Referenced by eZCache\clearItem(), eZFSFileHandler\delete(), and eZFSFileHandler\fileDelete().
| static eZFileHandler::isAvailable | ( | ) | [static] |
true for all handlers. Reimplemented in eZGZIPShellCompressionHandler, and eZGZIPZLIBCompressionHandler.
Definition at line 154 of file ezfilehandler.php.
| eZFileHandler::isBinaryMode | ( | ) |
true if the file was opened in binary mode. Definition at line 111 of file ezfilehandler.php.
Referenced by eZGZIPZLIBCompressionHandler\doPasstrough().
| eZFileHandler::isDirectory | ( | $ | filename = false | ) |
true if $filename is a directory. Definition at line 458 of file ezfilehandler.php.
| eZFileHandler::isExecutable | ( | $ | filename = false | ) |
true if $filename is executable. Definition at line 468 of file ezfilehandler.php.
| eZFileHandler::isFile | ( | $ | filename = false | ) |
true if $filename is a file. Definition at line 478 of file ezfilehandler.php.
| eZFileHandler::isLink | ( | $ | filename = false | ) |
true if $filename is a link. Definition at line 488 of file ezfilehandler.php.
| eZFileHandler::isOpen | ( | ) |
| eZFileHandler::isReadable | ( | $ | filename = false | ) |
true if $filename is readable. Definition at line 498 of file ezfilehandler.php.
| eZFileHandler::isWriteable | ( | $ | filename = false | ) |
true if $filename is writeable. Definition at line 508 of file ezfilehandler.php.
| static eZFileHandler::link | ( | $ | sourceFilename, |
| $ | destinationFilename | ||
| ) | [static] |
Creates a symbolic link to the file $sourceFilename on the destination $destinationFilename. This means that if someone tries to open $destinationFilename they will infact open $sourceFilename. If $destinationFilename is a directory then the filename is taken from $sourceFilename and appended to the destination. It will first try to rename the file and if that does not work copy the file and unlink.
true if sucessful or false if the copy failed. Definition at line 265 of file ezfilehandler.php.
Referenced by linkCopy().
| static eZFileHandler::linkCopy | ( | $ | sourceFilename, |
| $ | destinationFilename, | ||
| $ | symbolicLink = true |
||
| ) | [static] |
Links the file $sourceFilename to $destinationFilename. If $destinationFilename is a directory then the filename is taken from $sourceFilename and appended to the destination. It will use symbolic links for the operating system that support it and file copy for all others.
| $symbolicLink | if true then the files will be made as symbolic links, otherwise as hard links. |
true if sucessful or false if the copy failed. Definition at line 166 of file ezfilehandler.php.
Referenced by eZImageManager\convert(), and eZFSFileHandler\fileLinkCopy().
| eZFileHandler::mode | ( | ) |
Definition at line 127 of file ezfilehandler.php.
Referenced by eZGZIPZLIBCompressionHandler\doPasstrough(), and rename().
| static eZFileHandler::move | ( | $ | sourceFilename, |
| $ | destinationFilename | ||
| ) | [static] |
Moves the file $sourceFilename to $destinationFilename. If $destinationFilename is a directory then the filename is taken from $sourceFilename and appended to the destination. It will first try to rename the file and if that does not work copy the file and unlink.
true if sucessful or false if the copy failed. Definition at line 314 of file ezfilehandler.php.
| eZFileHandler::name | ( | ) |
Definition at line 136 of file ezfilehandler.php.
Referenced by eZForwardCompressionHandler\duplicate().
| eZFileHandler::open | ( | $ | filename, |
| $ | mode, | ||
| $ | binaryFile = true |
||
| ) |
Tries to open the file $filename with mode $mode and returns the file resource if succesful.
false if the file could not be opened. | $mode | If false the file will be opened in read mode using 'r' |
| $binaryFile | If true file will be opened in binary mode (default), otherwise text mode is used. |
Definition at line 534 of file ezfilehandler.php.
Referenced by rename().
| eZFileHandler::passtrough | ( | $ | closeFile = true | ) |
Passes the data from the file to the standard output.
| $closeFile | If true the file will be closed after output is done. |
false if something failed. Definition at line 785 of file ezfilehandler.php.
| eZFileHandler::read | ( | $ | length = false | ) |
Reads up to $length bytes from file. Reading stops when $length has been read or EOF is reached, whichever comes first. If the optional parameter $length is not specified it will read bytes until EOF is reached.
string or false if something fails. Definition at line 646 of file ezfilehandler.php.
| eZFileHandler::rename | ( | $ | destinationFilename, |
| $ | sourceFilename = false |
||
| ) |
Renames the file $sourceFilename to $destinationFilename. If $sourceFilename is not supplied then filename() is used, it will also close the current file connection and reopen it again if was already open.
Definition at line 622 of file ezfilehandler.php.
Referenced by doRename().
| eZFileHandler::rewind | ( | ) |
Rewinds the file position to the beginning of the file.
0 if something went wrong. Definition at line 740 of file ezfilehandler.php.
| eZFileHandler::seek | ( | $ | offset, |
| $ | whence = SEEK_SET |
||
| ) |
Seeks to position in file determined by $offset and $whence.
0 if succesful or -1 if something failed. Definition at line 725 of file ezfilehandler.php.
| eZFileHandler::statistics | ( | $ | filename = false | ) |
Definition at line 518 of file ezfilehandler.php.
| static eZFileHandler::symlink | ( | $ | sourceFilename, |
| $ | destinationFilename | ||
| ) | [static] |
Creates a symbolic link to the file $sourceFilename on the destination $destinationFilename. This means that if someone tries to open $destinationFilename they will infact open $sourceFilename. If $destinationFilename is a directory then the filename is taken from $sourceFilename and appended to the destination. It will first try to rename the file and if that does not work copy the file and unlink.
true if sucessful or false if the copy failed. Definition at line 192 of file ezfilehandler.php.
Referenced by linkCopy().
| eZFileHandler::tell | ( | ) |
Tells the current file position.
false if something failed. Definition at line 755 of file ezfilehandler.php.
| static eZFileHandler::unlink | ( | $ | filename = false | ) | [static] |
Tries to unlink the file from the file system.
Definition at line 601 of file ezfilehandler.php.
Referenced by doUnlink(), link(), move(), and symlink().
| eZFileHandler::write | ( | $ | data, |
| $ | length = false |
||
| ) |
Writes the content of the string $data to the file. If optional $length parameter is supplied writing will stop after length is reached or the end of the string is reached, whichever comes first.
Definition at line 684 of file ezfilehandler.php.
| eZFileHandler::$FileName |
Definition at line 1095 of file ezfilehandler.php.
| eZFileHandler::$IsBinary |
Definition at line 1097 of file ezfilehandler.php.
| eZFileHandler::$IsOpen |
Definition at line 1098 of file ezfilehandler.php.
| eZFileHandler::$Mode |
Definition at line 1096 of file ezfilehandler.php.
| eZFileHandler::$Name |
Definition at line 1094 of file ezfilehandler.php.