boolean atomicWrite(
string
$filename, string
$data
)
|
|
Perform an atomic write to a file. This guarantees that the data written is not corrupted (but it does not prevent another process from immediately replacing the file with its own version).
Parameters:
string |
$filename: |
|
string |
$data: |
data to be written |
API Tags:
Return: | success or failure |
boolean chdir(
string
$path
)
|
|
chdir -- change working directory.
Parameters:
API Tags:
boolean chmod(
string
$path, [int
$mode = null]
)
|
|
Set filesystem permissions; mode defaults to system preference for file/dir permissions.
Parameters:
string |
$path: |
path to file or directory |
int |
$mode: |
(optional) mode; defaults to system preference |
API Tags:
Redefined in descendants as:
void closedir(
resource
$resource
)
|
|
Close a directory resource.
Parameters:
resource |
$resource: |
a directory resource |
Redefined in descendants as:
boolean copy(
string
$source, string
$dest
)
|
|
Copy a file.
Parameters:
string |
$source: |
the source file |
string |
$dest: |
the destination file |
API Tags:
Return: | true if the copy succeeded, false otherwise |
Redefined in descendants as:
array(boolean exec(
array
$cmdArray
)
|
|
Execute a command and record the results and status.
Parameters:
array |
$cmdArray: |
array(array('cmd', 'arg'), ...) |
API Tags:
Return: | true if the command succeeded, false otherwise, array standard output from the command array error output from the command) |
Redefined in descendants as:
boolean fclose(
resource
$handle
)
|
|
Closes an open file pointer.
Parameters:
API Tags:
Return: | true on success, false on failure |
Redefined in descendants as:
boolean feof(
resource
$handle
)
|
|
Tests for end-of-file on a file pointer.
Parameters:
API Tags:
Return: | true if the file pointer is at EOF |
Redefined in descendants as:
boolean fflush(
resource
$handle
)
|
|
Flush an open file pointer.
Parameters:
API Tags:
Return: | true on success, false on failure |
Redefined in descendants as:
the fgets(
resource
$handle, [int
$length = 0]
)
|
|
Gets line from file pointer.
Parameters:
resource |
$handle: |
|
int |
$length: |
the optional max line length |
API Tags:
Return: | string or false on eof |
Redefined in descendants as:
array file(
string
$filename, [int
$use_include_path = false]
)
|
|
Return a file as an array.
Parameters:
string |
$filename: |
a file path or URL |
int |
$use_include_path: |
if this is set to 1, search the include path also |
API Tags:
Redefined in descendants as:
int filesize(
string
$filename
)
|
|
How large is the given file?
Parameters:
string |
$filename: |
full filesystem path to a file |
API Tags:
Return: | the size in bytes |
Redefined in descendants as:
boolean file_exists(
string
$filename
)
|
|
Does the given file exist?
Parameters:
string |
$filename: |
full filesystem path to a file |
API Tags:
Return: | true if the file exists, false otherwise |
Redefined in descendants as:
string file_get_contents(
string
$path
)
|
|
Reads the entire contents of the specified file into a string.
Parameters:
API Tags:
Return: | file contents or boolean false on failure |
boolean file_put_contents(
string
$path, string
$data
)
|
|
Writes specified data to file. Uses PHP's file_put_contents() function if it is available.
Parameters:
string |
$path: |
output file path |
string |
$data: |
data to write |
API Tags:
Return: | true on success, false on failure |
true flock(
resource
$handle, int
$operation,
&$wouldblock, boolean
$wouldblock
)
|
|
flock -- Portable advisory file locking.
Parameters:
resource |
$handle: |
a file handle |
int |
$operation: |
(LOCK_SH, LOCK_EX, LOCK_UN) [ | LOCK_NB] |
boolean |
$wouldblock: |
set to true if the operation would have blocked |
|
&$wouldblock: |
|
API Tags:
resource fopen(
string
$filename, string
$mode, [int
$use_include_path = 0]
)
|
|
Open a file or URL.
Parameters:
string |
$filename: |
a file path or URL |
string |
$mode: |
a file mode |
int |
$use_include_path: |
if this is set to 1, search the include path also |
API Tags:
Return: | a file descriptor |
Redefined in descendants as:
string fread(
resource
$handle, int
$length
)
|
|
Reads data from an open file handle.
Parameters:
resource |
$handle: |
|
int |
$length: |
|
API Tags:
Redefined in descendants as:
int fseek(
resource
$handle, int
$offset, [int
$whence = SEEK_SET]
)
|
|
Seeks on a file pointer.
Parameters:
resource |
$handle: |
|
int |
$offset: |
|
int |
$whence: |
|
API Tags:
Return: | 0 upon success, otherwise -1 |
resource fsockopen(
string
$target, int
$port,
&$errno,
&$errstr, int
$timeout, int
$errno, string
$errstr
)
|
|
Initiates a socket connection to the resource specified by target.
Parameters:
string |
$target: |
the hostname |
int |
$port: |
the port |
int |
$errno: |
the error number (out) |
string |
$errstr: |
the error string (out) |
int |
$timeout: |
the timeout |
|
&$errno: |
|
|
&$errstr: |
|
API Tags:
Redefined in descendants as:
boolean ftruncate(
resource
$handle, int
$size
)
|
|
Truncates a file to a given length.
Parameters:
resource |
$handle: |
|
int |
$size: |
|
API Tags:
int fwrite(
resource
$handle, string
$string, [int
$length = null]
)
|
|
Write the contents of string to the file stream pointed to by handle.
Parameters:
resource |
$handle: |
the handle |
string |
$string: |
the buffer |
int |
$length: |
how many bytes to write (optional) |
API Tags:
Return: | the number of bytes written |
Redefined in descendants as:
getcwd -- gets the current working directory.
API Tags:
Return: | current working directory, or false on failure. |
Redefined in descendants as:
string getDirectorySeparator(
)
|
|
Return the filesystem specific directory separator.
API Tags:
Return: | directory separator |
Redefined in descendants as:
array getimagesize(
string
$filename
)
|
|
Get size information about an image.
Parameters:
string |
$filename: |
the image file name |
API Tags:
Return: | with 4 elements. Index 0 contains the width of the image in pixels. Index 1 contains the height. Index 2 is a flag indicating the type of the image: 1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF(intel byte order), 8 = TIFF(motorola byte order), 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC, 14 = IFF. These values correspond to the IMAGETYPE constants that were added in PHP 4.3. Index 3 is a text string with the correct height="yyy" width="xxx" string that can be used directly in an IMG tag. |
Redefined in descendants as:
string getLegalPathCharacters(
)
|
|
Legal characters on all systems: A-Z a-z 0-9 # _ . -
Specific platform implementations can override this.
API Tags:
Return: | a string composed of all legal path characters |
Return the string of characters which represent the line ending on this platform.
API Tags:
Redefined in descendants as:
array glob(
mixed
$pattern, [mixed
$flags = null]
)
|
|
The glob() function searches for all the pathnames matching pattern according to the rules used by the libc glob() function, which is similar to the rules used by common shells. No tilde expansion or parameter substitution is done.
API Tags:
Return: | containing the matched files/directories or FALSE on error. |
true isLegalPathComponent(
string
$component, [boolean
$forDirectory = false]
)
|
|
Return true if the path component specified is composed of legal characters.
Parameters:
string |
$component: |
the path component (must not contain path separators) |
boolean |
$forDirectory: |
(optional) Whether the path component is for a directory. Defaults to false. Periods are allowed anywhere in directories. |
API Tags:
true isRestrictedByOpenBaseDir(
$path
)
|
|
Return true if the path provided is not allowed by the current open_basedir configuration.
Parameters:
API Tags:
Return: | if the path is restricted |
Redefined in descendants as:
boolean isSymlinkSupported(
)
|
|
Return a boolean specifying whether or not this platform can perform a symbolic link (symlink) command.
API Tags:
Return: | true if the platform supports symlinks |
Redefined in descendants as:
boolean is_dir(
string
$filename
)
|
|
Is the given path a directory?
Parameters:
string |
$filename: |
a filesystem path |
API Tags:
Return: | true if the path is a directory, false otherwise |
Redefined in descendants as:
boolean is_executable(
string
$filename
)
|
|
Is the given path an executable file?
Parameters:
string |
$filename: |
a filesystem path |
API Tags:
Return: | true if the path is an executable file, false otherwise |
Redefined in descendants as:
boolean is_file(
string
$filename
)
|
|
Is the given path a normal file?
Parameters:
string |
$filename: |
a filesystem path |
API Tags:
Return: | true if the path is a file, false otherwise |
Redefined in descendants as:
boolean is_link(
string
$filename
)
|
|
Is the given path a symbolic link?
Parameters:
string |
$filename: |
a filesystem path |
API Tags:
Return: | true if the file is a link, false otherwise |
boolean is_readable(
string
$filename
)
|
|
Is the given path a readable file?
Parameters:
string |
$filename: |
a filesystem path |
API Tags:
Return: | true if the path is readable, false otherwise |
Redefined in descendants as:
boolean is_uploaded_file(
string
$filename
)
|
|
Is the given path an uploaded file?
Parameters:
string |
$filename: |
a filesystem path |
API Tags:
Return: | true if the path is an uploaded file, false otherwise |
Redefined in descendants as:
boolean is_writeable(
string
$filename
)
|
|
Is the given path a writeable file?
Parameters:
string |
$filename: |
a filesystem path |
API Tags:
Return: | true if the path is writeable, false otherwise |
Redefined in descendants as:
string legalizePathComponent(
string
$component, [boolean
$forDirectory = false]
)
|
|
Remove any illegal characters from the path component.
Parameters:
string |
$component: |
the path component (must not contain path separators) |
boolean |
$forDirectory: |
(optional) Whether the path component is for a directory. Defaults to false. Periods are allowed anywhere in directories. |
API Tags:
Return: | the legalized path component |
boolean mail(
string
$to, string
$subject, string
$body, [string
$headers = null]
)
|
|
mail -- Send an email. Lines in the headers and body should be terminated with \r\n in accordance with RFC2821.
Parameters:
string |
$to: |
to address(es) (comma separated) |
string |
$subject: |
|
string |
$body: |
|
string |
$headers: |
(optional) additional headers (\r\n separated) |
API Tags:
Redefined in descendants as:
boolean mkdir(
string
$path, [string
$stringPerms = null]
)
|
|
Create a new directory.
Parameters:
string |
$path: |
a filesystem path |
string |
$stringPerms: |
permissions of the newly created directory |
API Tags:
Return: | true on success, false on failure |
string move_uploaded_file(
$filename, [
$newFilename = null]
)
|
|
Move an uploaded file to a new location and return the new location. If the second filename is not provided, a new file is created in the Gallery temporary directory.
Parameters:
API Tags:
Return: | the new file name, if the move was successful |
resource opendir(
string
$path
)
|
|
Open a file or URL.
Parameters:
string |
$path: |
a file path |
API Tags:
Return: | a directory descriptor |
Redefined in descendants as:
void readdir(
resource
$resource
)
|
|
Return the next file resource from a directory.
Parameters:
resource |
$resource: |
a directory resource |
Redefined in descendants as:
int readfile(
string
$filename, [int
$use_include_path = false]
)
|
|
Output a file.
Parameters:
string |
$filename: |
a file path or URL |
int |
$use_include_path: |
if this is set to 1, search the include path also |
API Tags:
Return: | the number of bytes read from the file |
Expand all symbolic links and resolve references to '/./', '/../' and extra '/' characters in
the input path and return the canonicalized absolute pathname. The resulting path will have no symbolic link, '/./' or '/../' components. [cribbed from http://php.net/realpath]
Parameters:
API Tags:
Return: | on failure, eg. if the file does not exists |
Redefined in descendants as:
boolean recursiveChmod(
string
$path, [int
$dirMode = null], [int
$fileMode = null]
)
|
|
Recursively set filesystem permissions. Modes default to system preferences for file/dir permissions.
Parameters:
string |
$path: |
path to directory |
int |
$dirMode: |
(optional) mode for dirs or -1 to skip chmod of dirs |
int |
$fileMode: |
(optional) mode for files or -1 to skip chmod of files |
API Tags:
boolean recursiveFixDirPermissions(
string
$path
)
|
|
Fixes the directory permissions (as eg. unzip creates them with file permissions because of the umask).
Parameters:
string |
$path: |
$path the directory which should be fixed |
API Tags:
Return: | true if all went well, false if there was an error. |
Deprecated: | -- TODO: remove at the next major version bump of core API |
boolean recursiveRmdir(
string
$dirname
)
|
|
Delete a directory, and all its contents.
Parameters:
string |
$dirname: |
directory name |
API Tags:
Return: | true on success, false on failure |
Redefined in descendants as:
boolean rename(
string
$oldname, string
$newname
)
|
|
Rename a file/dir.
As a side bonus, create a backup of the original file.
Parameters:
string |
$oldname: |
original file/dir name |
string |
$newname: |
new file/dir name |
API Tags:
Return: | true on success, false on failure |
Redefined in descendants as:
Clear any cached saved state in this platform.
boolean rmdir(
string
$filename
)
|
|
Delete a directory.
Parameters:
string |
$filename: |
directory name |
API Tags:
Return: | true on success, false on failure |
array splitPath(
string
$path
)
|
|
Split path into component elements. Include root path for absolute paths.
eg. /tmp -> array('/', 'tmp') rela/tive/path -> array('rela', 'tive', 'path') C:\Test\File.txt -> array('C:\', 'Test', 'File.txt')
Parameters:
API Tags:
Return: | (path elements) first item is "root" if path is absolute |
Redefined in descendants as:
array stat(
string
$filename
)
|
|
Get information about a file.
Parameters:
string |
$filename: |
file/dir name |
API Tags:
Return: | the statistics of the file |
string strftime(
string
$format, [int
$timestamp = null]
)
|
|
Format a local time/date according to locale settings. Converts any text output from strftime tokens to UTF-8.
Parameters:
string |
$format: |
|
int |
$timestamp: |
(optional) |
Redefined in descendants as:
boolean symlink(
string
$source, string
$dest
)
|
|
Symlink a file.
Parameters:
string |
$source: |
the source file |
string |
$dest: |
the destination file |
API Tags:
Return: | true if the copy succeeded, false otherwise |
Redefined in descendants as:
void tempnam(
string
$dir, string
$prefix
)
|
|
Create a file with a unique file name.
Parameters:
string |
$dir: |
target dir |
string |
$prefix: |
file prefix |
Redefined in descendants as:
void touch(
string
$file, [int
$time = null], [int
$atime = null]
)
|
|
touch -- Sets access and modification time of file.
Attempts to set the access and modification time of the file named by filename to the value given by time. If the option time is not given, uses the present time. This is equivalent to what utime (sometimes referred to as utimes) does. If the third option atime is present, the access time of the given filename is set to the value of atime. Note that the access time is always modified, regardless of the number of parameters.
Parameters:
string |
$file: |
the file path |
int |
$time: |
(optional) the modification time |
int |
$atime: |
(optional) the access time |
boolean unlink(
string
$filename
)
|
|
Delete a file.
Parameters:
API Tags:
Return: | true on success, false on failure |
Redefined in descendants as:
void _isRestrictedByOpenBaseDir(
$path,
$separator,
$caseSensitive
)
|
|
Check if path is allowed by open_basedir, given platform path separator & case sensitivity.
Parameters:
|
$path: |
|
|
$separator: |
|
|
$caseSensitive: |
|
API Tags:
void _loadPermissionPreferences(
)
|
|
Load preferences for file/dir permissions and calculate umask.
API Tags:
void _recursiveChmod(
$path,
$dirMode,
$fileMode
)
|
|
Helper for recursiveChmod.
Parameters:
|
$path: |
|
|
$dirMode: |
|
|
$fileMode: |
|
API Tags: