UnixFileSystem class.
This class encapsulates the basic file system functions for platforms using the unix (posix)-stylish filesystem. It wraps php native functions suppressing normal PHP error reporting and instead uses Exception to report and error.
This class is part of a oop based filesystem abstraction and targeted to run on all supported php platforms.
Note: For debugging turn track_errors on in the php.ini. The error messages and log messages from this class will then be clearer because $php_errormsg is passed as part of the message.
FIXME: - Comments - Error handling reduced to min, error are handled by PhingFile mainly
author | Andreas Aderhold, andi@binarycloud.com |
---|---|
version | $Id: 43eeab8bf90dfca56552b4ad3d57d97bdee1acc9 $ |
package | phing.system.io |
canDelete(\PhingFile $f) : boolean
canonicalize(string $strPath) : mixed
inherited_from | \FileSystem::canonicalize() |
---|
string
mixed
Canonical path or false if the file doesn't exist.checkAccess(\PhingFile $f, boolean $write)
If the second argument is false, then a check for read access is made; if the second argument is true, then a check for write (not read-write) access is made. Return false if access is denied or an I/O error occurs.
inherited_from | \FileSystem::checkAccess() |
---|
\PhingFile
boolean
chgrp(string $pathname, string $group) : void
inherited_from | \FileSystem::chgrp() |
---|
string
Path and name of file or directory.
string
The group of the file or directory. See http://us.php.net/chgrp
\IOException |
if operation failed. |
---|
chmod(string $pathname, int $mode) : void
inherited_from | \FileSystem::chmod() |
---|
string
Path and name of file or directory.
int
The mode (permissions) of the file or directory. If using octal add leading 0. eg. 0777. Mode is affected by the umask system setting.
\IOException |
if operation failed. |
---|
chown(string $pathname, string $user) : void
inherited_from | \FileSystem::chown() |
---|
string
Path and name of file or directory.
string
The user name or number of the file or directory. See http://us.php.net/chown
\Exception |
if operation failed. |
---|
compare(\PhingFile $f1, \PhingFile $f2)
compareMTimes(\file1 $file1, \file2 $file2) : \Int.
inherited_from | \FileSystem::compareMTimes() |
---|
\file1
String. Path and name of file1.
\file2
String. Path and name of file2.
\Exception |
- if cannot get modified time of either file. |
---|
\Int.
1 if file1 is newer.
-1 if file2 is newer.
0 if files have the same time.
Err object on failure.copy(\PhingFile $src, \PhingFile $dest) : void
copyr(string $source, string $dest) : bool
author | Aidan Lister |
---|---|
version | 1.0.1 |
link | http://aidanlister.com/repos/v/function.copyr.php |
inherited_from | \FileSystem::copyr() |
string
Source path
string
Destination path
bool
Returns TRUE on success, FALSE on failurecreateDirectory(\PhingFile $f, int $mode) : boolean
NOTE: umask() is reset to 0 while executing mkdir(), and restored afterwards
inherited_from | \FileSystem::createDirectory() |
---|
\PhingFile
int
boolean
createNewFile(string $strPathname) : boolean
Return true if the file was created and false if a file or directory with the given pathname already exists. Throw an IOException if an I/O error occurs.
inherited_from | \FileSystem::createNewFile() |
---|
string
Path of the file to be created.
\IOException |
---|
boolean
delete(\PhingFile $f, boolean $recursive) : void
deleteOnExit(\PhingFile $f)
fromURIPath($p)
This is used on win32, e.g., to transform "/c:/foo" into "c:/foo". The path string still has slash separators; code in the PhingFile class will translate them after this method returns.
getBooleanAttributes(\PhingFile $f)
\PhingFile
getDefaultParent()
getFileSystem() : \FileSystem
getLastModifiedTime(\PhingFile $f) : int
inherited_from | \FileSystem::getLastModifiedTime() |
---|
\PhingFile
\IOException |
---|
int
getLength(\PhingFile $f) : int
inherited_from | \FileSystem::getLength() |
---|
\PhingFile
\IOException |
---|
int
getPathSeparator()
getSeparator()
isAbsolute(\PhingFile $f)
\PhingFile
listDir(\PhingFile $f)
Return an array of strings naming the elements of the directory if successful; otherwise, return
null
.
inherited_from | \FileSystem::listDir() |
---|
\PhingFile
listRoots()
\IOException |
---|
lister($f)
lock(\PhingFile $f) : void
normalize($strPathname)
It may be the empty string.
Check that the given pathname is normal. If not, invoke the real normalizer on the part of the pathname that requires normalization. This way we iterate through the whole pathname string only once.
NOTE: this method no longer expands the tilde (~) character!
prefixLength(string $pathname)
The pathname string must be in normal form.
string
rename(\PhingFile $f1, \PhingFile $f2) : void
inherited_from | \FileSystem::rename() |
---|
\IOException |
if rename cannot be performed |
---|
resolve(string $parent, string $child)
Both strings must be in normal form, and the result will be in normal form.
string
string
resolveFile(\PhingFile $f)
Invoked by the getAbsolutePath and getCanonicalPath methods in the PhingFile class.
\PhingFile
rmdir(\dir $dir, \children $children) : void
inherited_from | \FileSystem::rmdir() |
---|
\dir
String. Path and/or name of directory to delete.
\children
Boolean. False: don't delete directory contents. True: delete directory contents.
setLastModifiedTime(\PhingFile $f, int $time) : void
inherited_from | \FileSystem::setLastModifiedTime() |
---|
\PhingFile
int
\IOException |
---|
symlink(string $target, string $link) : void
Currently symlink is not implemented on Windows. Don't use if the application is to be portable.
inherited_from | \FileSystem::symlink() |
---|
string
Path and/or name of file to link.
string
Path and/or name of link to be created.
touch(string $file, int $time) : void
inherited_from | \FileSystem::touch() |
---|
string
Path and/or name of file to touch.
int
umask(\mode $mode) : void
inherited_from | \FileSystem::umask() |
---|
\mode
Int. Permissions ususally in ocatal. Use leading 0 for octal. Number between 0 and 0777.
\Exception |
if there is an error performing operation. |
---|
unlink(string $file) : void
inherited_from | \FileSystem::unlink() |
---|
string
Path and/or name of file to delete.
\IOException |
- if an error is encountered. |
---|
unlock(\PhingFile $f) : void
normalizer($pathname, $len, $offset)
BA_DIRECTORY : int
inherited_from | \FileSystem::BA_DIRECTORY |
---|
BA_EXISTS : int
inherited_from | \FileSystem::BA_EXISTS |
---|
BA_HIDDEN : int
inherited_from | \FileSystem::BA_HIDDEN |
---|
BA_REGULAR : int
inherited_from | \FileSystem::BA_REGULAR |
---|