Open Journal Systems
3.3.0
|
Static Public Member Functions | |
static | _parseArgs ($argv, $short_options, $long_options=null) |
static | _removeTmpFiles () |
static & | cat ($args) |
static | find ($args) |
static | mkDir ($args) |
static | mktemp ($args=null) |
static | rm ($args) |
static | tmpdir () |
static | which ($program, $fallback=false) |
Static Protected Member Functions | |
static | _dirToStruct ($sPath, $maxinst, $aktinst=0, $silent=false) |
static | _multipleToStruct ($files) |
static | raiseError ($error) |
Definition at line 58 of file System.php.
|
staticprotected |
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 141 of file System.php.
References raiseError().
Referenced by _multipleToStruct(), and find().
|
staticprotected |
Creates a nested array representing the structure of a directory and files
array | $files | Array listing files and dirs |
Definition at line 184 of file System.php.
References _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 68 of file System.php.
References Console_Getopt\getopt2().
|
static |
Remove temporary files created my mkTemp. This function is executed at script shutdown time
Definition at line 445 of file System.php.
|
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
string | $args | the arguments |
Definition at line 323 of file System.php.
References 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 implemented: $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 566 of file System.php.
References _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 254 of file System.php.
References _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:\windows\temp or /tmp will be used.
string | $args | The arguments |
Definition at line 395 of file System.php.
References $GLOBALS, _parseArgs(), PEAR\isError(), mkDir(), raiseError(), PEAR\registerShutdownFunc(), and tmpdir().
Referenced by OS_Guess\_detectGlibcVersion().
|
staticprotected |
Output errors with PHP trigger_error(). You can silence the errors with prefixing a "@" sign to the function call: @System::mkdir(..);
mixed | $error | a PEAR error or a string with the error message |
Definition at line 109 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 |
@access public
Definition at line 210 of file System.php.
References _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 463 of file System.php.
Referenced by mktemp().
|
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 495 of file System.php.