system/io/WinNTFileSystem.php
FileSystem for Windows NT/2000.
- Package
- phing.system.io
\WinNTFileSystem
FileSystem for Windows NT/2000.
You should also use this class as a template to write your local implementation Some native PHP filesystem specific methods are abstracted here as well. Anyway you must always use this methods via a PhingFile object (that by nature uses the *FileSystem drivers to access the real filesystem via this class using natives.
FIXME: - Error handling reduced to min fallthrough runtime exceptions more precise errorhandling is done by the PhingFile class
- Parent(s)
- \Win32FileSystem < \FileSystem
- Author
- Charlie Killian
- Author
- Hans Lellelid
- Version
- $Id$
Constants

int
BA_EXISTS
= 0x01
- Inherited_from
- \FileSystem::BA_EXISTS
- Inherited_from
- \Win32FileSystem::BA_EXISTS
- int

int
BA_REGULAR
= 0x02
- Inherited_from
- \FileSystem::BA_REGULAR
- Inherited_from
- \Win32FileSystem::BA_REGULAR
- int

int
BA_DIRECTORY
= 0x04
- Inherited_from
- \FileSystem::BA_DIRECTORY
- Inherited_from
- \Win32FileSystem::BA_DIRECTORY
- int

int
BA_HIDDEN
= 0x08
- Inherited_from
- \FileSystem::BA_HIDDEN
- Inherited_from
- \Win32FileSystem::BA_HIDDEN
- int
Properties


$altSlash= ''
- Type
- n/a
- Inherited_from
- \Win32FileSystem::$$altSlash


$driveDirCache= 'array()'
array()
Details- Type
- n/a
- Inherited_from
- \Win32FileSystem::$$driveDirCache


\FileSystem
$fs= ''
Instance for getFileSystem() method.
Inherited from: \FileSystem::$$fs\Win32FileSystem::$$fs- Type
- \FileSystem
- Inherited_from
- \FileSystem::$$fs
- Inherited_from
- \Win32FileSystem::$$fs


$semicolon= ''
- Type
- n/a
- Inherited_from
- \Win32FileSystem::$$semicolon


$slash= ''
- Type
- n/a
- Inherited_from
- \Win32FileSystem::$$slash
Methods


_access(
$path
)
:
void
Name | Type | Description |
---|---|---|
$path |


_getDrive(
$path
)
:
void
Name | Type | Description |
---|---|---|
$path |


canDelete(
\PhingFile $f
)
:
boolean
Whether file can be deleted.
Inherited from: \FileSystem::canDelete()\Win32FileSystem::canDelete()Name | Type | Description |
---|---|---|
$f | \PhingFile |
Type | Description |
---|---|
boolean |


canonicalize(
string $strPath
)
:
mixed
canonicalize filename by checking on disk
Inherited from: \FileSystem::canonicalize()\Win32FileSystem::canonicalize()Name | Type | Description |
---|---|---|
$strPath | string |
Type | Description |
---|---|
mixed | Canonical path or false if the file doesn't exist. |


checkAccess(
\PhingFile $f, boolean $write
=
false
)
:
void
Check whether the file or directory denoted by the given abstract pathname may be accessed by this process. 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()\Win32FileSystem::checkAccess()Name | Type | Description |
---|---|---|
$f | \PhingFile | |
$write | boolean |


chgrp(
string $pathname, string $group
)
:
void
Change the group on a file or directory.
Inherited from: \FileSystem::chgrp()\Win32FileSystem::chgrp()Name | Type | Description |
---|---|---|
$pathname | string | Path and name of file or directory. |
$group | string | The group of the file or directory. See http://us.php.net/chgrp |
Exception | Description |
---|---|
\IOException | if operation failed. |


chmod(
string $pathname, int $mode
)
:
void
Change the permissions on a file or directory.
Inherited from: \FileSystem::chmod()\Win32FileSystem::chmod()Name | Type | Description |
---|---|---|
$pathname | string | Path and name of file or directory. |
$mode | 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. |
Exception | Description |
---|---|
\IOException | if operation failed. |


chown(
string $pathname, string $user
)
:
void
Change the ownership on a file or directory.
Inherited from: \FileSystem::chown()\Win32FileSystem::chown()Name | Type | Description |
---|---|---|
$pathname | string | Path and name of file or directory. |
$user | string | The user name or number of the file or directory. See http://us.php.net/chown |
Exception | Description |
---|---|
\Exception | if operation failed. |


compare(
\PhingFile $f1, \PhingFile $f2
)
:
void
Name | Type | Description |
---|---|---|
$f1 | \PhingFile | |
$f2 | \PhingFile |


compareMTimes(
\file1 $file1, \file2 $file2
)
:
\Int.
Compare the modified time of two files.
Inherited from: \FileSystem::compareMTimes()\Win32FileSystem::compareMTimes()Name | Type | Description |
---|---|---|
$file1 | \file1 | String. Path and name of file1. |
$file2 | \file2 | String. Path and name of file2. |
Type | Description |
---|---|
\Int. | 1 if file1 is newer. -1 if file2 is newer. 0 if files have the same time. Err object on failure. |
Exception | Description |
---|---|
\Exception | - if cannot get modified time of either file. |


copy(
\PhingFile $src, \PhingFile $dest
)
:
void
Name | Type | Description |
---|---|---|
$src | \PhingFile | Source path and name file to copy. |
$dest | \PhingFile | Destination path and name of new file. |
Exception | Description |
---|---|
\IOException | if file cannot be copied. |


copyr(
string $source, string $dest
)
:
bool
Copy a file, or recursively copy a folder and its contents
Inherited from: \FileSystem::copyr()\Win32FileSystem::copyr()Name | Type | Description |
---|---|---|
$source | string | Source path |
$dest | string | Destination path |
Type | Description |
---|---|
bool | Returns TRUE on success, FALSE on failure |
- Author
- Aidan Lister
- Link
- http://aidanlister.com/repos/v/function.copyr.php
- Version
- 1.0.1


createDirectory(
\PhingFile $f, int $mode
=
0755
)
:
boolean
Create a new directory denoted by the given abstract pathname, returning true if and only if the operation succeeds.
Inherited from: \FileSystem::createDirectory()\Win32FileSystem::createDirectory()NOTE: umask() is reset to 0 while executing mkdir(), and restored afterwards
Name | Type | Description |
---|---|---|
$f | \PhingFile | |
$mode | int |
Type | Description |
---|---|
boolean |


createNewFile(
string $strPathname
)
:
boolean
Create a new empty file with the given pathname. 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()\Win32FileSystem::createNewFile()Name | Type | Description |
---|---|---|
$strPathname | string | Path of the file to be created. |
Type | Description |
---|---|
boolean |
Exception | Description |
---|---|
\IOException |


delete(
\PhingFile $f, boolean $recursive
=
false
)
:
void
Delete the file or directory denoted by the given abstract pathname, returning true if and only if the operation succeeds.
Inherited from: \FileSystem::delete()\Win32FileSystem::delete()Name | Type | Description |
---|---|---|
$f | \PhingFile | |
$recursive | boolean |


deleteOnExit(
\PhingFile $f
)
:
void
Arrange for the file or directory denoted by the given abstract pathname to be deleted when Phing::shutdown is called, returning true if and only if the operation succeeds.
Inherited from: \FileSystem::deleteOnExit()\Win32FileSystem::deleteOnExit()Name | Type | Description |
---|---|---|
$f | \PhingFile |
Exception | Description |
---|---|
\IOException |


fromURIPath(
$strPath
)
:
void
Post-process the given URI path string if necessary. 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.
Inherited from: \Win32FileSystem::fromURIPath()Name | Type | Description |
---|---|---|
$strPath |


getBooleanAttributes(
\PhingFile $f
)
:
void
Return the simple boolean attributes for the file or directory denoted by the given abstract pathname, or zero if it does not exist or some other I/O error occurs.
Inherited from: \FileSystem::getBooleanAttributes()\Win32FileSystem::getBooleanAttributes()Name | Type | Description |
---|---|---|
$f | \PhingFile |


getDefaultParent(
)
:
void
Return the parent pathname string to be used when the parent-directory argument in one of the two-argument PhingFile constructors is the empty pathname.
Inherited from: \Win32FileSystem::getDefaultParent()

getFileSystem(
)
:
\FileSystem
Static method to return the FileSystem singelton representing this platform's local filesystem driver.
Inherited from: \FileSystem::getFileSystem()\Win32FileSystem::getFileSystem()Type | Description |
---|---|
\FileSystem |
Exception | Description |
---|---|
\IOException |


getLastModifiedTime(
\PhingFile $f
)
:
int
Return the time at which the file or directory denoted by the given abstract pathname was last modified, or zero if it does not exist or some other I/O error occurs.
Inherited from: \FileSystem::getLastModifiedTime()\Win32FileSystem::getLastModifiedTime()Name | Type | Description |
---|---|---|
$f | \PhingFile |
Type | Description |
---|---|
int |
Exception | Description |
---|---|
\IOException |


getLength(
\PhingFile $f
)
:
int
Return the length in bytes of the file denoted by the given abstract pathname, or zero if it does not exist, is a directory, or some other I/O error occurs.
Inherited from: \FileSystem::getLength()\Win32FileSystem::getLength()Name | Type | Description |
---|---|---|
$f | \PhingFile |
Type | Description |
---|---|
int |
Exception | Description |
---|---|
\IOException |


getPathSeparator(
)
:
void
Return the local filesystem's path-separator character.
Inherited from: \Win32FileSystem::getPathSeparator()

getSeparator(
)
:
void
Return the local filesystem's name-separator character.
Inherited from: \Win32FileSystem::getSeparator()

isAbsolute(
\PhingFile $f
)
:
void
Tell whether or not the given abstract pathname is absolute.
Inherited from: \Win32FileSystem::isAbsolute()Name | Type | Description |
---|---|---|
$f | \PhingFile |


isLetter(
$c
)
:
void
Name | Type | Description |
---|---|---|
$c |


isSlash(
$c
)
:
void
Name | Type | Description |
---|---|---|
$c |


listDir(
\PhingFile $f
)
:
void
List the elements of the directory denoted by the given abstract
pathname. Return an array of strings naming the elements of the
directory if successful; otherwise, return null
.
Name | Type | Description |
---|---|---|
$f | \PhingFile |


listRoots(
)
:
void
List the available filesystem roots, return array of PhingFile objects
Inherited from: \Win32FileSystem::listRoots()Exception | Description |
---|---|
\IOException |


lock(
\PhingFile $f
)
:
void
Locks a file and throws an Exception if this is not possible.
Inherited from: \FileSystem::lock()\Win32FileSystem::lock()Name | Type | Description |
---|---|---|
$f | \PhingFile |
Exception | Description |
---|---|
\Exception |


normalize(
string $strPath
)
:
string
Check that the given pathname is normal. If not, invoke the real normalizer on the part of the pathname that requires normalization.
Inherited from: \Win32FileSystem::normalize()This way we iterate through the whole pathname string only once.
Name | Type | Description |
---|---|---|
$strPath | string |
Type | Description |
---|---|
string |


normalizePrefix(
$strPath, $len, $sb
)
:
void
A normal Win32 pathname contains no duplicate slashes, except possibly for a UNC prefix, and does not end with a slash. It may be the empty string. Normalized Win32 pathnames have the convenient property that the length of the prefix almost uniquely identifies the type of the path and whether it is absolute or relative:
Inherited from: \Win32FileSystem::normalizePrefix()0 relative to both drive and directory 1 drive-relative (begins with '\') 2 absolute UNC (if first char is '\'), else directory-relative (has form "z:foo") 3 absolute local pathname (begins with "z:\")
Name | Type | Description |
---|---|---|
$strPath | ||
$len | ||
$sb |


normalizer(
$strPath, $len, $offset
)
:
void
Normalize the given pathname, whose length is len, starting at the given offset; everything before this offset is already normal.
Inherited from: \Win32FileSystem::normalizer()Name | Type | Description |
---|---|---|
$strPath | ||
$len | ||
$offset |


prefixLength(
$strPath
)
:
void
Compute the length of this pathname string's prefix. The pathname string must be in normal form.
Inherited from: \Win32FileSystem::prefixLength()Name | Type | Description |
---|---|---|
$strPath |


rename(
\PhingFile $f1, \PhingFile $f2
)
:
void
Rename the file or directory denoted by the first abstract pathname to the second abstract pathname, returning true if and only if the operation succeeds.
Inherited from: \FileSystem::rename()\Win32FileSystem::rename()Name | Type | Description |
---|---|---|
$f1 | \PhingFile | abstract source file |
$f2 | \PhingFile | abstract destination file |
Exception | Description |
---|---|
\IOException | if rename cannot be performed |


resolve(
string $parent, string $child
)
:
void
Resolve the child pathname string against the parent.
Inherited from: \Win32FileSystem::resolve()Both strings must be in normal form, and the result will be a string in normal form.
Name | Type | Description |
---|---|---|
$parent | string | |
$child | string |


resolveFile(
\PhingFile $f
)
:
void
Resolve the given abstract pathname into absolute form. Invoked by the getAbsolutePath and getCanonicalPath methods in the PhingFile class.
Inherited from: \Win32FileSystem::resolveFile()Name | Type | Description |
---|---|---|
$f | \PhingFile |


rmdir(
\dir $dir, \children $children
=
false
)
:
void
Delete an empty directory OR a directory and all of its contents.
Inherited from: \FileSystem::rmdir()\Win32FileSystem::rmdir()Name | Type | Description |
---|---|---|
$dir | \dir | String. Path and/or name of directory to delete. |
$children | \children | Boolean. False: don't delete directory contents. True: delete directory contents. |


setLastModifiedTime(
\PhingFile $f, int $time
)
:
void
Set the last-modified time of the file or directory denoted by the given abstract pathname returning true if and only if the operation succeeds.
Inherited from: \FileSystem::setLastModifiedTime()\Win32FileSystem::setLastModifiedTime()Name | Type | Description |
---|---|---|
$f | \PhingFile | |
$time | int |
Exception | Description |
---|---|
\IOException |


setReadOnly(
\PhingFile $f
)
:
void
Mark the file or directory denoted by the given abstract pathname as
read-only, returning true
if and only if the operation
succeeds.
Name | Type | Description |
---|---|---|
$f | \PhingFile |
Exception | Description |
---|---|
\IOException |


slashify(
$p
)
:
void
Name | Type | Description |
---|---|---|
$p |


symlink(
string $target, string $link
)
:
void
Symbolically link a file to another name.
Inherited from: \FileSystem::symlink()\Win32FileSystem::symlink()Currently symlink is not implemented on Windows. Don't use if the application is to be portable.
Name | Type | Description |
---|---|---|
$target | string | Path and/or name of file to link. |
$link | string | Path and/or name of link to be created. |


touch(
string $file, int $time
=
null
)
:
void
Set the modification and access time on a file to the present time.
Inherited from: \FileSystem::touch()\Win32FileSystem::touch()Name | Type | Description |
---|---|---|
$file | string | Path and/or name of file to touch. |
$time | int |


umask(
\mode $mode
)
:
void
Set the umask for file and directory creation.
Inherited from: \FileSystem::umask()\Win32FileSystem::umask()Name | Type | Description |
---|---|---|
$mode | \mode | Int. Permissions ususally in ocatal. Use leading 0 for octal. Number between 0 and 0777. |
Exception | Description |
---|---|
\Exception | if there is an error performing operation. |


unlink(
string $file
)
:
void
Name | Type | Description |
---|---|---|
$file | string | Path and/or name of file to delete. |
Exception | Description |
---|---|
\IOException | - if an error is encountered. |


unlock(
\PhingFile $f
)
:
void
Unlocks a file and throws an IO Error if this is not possible.
Inherited from: \FileSystem::unlock()\Win32FileSystem::unlock()Name | Type | Description |
---|---|---|
$f | \PhingFile |
Exception | Description |
---|---|
\IOException |