
Public Member Functions | |
| extract (spunQ_Folder $folder) | |
| Unpacks a zipfile. | |
| lock ($timeout=0) | |
| Tries to lock the file. | |
| unlock () | |
| Unlocks the previously locked file. | |
| getFolder () | |
| Alias for getContainingFolder(). | |
| getExtension () | |
| Gets the extension of this file. | |
| getMimeType () | |
| Gets the mime type of a file using the fileinfo module. | |
| create () | |
| Makes sure this file actually exists. | |
| delete () | |
| Deletes this file from the file system. | |
| rename ($newName, $overwrite) | |
| Renames the file, but keeps it in the same folder. | |
| copyTo ($file, $overwrite) | |
| Copies the contents of this file into another file. | |
| moveTo ($folder, $overwrite, $newName=NULL) | |
| Moves this file into another directory (and optionally renames it). | |
| readIntoArray () | |
| Reads the contents of this file into an array, where every line is an element. | |
| readIntoString () | |
| Reads the contents of this file into a string. | |
| getFileName () | |
| Gets the name of this file, up to the first dot. | |
| assureExists () | |
| Throws an exception if this file does not exist. | |
| write ($string, $append) | |
| Writes the content of the given string into the file. | |
| getSize () | |
| Gets this file's size in bytes. | |
| exists () | |
| Whether this node already exists in the file system. | |
| residesIn (spunQ_IFolder $folder) | |
| Checks whether this file is in given folder or one of its subfolders. | |
| isReadable () | |
| Whether the node is readable. | |
| getPath () | |
| Returns the path pointing to the node. | |
| getPrettyPath () | |
| Returns the most unique and human-readable path. | |
| getContainingFolder () | |
| Returns the folder this node is residing in. | |
| getName () | |
| Returns the name of this node, deprived of its path. | |
| getLastAccessTime () | |
| Returns the time of last access of this node. | |
| getLastModificationTime () | |
| Returns the time of last modification of this node. | |
| __toString () | |
| Returns getPrettyPath(). | |
Static Public Member Functions | |
| static | current () |
| Provides the spunQ_File object of the file calling this function. | |
| static | _init () |
| Initializes the class. | |
| static | _shutdown () |
| Deletes all temporary files. | |
| static | get ($path) |
| Factory method. | |
| static | createTemporaryFile (spunQ_Folder $folder=NULL, $deleteOnShutdown=true) |
| Creates a temporary file. | |
| static | pathIsAbsolute ($filePath) |
| Tests if a givebn file path is absolute or relative. | |
| static | prettifyPath ($path) |
| Makes transformations to a path string to make it more readable. | |
Protected Attributes | |
| $filePointer = NULL | |
| File pointer acquired through call to fopen(). | |
| $path | |
| The path pointing to the node. | |
Definition at line 6 of file ArchiveFile.class.php.
| spunQ_FileNode::__toString | ( | ) | [inherited] |
| static spunQ_File::_init | ( | ) | [static, inherited] |
Initializes the class.
Just registers a shutdown hook to delete temporary files.
Definition at line 31 of file File.class.php.
| static spunQ_File::_shutdown | ( | ) | [static, inherited] |
| spunQ_File::assureExists | ( | ) | [inherited] |
Throws an exception if this file does not exist.
| spunQ_IOException |
Implements spunQ_IFile.
Definition at line 280 of file File.class.php.
| spunQ_File::copyTo | ( | $ | file, | |
| $ | overwrite | |||
| ) | [inherited] |
Copies the contents of this file into another file.
| $file | The file to copy to. Either a spunQ_IFile object or a string. | |
| $overwrite | Whether the destination file should be overwritten. |
Implements spunQ_IFile.
Definition at line 202 of file File.class.php.
| spunQ_File::create | ( | ) | [inherited] |
Makes sure this file actually exists.
Doesn't do anything, if the node already exists.
Implements spunQ_IFile.
Definition at line 173 of file File.class.php.
| static spunQ_File::createTemporaryFile | ( | spunQ_Folder $ | folder = NULL, |
|
| $ | deleteOnShutdown = true | |||
| ) | [static, inherited] |
Creates a temporary file.
The file will have a random name and will be deleted when the process finishes.
| $folder | The folder to create the file in. The system's temporary folder will be used if this parameter is omitted. | |
| $deleteOnShutdown | The file will be deleted as soon as the PHP process comes to an end. |
Definition at line 67 of file File.class.php.
| static spunQ_File::current | ( | ) | [static, inherited] |
Provides the spunQ_File object of the file calling this function.
You can use this function to get the file you're currently in, if you want a file relative to that one. Makes use of spunQ_Backtrace.
Definition at line 20 of file File.class.php.
| spunQ_File::delete | ( | ) | [inherited] |
Deletes this file from the file system.
Implements spunQ_IFile.
Definition at line 184 of file File.class.php.
| spunQ_FileNode::exists | ( | ) | [inherited] |
Whether this node already exists in the file system.
It is perfectly valid for an object to describe a non-existent node.
Implements spunQ_IFileNode.
Definition at line 78 of file FileNode.class.php.
| spunQ_ArchiveFile::extract | ( | spunQ_Folder $ | folder | ) | [abstract] |
Unpacks a zipfile.
| $folder | The spunQ_Folder where the archive should be created. |
Reimplemented in spunQ_ZipFile.
| static spunQ_File::get | ( | $ | path | ) | [static, inherited] |
Factory method.
Creates a file object that will operate on the given path.
| $path | A string describing a path on the file system |
Reimplemented in spunQ_GzipFile, spunQ_SectionedConfigFile, and spunQ_ZipFile.
Definition at line 53 of file File.class.php.
| spunQ_FileNode::getContainingFolder | ( | ) | [inherited] |
Returns the folder this node is residing in.
Implements spunQ_IFileNode.
Definition at line 127 of file FileNode.class.php.
| spunQ_File::getExtension | ( | ) | [inherited] |
Gets the extension of this file.
Extension is defined as the last part of the file that is seperated by a dot. The extension of the file 'Some.class.php' is 'php'.
Implements spunQ_IFile.
Definition at line 155 of file File.class.php.
| spunQ_File::getFileName | ( | ) | [inherited] |
Gets the name of this file, up to the first dot.
The FileName of 'Some.class.php' is 'Some'.
Implements spunQ_IFile.
Definition at line 273 of file File.class.php.
| spunQ_File::getFolder | ( | ) | [inherited] |
Alias for getContainingFolder().
Implements spunQ_IFile.
Definition at line 148 of file File.class.php.
| spunQ_FileNode::getLastAccessTime | ( | ) | [inherited] |
Returns the time of last access of this node.
| spunQ_IOException | If the timestamp could not be read. |
Implements spunQ_IFileNode.
Definition at line 141 of file FileNode.class.php.
| spunQ_FileNode::getLastModificationTime | ( | ) | [inherited] |
Returns the time of last modification of this node.
| spunQ_IOException | If the timestamp could not be read. |
Implements spunQ_IFileNode.
Definition at line 151 of file FileNode.class.php.
| spunQ_File::getMimeType | ( | ) | [inherited] |
Gets the mime type of a file using the fileinfo module.
Definition at line 163 of file File.class.php.
| spunQ_FileNode::getName | ( | ) | [inherited] |
Returns the name of this node, deprived of its path.
Implements spunQ_IFileNode.
Definition at line 134 of file FileNode.class.php.
| spunQ_FileNode::getPath | ( | ) | [inherited] |
Returns the path pointing to the node.
Implements spunQ_IFileNode.
Definition at line 102 of file FileNode.class.php.
| spunQ_FileNode::getPrettyPath | ( | ) | [inherited] |
Returns the most unique and human-readable path.
If the file exists, the builtin function realpath() is used. Otherwise, a better-looking path is achieved through string manipulation, i.e. '../a/../d/./' becomes '../d/'.
Implements spunQ_IFileNode.
Definition at line 109 of file FileNode.class.php.
| spunQ_File::getSize | ( | ) | [inherited] |
Gets this file's size in bytes.
| spunQ_IOException |
Implements spunQ_IFile.
Definition at line 300 of file File.class.php.
| spunQ_FileNode::isReadable | ( | ) | [inherited] |
Whether the node is readable.
Implements spunQ_IFileNode.
Definition at line 95 of file FileNode.class.php.
| spunQ_File::lock | ( | $ | timeout = 0 |
) | [inherited] |
Tries to lock the file.
Will try to acquire an exclusive write lock to the file. Note that this function will block (as if the $timeout parameter was NULL) regardless of the function parameter on a windows machine due to the implementation of flock().
| $timeout | Amount of seconds the function should block until the file is locked. Setting this to NULL will block indefinitely (until max_execution_time runs out). The default value of 0 will not block at all. |
Definition at line 101 of file File.class.php.
| spunQ_File::moveTo | ( | $ | folder, | |
| $ | overwrite, | |||
| $ | newName = NULL | |||
| ) | [inherited] |
Moves this file into another directory (and optionally renames it).
| $folder | the folder to move to. Either a spunQ_IFolder or a string. | |
| $overwrite | Whether the destination file should be overwritten. | |
| $newName | The file will be renamed, too if this is set. |
Implements spunQ_IFile.
Definition at line 219 of file File.class.php.
| static spunQ_FileNode::pathIsAbsolute | ( | $ | filePath | ) | [static, inherited] |
Tests if a givebn file path is absolute or relative.
| $filePath | The file path - a string. |
Definition at line 14 of file FileNode.class.php.
| static spunQ_FileNode::prettifyPath | ( | $ | path | ) | [static, inherited] |
Makes transformations to a path string to make it more readable.
Removes references to current and upper directories (/foo/.. or foo/.), for example. Assumes that the path has a slash as delimiter. if you want to use this function on a windows path, make sure to replace backslashes by forward slashes beforehand.
| $path | The path string to transform. |
Definition at line 34 of file FileNode.class.php.
| spunQ_File::readIntoArray | ( | ) | [inherited] |
Reads the contents of this file into an array, where every line is an element.
Implements spunQ_IFile.
Reimplemented in spunQ_GzipFile.
Definition at line 251 of file File.class.php.
| spunQ_File::readIntoString | ( | ) | [inherited] |
Reads the contents of this file into a string.
Implements spunQ_IFile.
Reimplemented in spunQ_GzipFile.
Definition at line 262 of file File.class.php.
| spunQ_File::rename | ( | $ | newName, | |
| $ | overwrite | |||
| ) | [inherited] |
Renames the file, but keeps it in the same folder.
Use moveTo() if you want to rename and move.
| $newName | The new name of the file. | |
| $overwrite | Whether the destination file should be overwritten. |
Implements spunQ_IFile.
Definition at line 195 of file File.class.php.
| spunQ_FileNode::residesIn | ( | spunQ_IFolder $ | folder | ) | [inherited] |
Checks whether this file is in given folder or one of its subfolders.
| $folder | The folder to test against. |
Implements spunQ_IFileNode.
Definition at line 85 of file FileNode.class.php.
| spunQ_File::unlock | ( | ) | [inherited] |
Unlocks the previously locked file.
Definition at line 137 of file File.class.php.
| spunQ_File::write | ( | $ | string, | |
| $ | append | |||
| ) | [inherited] |
Writes the content of the given string into the file.
| $string | The string to write | |
| $append | Whether to append to the exiosting file, or replace its content. |
| spunQ_IOException |
Implements spunQ_IFile.
Reimplemented in spunQ_GzipFile.
Definition at line 290 of file File.class.php.
spunQ_File::$filePointer = NULL [protected, inherited] |
File pointer acquired through call to fopen().
The file pointer is current only used when locking the file through flock()! I repeat: it is not used for reading/writing data, merely for locking the file.
Definition at line 86 of file File.class.php.
spunQ_FileNode::$path [protected, inherited] |
1.5.9