update

update

udpate

udpate
This commit is contained in:
hjonathan
2017-08-23 13:38:43 -04:00
parent 6d2b662cee
commit 6b9e38bebf
14 changed files with 71 additions and 81 deletions

View File

@@ -1,7 +1,6 @@
<?php
require_once "HTTP/WebDAV/Server.php";
require_once "System.php";
/**
* Filesystem access using WebDAV
@@ -479,7 +478,7 @@
if (is_dir($path)) {
$query = "DELETE FROM properties WHERE path LIKE '".$this->_slashify($options["path"])."%'";
mysql_query($query);
System::rm("-rf $path");
PearSystem::rm("-rf $path");
} else {
unlink ($path);
}
@@ -577,7 +576,7 @@
mysql_query($query);
} else {
if (is_dir($source)) {
$files = System::find($source);
$files = PearSystem::find($source);
$files = array_reverse($files);
} else {
$files = array($source);

View File

@@ -159,8 +159,8 @@ class OS_Guess
{
// Use glibc's <features.h> header file to
// get major and minor version number:
include_once "System.php";
$tmpfile = System::mktemp("glibctest");
include_once "PearSystem.php";
$tmpfile = PearSystem::mktemp("glibctest");
$fp = fopen($tmpfile, "w");
fwrite($fp, "#include <features.h>\n__GLIBC__ __GLIBC_MINOR__\n");
fclose($fp);

View File

@@ -245,9 +245,9 @@ class PEAR_Builder extends PEAR_Common
$build_dir = "$build_basedir/$info[package]-$info[version]";
$this->log(1, "building in $build_dir");
if (is_dir($build_dir)) {
System::rm("-rf $build_dir");
PearSystem::rm("-rf $build_dir");
}
if (!System::mkDir("-p $build_dir")) {
if (!PearSystem::mkDir("-p $build_dir")) {
return $this->raiseError("could not create build dir: $build_dir");
}
$this->addTempFile($build_dir);

View File

@@ -531,9 +531,9 @@ Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm
return $this->raiseError($info);
}
include_once "Archive/Tar.php";
include_once "System.php";
include_once "PearSystem.php";
$tar = new Archive_Tar($params[0]);
$tmpdir = System::mktemp('-d pearsign');
$tmpdir = PearSystem::mktemp('-d pearsign');
if (!$tar->extractList('package.xml package.sig', $tmpdir)) {
return $this->raiseError("failed to extract tar file");
}
@@ -569,10 +569,10 @@ Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm
}
include_once "Archive/Tar.php";
include_once "PEAR/Installer.php";
include_once "System.php";
include_once "PearSystem.php";
$tar = new Archive_Tar($params[0]);
$tmpdir = System::mktemp('-d pear2rpm');
$instroot = System::mktemp('-d pear2rpm');
$tmpdir = PearSystem::mktemp('-d pear2rpm');
$instroot = PearSystem::mktemp('-d pear2rpm');
$tmp = $this->config->get('verbose');
$this->config->set('verbose', 0);
$installer = new PEAR_Installer($this->ui);
@@ -592,10 +592,7 @@ Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm
if (!file_exists("$tmpdir/package.xml")) {
return $this->raiseError("no package.xml found in $params[0]");
}
// System::mkdir("-p $instroot$info[rpm_xml_dir]");
// if (!@copy("$tmpdir/package.xml", "$instroot$info[rpm_xml_dir]/$info[package].xml")) {
// return $this->raiseError("could not copy package.xml file: $php_errormsg");
// }
if (isset($options['spec-template'])) {
$spec_template = $options['spec-template'];
} else {

View File

@@ -21,7 +21,6 @@
require_once 'PEAR.php';
require_once 'Archive/Tar.php';
require_once 'System.php';
require_once 'PEAR/Config.php';
// {{{ constants and globals
@@ -156,7 +155,7 @@ class PEAR_Common extends PEAR
$tempfiles =& $GLOBALS['_PEAR_Common_tempfiles'];
while ($file = array_shift($tempfiles)) {
if (@is_dir($file)) {
System::rm("-rf $file");
PearSystem::rm("-rf $file");
} elseif (file_exists($file)) {
unlink($file);
}
@@ -186,7 +185,7 @@ class PEAR_Common extends PEAR
// {{{ mkDirHier()
/**
* Wrapper to System::mkDir(), creates a directory as well as
* Wrapper to PearSystem::mkDir(), creates a directory as well as
* any necessary parent directories.
*
* @param string $dir directory name
@@ -198,7 +197,7 @@ class PEAR_Common extends PEAR
function mkDirHier($dir)
{
$this->log(2, "+ create dir $dir");
return System::mkDir("-p $dir");
return PearSystem::mkDir("-p $dir");
}
// }}}
@@ -246,7 +245,7 @@ class PEAR_Common extends PEAR
} else {
$topt = '';
}
if (!$tmpdir = System::mktemp($topt . '-d pear')) {
if (!$tmpdir = PearSystem::mktemp($topt . '-d pear')) {
return false;
}
$this->addTempFile($tmpdir);
@@ -686,7 +685,7 @@ class PEAR_Common extends PEAR
break;
}
}
$tmpdir = System::mkTemp('-d pear');
$tmpdir = PearSystem::mkTemp('-d pear');
$this->addTempFile($tmpdir);
if (!$xml || !$tar->extractList($xml, $tmpdir)) {
return $this->raiseError('could not extract the package.xml file');

View File

@@ -19,7 +19,6 @@
// $Id: Config.php,v 1.43 2003/03/18 12:06:06 ssb Exp $
require_once 'PEAR.php';
require_once 'System.php';
/**
* Last created PEAR_Config instance.
@@ -112,7 +111,7 @@ if (getenv('PHP_PEAR_CACHE_DIR')) {
define('PEAR_CONFIG_DEFAULT_CACHE_DIR', getenv('PHP_PEAR_CACHE_DIR'));
} else {
define('PEAR_CONFIG_DEFAULT_CACHE_DIR',
System::tmpdir() . DIRECTORY_SEPARATOR . 'pear' .
PearSystem::tmpdir() . DIRECTORY_SEPARATOR . 'pear' .
DIRECTORY_SEPARATOR . 'cache');
}
@@ -164,7 +163,7 @@ if (getenv('PHP_PEAR_SIG_BIN')) {
define('PEAR_CONFIG_DEFAULT_SIG_BIN', getenv('PHP_PEAR_SIG_BIN'));
} else {
define('PEAR_CONFIG_DEFAULT_SIG_BIN',
System::which(
PearSystem::which(
'gpg', OS_WINDOWS ? 'c:\gnupg\gpg.exe' : '/usr/local/bin/gpg'));
}
@@ -564,7 +563,7 @@ class PEAR_Config extends PEAR
}
$data = $this->configuration[$layer];
$this->_encodeOutput($data);
if (!@System::mkDir("-p " . dirname($file))) {
if (!@PearSystem::mkDir("-p " . dirname($file))) {
return $this->raiseError("could not create directory: " . dirname($file));
}
if (@is_file($file) && !@is_writeable($file)) {

View File

@@ -22,7 +22,6 @@
require_once 'PEAR/Common.php';
require_once 'PEAR/Registry.php';
require_once 'PEAR/Dependency.php';
require_once 'System.php';
define('PEAR_INSTALLER_OK', 1);
define('PEAR_INSTALLER_FAILED', 0);
@@ -534,7 +533,7 @@ class PEAR_Installer extends PEAR_Common
if ($need_download) {
$downloaddir = $this->config->get('download_dir');
if (empty($downloaddir)) {
if (PEAR::isError($downloaddir = System::mktemp('-d'))) {
if (PEAR::isError($downloaddir = PearSystem::mktemp('-d'))) {
return $downloaddir;
}
$this->log(2, '+ tmp dir created at ' . $downloaddir);
@@ -559,7 +558,7 @@ class PEAR_Installer extends PEAR_Common
chdir($oldcwd);
}
if (PEAR::isError($tmpdir = System::mktemp('-d'))) {
if (PEAR::isError($tmpdir = PearSystem::mktemp('-d'))) {
return $tmpdir;
}
$this->log(2, '+ tmp dir created at ' . $tmpdir);

View File

@@ -20,7 +20,6 @@
// $Id: Packager.php,v 1.46 2003/03/18 12:06:06 ssb Exp $
require_once 'PEAR/Common.php';
require_once 'System.php';
/**
* Administration class used to make a PEAR release tarball.
@@ -116,7 +115,7 @@ class PEAR_Packager extends PEAR_Common
chdir($oldcwd);
return $this->raiseError($new_xml);
}
if (!($tmpdir = System::mktemp('-t '.getcwd().' -d'))) {
if (!($tmpdir = PearSystem::mktemp('-t '.getcwd().' -d'))) {
chdir($oldcwd);
return $this->raiseError("PEAR_Packager: mktemp failed");
}

View File

@@ -26,7 +26,6 @@ TODO:
- Add application level lock (avoid change the registry from the cmdline
while using the GTK interface, for ex.)
*/
require_once "System.php";
require_once "PEAR.php";
define('PEAR_REGISTRY_ERROR_LOCK', -2);

View File

@@ -56,7 +56,7 @@ class PEAR_Remote extends PEAR
$id = $this->encryptOld(serialize($args));
$cachedir = $this->config->get('cache_dir');
if (!file_exists($cachedir)) {
System::mkdir('-p '.$cachedir);
PearSystem::mkdir('-p '.$cachedir);
}
$filename = $cachedir . DIRECTORY_SEPARATOR . 'xmlrpc_cache_' . $id;
if (!file_exists($filename)) {
@@ -86,7 +86,7 @@ class PEAR_Remote extends PEAR
$id = $this->encryptOld(serialize($args));
$cachedir = $this->config->get('cache_dir');
if (!file_exists($cachedir)) {
System::mkdir('-p '.$cachedir);
PearSystem::mkdir('-p '.$cachedir);
}
$filename = $cachedir.'/xmlrpc_cache_'.$id;

View File

@@ -37,14 +37,14 @@ $GLOBALS['_System_temp_files'] = array();
* http://pear.php.net/manual/
*
* Example usage:
* if (!@System::rm('-r file1 dir1')) {
* if (!@PearSystem::rm('-r file1 dir1')) {
* print "could not delete file1 or dir1";
* }
*
* In case you need to to pass file names with spaces,
* pass the params as an array:
*
* System::rm(array('-r', $file1, $dir1));
* PearSystem::rm(array('-r', $file1, $dir1));
*
* @package System
* @author Tomas V.V.Cox <cox@idecnet.com>
@@ -52,7 +52,7 @@ $GLOBALS['_System_temp_files'] = array();
* @access public
* @see http://pear.php.net/manual/
*/
class System
class PearSystem
{
/**
* returns the commandline arguments of a function
@@ -73,7 +73,7 @@ class System
/**
* Output errors with PHP trigger_error(). You can silence the errors
* with prefixing a "@" sign to the function call: @System::mkdir(..);
* with prefixing a "@" sign to the function call: @PearSystem::mkdir(..);
*
* @param mixed $error a PEAR error or a string with the error message
* @return bool false
@@ -91,7 +91,7 @@ class System
/**
* Creates a nested array representing the structure of a directory
*
* System::_dirToStruct('dir1', 0) =>
* PearSystem::_dirToStruct('dir1', 0) =>
* Array
* (
* [dirs] => Array
@@ -116,7 +116,7 @@ class System
{
$struct = array('dirs' => array(), 'files' => array());
if (($dir = @opendir($sPath)) === false) {
System::raiseError("Could not open dir $sPath");
PearSystem::raiseError("Could not open dir $sPath");
return $struct; // XXX could not open error
}
$struct['dirs'][] = $sPath; // XXX don't add if '.' or '..' ?
@@ -132,7 +132,7 @@ class System
foreach($list as $val) {
$path = $sPath . DIRECTORY_SEPARATOR . $val;
if (is_dir($path)) {
$tmp = System::_dirToStruct($path, $maxinst, $aktinst+1);
$tmp = PearSystem::_dirToStruct($path, $maxinst, $aktinst+1);
$struct = array_merge_recursive($tmp, $struct);
} else {
$struct['files'][] = $path;
@@ -147,7 +147,7 @@ class System
*
* @param array $files Array listing files and dirs
* @return array
* @see System::_dirToStruct()
* @see PearSystem::_dirToStruct()
*/
function _multipleToStruct($files)
{
@@ -155,7 +155,7 @@ class System
settype($files, 'array');
foreach ($files as $file) {
if (is_dir($file)) {
$tmp = System::_dirToStruct($file, 0);
$tmp = PearSystem::_dirToStruct($file, 0);
$struct = array_merge_recursive($tmp, $struct);
} else {
$struct['files'][] = $file;
@@ -174,9 +174,9 @@ class System
*/
function rm($args)
{
$opts = System::_parseArgs($args, 'rf'); // "f" do nothing but like it :-)
$opts = PearSystem::_parseArgs($args, 'rf'); // "f" do nothing but like it :-)
if (PEAR::isError($opts)) {
return System::raiseError($opts);
return PearSystem::raiseError($opts);
}
foreach($opts[0] as $opt) {
if ($opt[0] == 'r') {
@@ -185,7 +185,7 @@ class System
}
$ret = true;
if (isset($do_recursive)) {
$struct = System::_multipleToStruct($opts[1]);
$struct = PearSystem::_multipleToStruct($opts[1]);
foreach($struct['files'] as $file) {
if (!@unlink($file)) {
$ret = false;
@@ -209,7 +209,7 @@ class System
/**
* Make directories. Note that we use call_user_func('mkdir') to avoid
* a problem with ZE2 calling System::mkDir instead of the native PHP func.
* a problem with ZE2 calling PearSystem::mkDir instead of the native PHP func.
*
* @param string $args the name of the director(y|ies) to create
* @return bool True for success
@@ -217,9 +217,9 @@ class System
*/
function mkDir($args)
{
$opts = System::_parseArgs($args, 'pm:');
$opts = PearSystem::_parseArgs($args, 'pm:');
if (PEAR::isError($opts)) {
return System::raiseError($opts);
return PearSystem::raiseError($opts);
}
$mode = 0777; // default mode
foreach($opts[0] as $opt) {
@@ -265,9 +265,9 @@ class System
* 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');
* 1) $var = PearSystem::cat('sample.txt test.txt');
* 2) PearSystem::cat('sample.txt test.txt > final.txt');
* 3) PearSystem::cat('sample.txt test.txt >> final.txt');
*
* Note: as the class use fopen, urls should work also (test that)
*
@@ -297,14 +297,14 @@ class System
}
if (isset($mode)) {
if (!$outputfd = fopen($outputfile, $mode)) {
$err = System::raiseError("Could not open $outputfile");
$err = PearSystem::raiseError("Could not open $outputfile");
return $err;
}
$ret = true;
}
foreach ($files as $file) {
if (!$fd = fopen($file, 'r')) {
System::raiseError("Could not open $file");
PearSystem::raiseError("Could not open $file");
continue;
}
while ($cont = fread($fd, 2048)) {
@@ -327,10 +327,10 @@ class System
* 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");
* 1) $tempfile = PearSystem::mktemp("prefix");
* 2) $tempdir = PearSystem::mktemp("-d prefix");
* 3) $tempfile = PearSystem::mktemp();
* 4) $tempfile = PearSystem::mktemp("-t /var/tmp prefix");
*
* prefix -> The string that will be prepended to the temp name
* (defaults to "tmp").
@@ -342,15 +342,15 @@ class System
*
* @param string $args The arguments
* @return mixed the full path of the created (file|dir) or false
* @see System::tmpdir()
* @see PearSystem::tmpdir()
* @access public
*/
function mktemp($args = null)
{
static $first_time = true;
$opts = System::_parseArgs($args, 't:d');
$opts = PearSystem::_parseArgs($args, 't:d');
if (PEAR::isError($opts)) {
return System::raiseError($opts);
return PearSystem::raiseError($opts);
}
foreach($opts[0] as $opt) {
if($opt[0] == 'd') {
@@ -361,16 +361,16 @@ class System
}
$prefix = (isset($opts[1][0])) ? $opts[1][0] : 'tmp';
if (!isset($tmpdir)) {
$tmpdir = System::tmpdir();
$tmpdir = PearSystem::tmpdir();
}
if (!System::mkDir("-p $tmpdir")) {
if (!PearSystem::mkDir("-p $tmpdir")) {
return false;
}
$tmp = tempnam($tmpdir, $prefix);
if (isset($tmp_is_dir)) {
unlink($tmp); // be careful possible race condition here
if (!call_user_func('mkdir', $tmp, 0700)) {
return System::raiseError("Unable to create temporary directory $tmpdir");
return PearSystem::raiseError("Unable to create temporary directory $tmpdir");
}
}
$GLOBALS['_System_temp_files'][] = $tmp;
@@ -392,7 +392,7 @@ class System
if (count($GLOBALS['_System_temp_files'])) {
$delete = $GLOBALS['_System_temp_files'];
array_unshift($delete, '-r');
System::rm($delete);
PearSystem::rm($delete);
}
}
@@ -465,12 +465,12 @@ class System
*
* 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");
* PearSystem::find($dir);
* PearSystem::find("$dir -type d");
* PearSystem::find("$dir -type f");
* PearSystem::find("$dir -name *.php");
* PearSystem::find("$dir -name *.php -name *.htm*");
* PearSystem::find("$dir -maxdepth 1");
*
* Params implmented:
* $dir -> Start the search at this directory
@@ -516,7 +516,7 @@ class System
break;
}
}
$path = System::_dirToStruct($dir, $depth);
$path = PearSystem::_dirToStruct($dir, $depth);
if ($do_files && $do_dirs) {
$files = array_merge($path['files'], $path['dirs']);
} elseif ($do_dirs) {

View File

@@ -138,7 +138,7 @@ PEAR INSTALLER:
* PEAR_Config class uses getenv() rather than $_ENV
to read environment variables.
* System::which() Windows fix, now looks for
* PearSystem::which() Windows fix, now looks for
exe/bat/cmd/com suffixes rather than just exe
* Added "pear cvsdiff" command
@@ -237,7 +237,7 @@ Bugfixes, Installer:
New Features, PEAR Library:
* added PEAR::loadExtension($ext)
* added PEAR::delExpect()
* System::mkTemp() now cleans up at shutdown
* PearSystem::mkTemp() now cleans up at shutdown
* defined PEAR_ZE2 constant (boolean)
* added PEAR::throwError() with a simpler API
than raiseError()

View File

@@ -417,7 +417,7 @@ class PropelSQLExec extends TaskPhing {
$this->conn->rollback();
} catch (SQLException $ex) {
// do nothing.
System::println("Rollback failed.");
PearSystem::println("Rollback failed.");
}
}
if ($this->statement) $this->statement->close();
@@ -428,7 +428,7 @@ class PropelSQLExec extends TaskPhing {
$this->conn->rollback();
} catch (SQLException $ex) {
// do nothing.
System::println("Rollback failed");
PearSystem::println("Rollback failed");
}
}
if ($this->statement) $this->statement->close();
@@ -620,12 +620,12 @@ class PropelSQLExec extends TaskPhing {
$out->newLine();
}
System::println($line);
PearSystem::println($line);
$line = "";
} // while rs->next()
}
} while ($this->statement->getMoreResults());
System::println();
PearSystem::println();
if ($out !== null) $out->newLine();
}

View File

@@ -9,7 +9,6 @@
use ProcessMaker\Core\System;
require_once "HTTP/WebDAV/Server.php";
require_once "System.php";
/**
* ProcessMaker Filesystem access using WebDAV
@@ -745,7 +744,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
if (is_dir($path)) {
$query = "DELETE FROM properties WHERE path LIKE '" . $this->_slashify($options["path"]) . "%'";
mysql_query($query);
System::rm("-rf $path");
PearSystem::rm("-rf $path");
} else {
unlink($path);
}
@@ -848,7 +847,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
mysql_query($query);
} else {
if (is_dir($source)) {
$files = System::find($source);
$files = PearSystem::find($source);
$files = array_reverse($files);
} else {
$files = array($source