[ Index ] |
|
Code source de GeekLog 1.4.1 |
[Code source] [Imprimer] [Statistiques]
File/Directory manipulation PHP versions 4 and 5
Author: | Tomas V.V.Cox <cox@idecnet.com> |
Copyright: | 1997-2006 The PHP Group |
License: | http://www.php.net/license/3_0.txt PHP License 3.0 |
Version: | CVS: $Id: System.php,v 1.53.2.1 2006/06/16 13:55:16 pajoye Exp $ |
Poids: | 587 lignes (19 kb) |
Inclus ou requis: | 0 fois |
Référencé: | 0 fois |
Nécessite: | 2 fichiers system/pear/PEAR.php system/pear/Console/Getopt.php |
System:: (12 méthodes):
_parseArgs()
raiseError()
_dirToStruct()
_multipleToStruct()
rm()
mkDir()
cat()
mktemp()
_removeTmpFiles()
tmpdir()
which()
find()
_parseArgs($argv, $short_options, $long_options = null) X-Ref |
returns the commandline arguments of a function param: string $argv the commandline param: string $short_options the allowed option short-tags param: string $long_options the allowed option long-tags return: array the given options and there values |
raiseError($error) X-Ref |
Output errors with PHP trigger_error(). You can silence the errors with prefixing a "@" sign to the function call: @System::mkdir(..); param: mixed $error a PEAR error or a string with the error message return: bool false |
_dirToStruct($sPath, $maxinst, $aktinst = 0) X-Ref |
Creates a nested array representing the structure of a directory System::_dirToStruct('dir1', 0) => Array ( [dirs] => Array ( [0] => dir1 ) [files] => Array ( [0] => dir1/file2 [1] => dir1/file3 ) ) param: string $sPath Name of the directory param: integer $maxinst max. deep of the lookup param: integer $aktinst starting deep of the lookup return: array the structure of the dir |
_multipleToStruct($files) X-Ref |
Creates a nested array representing the structure of a directory and files param: array $files Array listing files and dirs return: array |
rm($args) X-Ref |
The rm command for removing files. Supports multiple files and dirs and also recursive deletes param: string $args the arguments for rm return: mixed PEAR_Error or true for success |
mkDir($args) X-Ref |
Make directories. The -p option will create parent directories param: string $args the name of the director(y|ies) to create return: bool True for success |
cat($args) X-Ref |
Concatenate files Usage: 1) $var = System::cat('sample.txt test.txt'); 2) System::cat('sample.txt test.txt > final.txt'); 3) System::cat('sample.txt test.txt >> final.txt'); Note: as the class use fopen, urls should work also (test that) param: string $args the arguments return: boolean true on success |
mktemp($args = null) X-Ref |
Creates temporary files or directories. This function will remove the created files when the scripts finish its execution. Usage: 1) $tempfile = System::mktemp("prefix"); 2) $tempdir = System::mktemp("-d prefix"); 3) $tempfile = System::mktemp(); 4) $tempfile = System::mktemp("-t /var/tmp prefix"); prefix -> The string that will be prepended to the temp name (defaults to "tmp"). -d -> A temporary dir will be created instead of a file. -t -> The target dir where the temporary (file|dir) will be created. If this param is missing by default the env vars TMP on Windows or TMPDIR in Unix will be used. If these vars are also missing c:\windows\temp or /tmp will be used. param: string $args The arguments return: mixed the full path of the created (file|dir) or false |
_removeTmpFiles() X-Ref |
Remove temporary files created my mkTemp. This function is executed at script shutdown time |
tmpdir() X-Ref |
Get the path of the temporal directory set in the system by looking in its environments variables. Note: php.ini-recommended removes the "E" from the variables_order setting, making unavaible the $_ENV array, that s why we do tests with _ENV return: string The temporal directory on the system |
which($program, $fallback = false) X-Ref |
The "which" command (show the full path of a command) author: Stig Bakken <ssb@php.net> param: string $program The command to search for param: mixed $fallback Value to return if $program is not found return: mixed A string with the full path or false if not found |
find($args) X-Ref |
The "find" command Usage: System::find($dir); System::find("$dir -type d"); System::find("$dir -type f"); System::find("$dir -name *.php"); System::find("$dir -name *.php -name *.htm*"); System::find("$dir -maxdepth 1"); Params implmented: $dir -> Start the search at this directory -type d -> return only directories -type f -> return only files -maxdepth <n> -> max depth of recursion -name <pattern> -> search pattern (bash style). Multiple -name param allowed param: mixed Either array or string with the command line return: array Array of found files |
Généré le : Wed Nov 21 12:27:40 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |