ILIAS
Release_4_4_x_branch Revision 61816
|
Static Public Member Functions | |
_parseArgs ($argv, $short_options, $long_options=null) | |
returns the commandline arguments of a function | |
raiseError ($error) | |
Output errors with PHP trigger_error(). | |
_dirToStruct ($sPath, $maxinst, $aktinst=0, $silent=false) | |
Creates a nested array representing the structure of a directory. | |
_multipleToStruct ($files) | |
Creates a nested array representing the structure of a directory and files. | |
rm ($args) | |
The rm command for removing files. | |
mkDir ($args) | |
Make directories. | |
& | cat ($args) |
Concatenate files. | |
mktemp ($args=null) | |
Creates temporary files or directories. | |
_removeTmpFiles () | |
Remove temporary files created my mkTemp. | |
tmpdir () | |
Get the path of the temporal directory set in the system by looking in its environments variables. | |
which ($program, $fallback=false) | |
The "which" command (show the full path of a command) | |
find ($args) | |
The "find" command. |
Definition at line 59 of file System.php.
|
static |
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 ) )
string | $sPath | Name of the directory |
integer | $maxinst | max. deep of the lookup |
integer | $aktinst | starting deep of the lookup |
bool | $silent | if true, do not emit errors. |
Definition at line 122 of file System.php.
References $file, $path, and raiseError().
Referenced by _multipleToStruct(), and find().
|
static |
Creates a nested array representing the structure of a directory and files.
array | $files | Array listing files and dirs |
Definition at line 165 of file System.php.
References $file, and _dirToStruct().
Referenced by rm().
|
static |
returns the commandline arguments of a function
string | $argv | the commandline |
string | $short_options | the allowed option short-tags |
string | $long_options | the allowed option long-tags |
Definition at line 71 of file System.php.
References Console_Getopt\getopt2().
Referenced by mkDir(), mktemp(), and rm().
|
static |
Remove temporary files created my mkTemp.
This function is executed at script shutdown time
private
Definition at line 435 of file System.php.
References $GLOBALS, and rm().
|
static |
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)
string | $args | the arguments |
Definition at line 308 of file System.php.
References $file, $ret, and raiseError().
|
static |
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
mixed | Either array or string with the command line |
Definition at line 559 of file System.php.
References $path, $ret, and _dirToStruct().
|
static |
Make directories.
The -p option will create parent directories
string | $args | the name of the director(y|ies) to create |
Definition at line 237 of file System.php.
References $ret, _parseArgs(), PEAR\isError(), and raiseError().
Referenced by mktemp().
|
static |
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: or /tmp will be used.
string | $args | The arguments |
Definition at line 382 of file System.php.
References $GLOBALS, _parseArgs(), PEAR\isError(), mkDir(), raiseError(), PEAR\registerShutdownFunc(), and tmpdir().
|
static |
Output errors with PHP trigger_error().
You can silence the errors with prefixing a "@" sign to the function call: ::mkdir(..);
mixed | $error | a PEAR error or a string with the error message |
Definition at line 88 of file System.php.
References PEAR\isError().
Referenced by _dirToStruct(), cat(), mkDir(), mktemp(), and rm().
|
static |
The rm command for removing files.
Supports multiple files and dirs and also recursive deletes
string | $args | the arguments for rm |
Definition at line 191 of file System.php.
References $file, $ret, _multipleToStruct(), _parseArgs(), PEAR\isError(), and raiseError().
Referenced by _removeTmpFiles().
|
static |
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
Definition at line 454 of file System.php.
Referenced by mktemp(), OLE_PPS_File\OLE_PPS_File(), and OLE_PPS_Root\OLE_PPS_Root().
|
static |
The "which" command (show the full path of a command)
string | $program | The command to search for |
mixed | $fallback | Value to return if $program is not found |
Definition at line 487 of file System.php.
References $fallback, $file, and $path.