diff --git a/Panda.php b/Panda.php index fb70e08..69ac4fe 100644 --- a/Panda.php +++ b/Panda.php @@ -60,7 +60,7 @@ class Panda /** * Version */ - const VERSION = '0.3.43'; + const VERSION = '0.3.44'; /** * Package name - App diff --git a/composer.json b/composer.json index 76d25ce..d9523ad 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "repositories": [ { "type": "pear", - "url": "http://pear.php.net" + "url": "https://pear.php.net" } ], "require": { @@ -24,8 +24,5 @@ "autoload": { "classmap": ["Panda"], "files": ["./Panda.php"] - }, - "config":{ - "secure-http" : false } } diff --git a/data/package/PEAR/PackageFile.php b/data/package/PEAR/PackageFile.php deleted file mode 100644 index 7ae3362..0000000 --- a/data/package/PEAR/PackageFile.php +++ /dev/null @@ -1,492 +0,0 @@ - - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: PackageFile.php 313024 2011-07-06 19:51:24Z dufuz $ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 1.4.0a1 - */ - -/** - * needed for PEAR_VALIDATE_* constants - */ -require_once 'PEAR/Validate.php'; -/** - * Error code if the package.xml tag does not contain a valid version - */ -define('PEAR_PACKAGEFILE_ERROR_NO_PACKAGEVERSION', 1); -/** - * Error code if the package.xml tag version is not supported (version 1.0 and 1.1 are the only supported versions, - * currently - */ -define('PEAR_PACKAGEFILE_ERROR_INVALID_PACKAGEVERSION', 2); -/** - * Abstraction for the package.xml package description file - * - * @category pear - * @package PEAR - * @author Greg Beaver - * @copyright 1997-2009 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 - * @link http://pear.php.net/package/PEAR - * @since Class available since Release 1.4.0a1 - */ -class PEAR_PackageFile -{ - /** - * @var PEAR_Config - */ - var $_config; - var $_debug; - - var $_logger = false; - /** - * @var boolean - */ - var $_rawReturn = false; - - /** - * helper for extracting Archive_Tar errors - * @var array - * @access private - */ - var $_extractErrors = array(); - - /** - * - * @param PEAR_Config $config - * @param ? $debug - * @param string @tmpdir Optional temporary directory for uncompressing - * files - */ - function PEAR_PackageFile(&$config, $debug = false) - { - $this->_config = $config; - $this->_debug = $debug; - } - - /** - * Turn off validation - return a parsed package.xml without checking it - * - * This is used by the package-validate command - */ - function rawReturn() - { - $this->_rawReturn = true; - } - - function setLogger(&$l) - { - $this->_logger = &$l; - } - - /** - * Create a PEAR_PackageFile_Parser_v* of a given version. - * @param int $version - * @return PEAR_PackageFile_Parser_v1|PEAR_PackageFile_Parser_v1 - */ - function &parserFactory($version) - { - if (!in_array($version{0}, array('1', '2'))) { - $a = false; - return $a; - } - - include_once 'PEAR/PackageFile/Parser/v' . $version{0} . '.php'; - $version = $version{0}; - $class = "PEAR_PackageFile_Parser_v$version"; - $a = new $class; - return $a; - } - - /** - * For simpler unit-testing - * @return string - */ - function getClassPrefix() - { - return 'PEAR_PackageFile_v'; - } - - /** - * Create a PEAR_PackageFile_v* of a given version. - * @param int $version - * @return PEAR_PackageFile_v1|PEAR_PackageFile_v1 - */ - function &factory($version) - { - if (!in_array($version{0}, array('1', '2'))) { - $a = false; - return $a; - } - - include_once 'PEAR/PackageFile/v' . $version{0} . '.php'; - $version = $version{0}; - $class = $this->getClassPrefix() . $version; - $a = new $class; - return $a; - } - - /** - * Create a PEAR_PackageFile_v* from its toArray() method - * - * WARNING: no validation is performed, the array is assumed to be valid, - * always parse from xml if you want validation. - * @param array $arr - * @return PEAR_PackageFileManager_v1|PEAR_PackageFileManager_v2 - * @uses factory() to construct the returned object. - */ - function &fromArray($arr) - { - if (isset($arr['xsdversion'])) { - $obj = &$this->factory($arr['xsdversion']); - if ($this->_logger) { - $obj->setLogger($this->_logger); - } - - $obj->setConfig($this->_config); - $obj->fromArray($arr); - return $obj; - } - - if (isset($arr['package']['attribs']['version'])) { - $obj = &$this->factory($arr['package']['attribs']['version']); - } else { - $obj = &$this->factory('1.0'); - } - - if ($this->_logger) { - $obj->setLogger($this->_logger); - } - - $obj->setConfig($this->_config); - $obj->fromArray($arr); - return $obj; - } - - /** - * Create a PEAR_PackageFile_v* from an XML string. - * @access public - * @param string $data contents of package.xml file - * @param int $state package state (one of PEAR_VALIDATE_* constants) - * @param string $file full path to the package.xml file (and the files - * it references) - * @param string $archive optional name of the archive that the XML was - * extracted from, if any - * @return PEAR_PackageFile_v1|PEAR_PackageFile_v2 - * @uses parserFactory() to construct a parser to load the package. - */ - function &fromXmlString($data, $state, $file, $archive = false) - { - if (preg_match('/]+version=[\'"]([0-9]+\.[0-9]+)[\'"]/', $data, $packageversion)) { - if (!in_array($packageversion[1], array('1.0', '2.0', '2.1'))) { - return PEAR::raiseError('package.xml version "' . $packageversion[1] . - '" is not supported, only 1.0, 2.0, and 2.1 are supported.'); - } - - $object = &$this->parserFactory($packageversion[1]); - if ($this->_logger) { - $object->setLogger($this->_logger); - } - - $object->setConfig($this->_config); - $pf = $object->parse($data, $file, $archive); - if (PEAR::isError($pf)) { - return $pf; - } - - if ($this->_rawReturn) { - return $pf; - } - - if (!$pf->validate($state)) {; - if ($this->_config->get('verbose') > 0 - && $this->_logger && $pf->getValidationWarnings(false) - ) { - foreach ($pf->getValidationWarnings(false) as $warning) { - $this->_logger->log(0, 'ERROR: ' . $warning['message']); - } - } - - $a = PEAR::raiseError('Parsing of package.xml from file "' . $file . '" failed', - 2, null, null, $pf->getValidationWarnings()); - return $a; - } - - if ($this->_logger && $pf->getValidationWarnings(false)) { - foreach ($pf->getValidationWarnings() as $warning) { - $this->_logger->log(0, 'WARNING: ' . $warning['message']); - } - } - - if (method_exists($pf, 'flattenFilelist')) { - $pf->flattenFilelist(); // for v2 - } - - return $pf; - } elseif (preg_match('/]+version=[\'"]([^"\']+)[\'"]/', $data, $packageversion)) { - $a = PEAR::raiseError('package.xml file "' . $file . - '" has unsupported package.xml version "' . $packageversion[1] . '"'); - return $a; - } else { - if (!class_exists('PEAR_ErrorStack')) { - require_once 'PEAR/ErrorStack.php'; - } - - PEAR_ErrorStack::staticPush('PEAR_PackageFile', - PEAR_PACKAGEFILE_ERROR_NO_PACKAGEVERSION, - 'warning', array('xml' => $data), 'package.xml "' . $file . - '" has no package.xml version'); - $object = &$this->parserFactory('1.0'); - $object->setConfig($this->_config); - $pf = $object->parse($data, $file, $archive); - if (PEAR::isError($pf)) { - return $pf; - } - - if ($this->_rawReturn) { - return $pf; - } - - if (!$pf->validate($state)) { - $a = PEAR::raiseError('Parsing of package.xml from file "' . $file . '" failed', - 2, null, null, $pf->getValidationWarnings()); - return $a; - } - - if ($this->_logger && $pf->getValidationWarnings(false)) { - foreach ($pf->getValidationWarnings() as $warning) { - $this->_logger->log(0, 'WARNING: ' . $warning['message']); - } - } - - if (method_exists($pf, 'flattenFilelist')) { - $pf->flattenFilelist(); // for v2 - } - - return $pf; - } - } - - /** - * Register a temporary file or directory. When the destructor is - * executed, all registered temporary files and directories are - * removed. - * - * @param string $file name of file or directory - * @return void - */ - function addTempFile($file) - { - $GLOBALS['_PEAR_Common_tempfiles'][] = $file; - } - - /** - * Create a PEAR_PackageFile_v* from a compresed Tar or Tgz file. - * @access public - * @param string contents of package.xml file - * @param int package state (one of PEAR_VALIDATE_* constants) - * @return PEAR_PackageFile_v1|PEAR_PackageFile_v2 - * @using Archive_Tar to extract the files - * @using fromPackageFile() to load the package after the package.xml - * file is extracted. - */ - function &fromTgzFile($file, $state) - { - if (!class_exists('Archive_Tar')) { - require_once 'Archive/Tar.php'; - } - - $tar = new Archive_Tar($file); - if ($this->_debug <= 1) { - $tar->pushErrorHandling(PEAR_ERROR_RETURN); - } - - $content = $tar->listContent(); - if ($this->_debug <= 1) { - $tar->popErrorHandling(); - } - - if (!is_array($content)) { - if (is_string($file) && strlen($file < 255) && - (!file_exists($file) || !@is_file($file))) { - $ret = PEAR::raiseError("could not open file \"$file\""); - return $ret; - } - - $file = realpath($file); - $ret = PEAR::raiseError("Could not get contents of package \"$file\"". - '. Invalid tgz file.'); - return $ret; - } - - if (!count($content) && !@is_file($file)) { - $ret = PEAR::raiseError("could not open file \"$file\""); - return $ret; - } - - $xml = null; - $origfile = $file; - foreach ($content as $file) { - $name = $file['filename']; - if ($name == 'package2.xml') { // allow a .tgz to distribute both versions - $xml = $name; - break; - } - - if ($name == 'package.xml') { - $xml = $name; - break; - } elseif (preg_match('/package.xml$/', $name, $match)) { - $xml = $name; - break; - } - } - - $tmpdir = System::mktemp('-t "' . $this->_config->get('temp_dir') . '" -d pear'); - if ($tmpdir === false) { - $ret = PEAR::raiseError("there was a problem with getting the configured temp directory"); - return $ret; - } - - PEAR_PackageFile::addTempFile($tmpdir); - - $this->_extractErrors(); - PEAR::staticPushErrorHandling(PEAR_ERROR_CALLBACK, array($this, '_extractErrors')); - - if (!$xml || !$tar->extractList(array($xml), $tmpdir)) { - $extra = implode("\n", $this->_extractErrors()); - if ($extra) { - $extra = ' ' . $extra; - } - - PEAR::staticPopErrorHandling(); - $ret = PEAR::raiseError('could not extract the package.xml file from "' . - $origfile . '"' . $extra); - return $ret; - } - - PEAR::staticPopErrorHandling(); - $ret = &PEAR_PackageFile::fromPackageFile("$tmpdir/$xml", $state, $origfile); - return $ret; - } - - /** - * helper callback for extracting Archive_Tar errors - * - * @param PEAR_Error|null $err - * @return array - * @access private - */ - function _extractErrors($err = null) - { - static $errors = array(); - if ($err === null) { - $e = $errors; - $errors = array(); - return $e; - } - $errors[] = $err->getMessage(); - } - - /** - * Create a PEAR_PackageFile_v* from a package.xml file. - * - * @access public - * @param string $descfile name of package xml file - * @param int $state package state (one of PEAR_VALIDATE_* constants) - * @param string|false $archive name of the archive this package.xml came - * from, if any - * @return PEAR_PackageFile_v1|PEAR_PackageFile_v2 - * @uses PEAR_PackageFile::fromXmlString to create the oject after the - * XML is loaded from the package.xml file. - */ - function &fromPackageFile($descfile, $state, $archive = false) - { - $fp = false; - if (is_string($descfile) && strlen($descfile) < 255 && - ( - !file_exists($descfile) || !is_file($descfile) || !is_readable($descfile) - || (!$fp = @fopen($descfile, 'r')) - ) - ) { - $a = PEAR::raiseError("Unable to open $descfile"); - return $a; - } - - // read the whole thing so we only get one cdata callback - // for each block of cdata - fclose($fp); - $data = file_get_contents($descfile); - $ret = &PEAR_PackageFile::fromXmlString($data, $state, $descfile, $archive); - return $ret; - } - - /** - * Create a PEAR_PackageFile_v* from a .tgz archive or package.xml file. - * - * This method is able to extract information about a package from a .tgz - * archive or from a XML package definition file. - * - * @access public - * @param string $info file name - * @param int $state package state (one of PEAR_VALIDATE_* constants) - * @return PEAR_PackageFile_v1|PEAR_PackageFile_v2 - * @uses fromPackageFile() if the file appears to be XML - * @uses fromTgzFile() to load all non-XML files - */ - function &fromAnyFile($info, $state) - { - if (is_dir($info)) { - $dir_name = realpath($info); - if (file_exists($dir_name . '/package.xml')) { - $info = PEAR_PackageFile::fromPackageFile($dir_name . '/package.xml', $state); - } elseif (file_exists($dir_name . '/package2.xml')) { - $info = PEAR_PackageFile::fromPackageFile($dir_name . '/package2.xml', $state); - } else { - $info = PEAR::raiseError("No package definition found in '$info' directory"); - } - - return $info; - } - - $fp = false; - if (is_string($info) && strlen($info) < 255 && - (file_exists($info) || ($fp = @fopen($info, 'r'))) - ) { - - if ($fp) { - fclose($fp); - } - - $tmp = substr($info, -4); - if ($tmp == '.xml') { - $info = &PEAR_PackageFile::fromPackageFile($info, $state); - } elseif ($tmp == '.tar' || $tmp == '.tgz') { - $info = &PEAR_PackageFile::fromTgzFile($info, $state); - } else { - $fp = fopen($info, 'r'); - $test = fread($fp, 5); - fclose($fp); - if ($test == ' - * @copyright 2003-2009 The PEAR Group - * @license New BSD, Revised - * @version CVS: $Id: Cvs.php 309762 2011-03-28 02:51:20Z dufuz $ - * @link http://pear.php.net/package/PEAR_PackageFileManager_Plugins - * @since File available since Release 1.0.0alpha1 - */ - -require_once 'PEAR/PackageFileManager/File.php'; - -/** - * Generate a file list from a CVS checkout. - * - * Note that this will NOT work on a - * repository, only on a checked out CVS module - * - * @category PEAR - * @package PEAR_PackageFileManager_Plugins - * @author Greg Beaver - * @copyright 2003-2009 The PEAR Group - * @license New BSD, Revised - * @version Release: 1.0.2 - * @link http://pear.php.net/package/PEAR_PackageFileManager_Plugins - * @since Class available since Release 1.0.0alpha1 - */ -class PEAR_PackageFileManager_CVS extends PEAR_PackageFileManager_File -{ - /** - * List of CVS-specific files that may exist in CVS but should be - * ignored when building the package's file list. - * @var array - * @access private - */ - var $_cvsIgnore = array('.cvsignore'); - - function PEAR_PackageFileManager_CVS($options) - { - parent::PEAR_PackageFileManager_File($options); - } - - /** - * Return a list of all files in the CVS repository - * - * This function is like {@link parent::dirList()} except - * that instead of retrieving a regular filelist, it first - * retrieves a listing of all the CVS/Entries files in - * $directory and all of the subdirectories. Then, it - * reads the Entries file, and creates a listing of files - * that are a part of the CVS repository. No check is - * made to see if they have been modified, but newly - * added or removed files are ignored. - * - * @param string $directory full path to the directory you want the list of - * - * @return array list of files in a directory - * @uses _recurDirList() - * @uses _readCVSEntries() - */ - function dirList($directory) - { - static $in_recursion = false; - if ($in_recursion) { - return parent::dirList($directory); - } - - // include only CVS/Entries files - $this->_setupIgnore(array('*/CVS/Entries'), 0); - $this->_setupIgnore(array(), 1); - $in_recursion = true; - $entries = parent::dirList($directory); - $in_recursion = false; - - if (!$entries || !is_array($entries)) { - $code = PEAR_PACKAGEFILEMANAGER_PLUGINS_NOCVSENTRIES; - return parent::raiseError($code, $directory); - } - - return $this->_readCVSEntries($entries); - } - - /** - * Iterate over the CVS Entries files, and retrieve every - * file in the repository - * - * @param array $entries array of full paths to CVS/Entries files - * - * @uses _getCVSEntries() - * @uses _isCVSFile() - * @return array - * @access private - */ - function _readCVSEntries($entries) - { - $ret = array(); - if (!isset($this->_options['ignore'])) { - $this->_options['ignore'] = false; - } - $ignore = array_merge((array) $this->_options['ignore'], $this->_cvsIgnore); - // implicitly ignore packagefile - $ignore[] = $this->_options['packagefile']; - $include = $this->_options['include']; - - $this->ignore = array(false, false); - $this->_setupIgnore($ignore, 1); - $this->_setupIgnore($include, 0); - foreach ($entries as $cvsentry) { - $directory = @dirname(@dirname($cvsentry)); - if (!$directory) { - continue; - } - - $d = $this->_getCVSEntries($cvsentry); - if (!is_array($d)) { - continue; - } - - foreach ($d as $entry) { - if ($ignore) { - if ($this->_checkIgnore($this->_getCVSFileName($entry), - $directory . DIRECTORY_SEPARATOR . $this->_getCVSFileName($entry), 1)) { - continue; - } - } - - if ($include) { - if ($this->_checkIgnore($this->_getCVSFileName($entry), - $directory . DIRECTORY_SEPARATOR . $this->_getCVSFileName($entry), 0)) { - continue; - } - } - - if ($this->_isCVSFile($entry)) { - $ret[] = $directory . DIRECTORY_SEPARATOR . $this->_getCVSFileName($entry); - } - } - } - - return $ret; - } - - /** - * Retrieve the filename from an entry - * - * This method assumes that the entry is a file, - * use _isCVSFile() to verify before calling - * - * @param string $cvsentry a line in a CVS/Entries file - * - * @return string the filename (no path information) - * @access private - */ - function _getCVSFileName($cvsentry) - { - $stuff = explode('/', $cvsentry); - array_shift($stuff); - return array_shift($stuff); - } - - /** - * Retrieve the entries in a CVS/Entries file - * - * @param string $cvsentryfilename full path to a CVS/Entries file - * - * @return array each line of the entries file, output of file() - * @uses function file() - * @access private - */ - function _getCVSEntries($cvsentryfilename) - { - $cvsfile = @file($cvsentryfilename); - if (is_array($cvsfile)) { - return $cvsfile; - } - - return false; - } - - /** - * Check whether an entry is a file or a directory - * - * @param string $cvsentry a line in a CVS/Entries file - * - * @return boolean - * @access private - */ - function _isCVSFile($cvsentry) - { - // make sure we ignore entries that have either been removed or added, - // but not committed yet - return $cvsentry{0} == '/' && !strpos($cvsentry, 'dummy timestamp'); - } -} \ No newline at end of file diff --git a/data/package/PEAR/PackageFileManager/File.php b/data/package/PEAR/PackageFileManager/File.php deleted file mode 100644 index cff729c..0000000 --- a/data/package/PEAR/PackageFileManager/File.php +++ /dev/null @@ -1,492 +0,0 @@ - - * @copyright 2003-2009 The PEAR Group - * @license New BSD, Revised - * @version CVS: $Id: File.php 309762 2011-03-28 02:51:20Z dufuz $ - * @link http://pear.php.net/package/PEAR_PackageFileManager_Plugins - * @since File available since Release 1.0.0alpha1 - */ - -require_once 'PEAR/PackageFileManager/Plugins.php'; - -/** - * Retrieve the files from a directory listing - * - * This class is used to retrieve a raw directory - * listing. Use the {@link PEAR_PackageFileManager_CVS} - * class to only retrieve the contents of a cvs - * repository when generating the package.xml - * - * @category PEAR - * @package PEAR_PackageFileManager_Plugins - * @author Greg Beaver - * @copyright 2003-2009 The PEAR Group - * @license New BSD, Revised - * @version Release: 1.0.2 - * @link http://pear.php.net/package/PEAR_PackageFileManager_Plugins - * @since Class available since Release 1.0.0alpha1 - */ -class PEAR_PackageFileManager_File extends PEAR_PackageFileManager_Plugins -{ - /** - * @access private - * @var array|false - */ - var $ignore = false; - - /** - * If we are on windows - * @access private - * @var boolean - */ - var $windows = false; - - /** - * Set up the File filelist generator - * - * 'ignore' and 'include' are the only options that this class uses. See - * {@link PEAR_PackageFileManager::setOptions()} for - * more information and formatting of this option - * - * @param array $options list of generation options - * - * @return void - */ - function PEAR_PackageFileManager_File($options) - { - $this->windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN'; - $this->setOptions($options); - } - - /** - * Generate the section - * of the package file. - * - * This function performs the backend generation of the array - * containing all files in this package - * - * @return array - */ - function getFileList() - { - $package_directory = $this->_options['packagedirectory']; - $ignore = $this->_options['ignore']; - // implicitly ignore packagefile - $ignore[] = $this->_options['packagefile']; - if ($this->_options['packagefile'] == 'package.xml') { - // ignore auto-generated package2.xml from PEAR 1.4.0 - $ignore[] = 'package2.xml'; - } - - $dir = $package_directory; - if ($dir{strlen($dir) - 1} === DIRECTORY_SEPARATOR) { - $dir = substr($package_directory, 0, strlen($package_directory) - 1); - } - - $include = $this->_options['include']; - $this->ignore = array(false, false); - $this->_setupIgnore($ignore, 1); - $this->_setupIgnore($include, 0); - $allfiles = $this->dirList($dir); - if (PEAR::isError($allfiles)) { - return $allfiles; - } - - if (!count($allfiles)) { - return parent::raiseError(PEAR_PACKAGEFILEMANAGER_PLUGINS_NO_FILES, $dir); - } - - $struc = array(); - $package_directory_realpath = realpath($package_directory); - if (DIRECTORY_SEPARATOR != substr($package_directory_realpath, -1, 1)) { - $package_directory_realpath .= DIRECTORY_SEPARATOR; - } - - foreach ($allfiles as $file) { - $ps = str_replace(DIRECTORY_SEPARATOR, '/', $package_directory_realpath); - $path = substr(dirname($file), strlen($ps)); - if (!$path) { - $path = '/'; - } - - $stupidassphp5_1 = explode('.', $file); - $ext = array_pop($stupidassphp5_1); - if (strlen($ext) === strlen($file)) { - $ext = ''; - } - - $struc[$path][] = array( - 'file' => basename($file), - 'ext' => $ext, - 'path' => (($path == '/') ? basename($file) : $path . '/' . basename($file)), - 'fullpath' => $file - ); - } - - if (!count($struc)) { - $newig = implode($this->_options['ignore'], ', '); - return parent::raiseError(PEAR_PACKAGEFILEMANAGER_PLUGINS_IGNORED_EVERYTHING, - substr($package_directory, 0, strlen($package_directory) - 1), $newig); - } - - uksort($struc, 'strnatcasecmp'); - foreach ($struc as $key => $ind) { - usort($ind, array($this, 'sortfiles')); - $struc[$key] = $ind; - } - - $tempstruc = $struc; - if (!isset($tempstruc['/'])) { - $tempstruc['/'] = array(); - } - - $struc = array('/' => $tempstruc['/']); - $bv = 0; - foreach ($tempstruc as $key => $ind) { - $save = $key; - if ($key != '/') { - $struc['/'] = $this->_setupDirs($struc['/'], explode('/', $key), $tempstruc[$key]); - } - } - uksort($struc['/'], array($this, 'mystrucsort')); - - return $struc; - } - - /** - * Retrieve a listing of every file in $directory and - * all subdirectories. - * - * The return format is an array of full paths to files - * - * @param string $directory full path to the directory you want the list of - * - * @access protected - * @return array list of files in a directory - * @throws PEAR_PACKAGEFILEMANAGER_PLUGINS_DIR_DOESNT_EXIST - */ - function dirList($directory) - { - if (!@is_dir($directory)) { - return parent::raiseError(PEAR_PACKAGEFILEMANAGER_PLUGINS_DIR_DOESNT_EXIST, $directory); - } - - $ret = array(); - $d = @dir($directory); // thanks to Jason E Sweat (jsweat@users.sourceforge.net) for fix - while ($d && false !== ($entry = $d->read())) { - if ($this->_testFile($directory, $entry)) { - $de = $directory . '/' . $entry; - if (is_file($de)) { - // if include option was set, then only pass included files - if ($this->ignore[0] && $this->_checkIgnore($entry, $de, 0)) { - continue; - } - // if ignore option was set, then only pass included files - if ($this->ignore[1] && $this->_checkIgnore($entry, $de, 1)) { - continue; - } - $ret[] = $de; - } - - if (is_dir($de)) { - $tmp = $this->dirList($de); - if (is_array($tmp)) { - foreach ($tmp as $ent) { - $ret[] = $ent; - } - } - } - } - } - - if ($d) { - $d->close(); - } - - usort($ret, array($this, 'mystrucsort')); - return $ret; - } - - /** - * Test whether an entry should be processed. - * - * Normally, it ignores all files and directories that begin with "." addhiddenfiles option - * instead only ignores "." and ".." entries - * - * @param string $directory directory name of entry - * @param string $entry name - * - * @return bool - * @access private - */ - function _testFile($directory, $entry) - { - if ($this->_options['addhiddenfiles']) { - return is_file($directory . '/' . $entry) || (is_dir($directory . '/' . $entry) && !in_array($entry, array('.', '..'))); - } - - return $entry{0} != '.'; - } - - /** - * Tell whether to ignore a file or a directory - * allows * and ? wildcards - * - * @param string $file just the file name of the file or directory, - * in the case of directories this is the last dir - * @param string $path the full path - * @param bool $return value to return if regexp matches. Set this to - * false to include only matches, true to exclude - * all matches - * - * @return bool true if $path should be ignored, false if it should not - * @access private - */ - function _checkIgnore($file, $path, $return = 1) - { - if ($this->windows && file_exists($path)) { - $path = realpath($path); - } - - if (DIRECTORY_SEPARATOR == '\\') { - $path = strtr($path, '/', '\\'); - } else { - $path = strtr($path, '\\', '/'); - } - - if (is_array($this->ignore[$return])) { - foreach ($this->ignore[$return] as $match) { - // match is an array if the ignore parameter was a /path/to/pattern - if (is_array($match)) { - // check to see if the path matches with a path delimiter appended - preg_match('/^' . strtoupper($match[0]).'$/', strtoupper($path) . DIRECTORY_SEPARATOR, $find); - if (!count($find)) { - // check to see if it matches without an appended path delimiter - preg_match('/^' . strtoupper($match[0]).'$/', strtoupper($path), $find); - } - - if (count($find)) { - // check to see if the file matches the file portion of the regex string - preg_match('/^' . strtoupper($match[1]).'$/', strtoupper($file), $find); - if (count($find)) { - return $return; - } - } - - // check to see if the full path matches the regex - preg_match('/^' . strtoupper($match[0]).'$/', - strtoupper($path . DIRECTORY_SEPARATOR . $file), $find); - if (count($find)) { - return $return; - } - - // user is trying a regex with no glob, lets give him the full path to match against - if (!isset($this->_options['packagedirectory'])) { - return !$return; - } - - $t = $this->_getRegExpableSearchString($this->_options['packagedirectory']); - preg_match('/^' . strtoupper($t . $match[0]).'$/', strtoupper($path), $find); - if (count($find)) { - return $return; - } - } else { - // ignore parameter was just a pattern with no path delimiters - // check it against the path - preg_match('/^' . strtoupper($match).'$/', strtoupper($path), $find); - if (count($find)) { - return $return; - } - - // check it against the file only - preg_match('/^' . strtoupper($match).'$/', strtoupper($file), $find); - if (count($find)) { - return $return; - } - } - } - } - - return !$return; - } - - /** - * Construct the {@link $ignore} array - * - * @param array $ignore strings of files/paths/wildcards to ignore - * @param bool $index 0 = files to include, 1 = files to ignore - * - * @return void - * @access private - */ - function _setupIgnore($ignore, $index) - { - if (!is_array($ignore)) { - $this->ignore[$index] = false; - return; - } - - $ig = array(); - for ($i = 0, $ic = count($ignore); $i < $ic; $i++) { - $ignore[$i] = strtr($ignore[$i], '\\', '/'); - $ignore[$i] = str_replace('//', '/', $ignore[$i]); - - if (!empty($ignore[$i])) { - if (!is_numeric(strpos($ignore[$i], '/'))) { - $ig[] = $this->_getRegExpableSearchString($ignore[$i]); - } else { - /* - People tend to forgot to add * when they want to ignore - a whole dir so we try to discover it for them - Make sure the char before the last / is not * as adding * - after a / as well is not optimal - */ - $one = strrpos($ignore[$i], '/'); - $len = strlen($ignore[$i]); - if ($one !== false && $len-1 == $one && - ($len > 1 && $ignore[$i][$len-2] != '*') - ) { - $ignore[$i] .= '*'; - } - - if (basename($ignore[$i]) . '/' == $ignore[$i]) { - $ig[] = $this->_getRegExpableSearchString($ignore[$i]); - } else { - $ig[] = array($this->_getRegExpableSearchString($ignore[$i]), - $this->_getRegExpableSearchString(basename($ignore[$i]))); - } - } - } - } - - $this->ignore[$index] = count($ig) ? $ig : false; - } - - /** - * Converts $s into a string that can be used with preg_match - * - * @param string $s string with wildcards ? and * - * - * @return string converts * to .*, ? to ., etc. - * @access private - */ - function _getRegExpableSearchString($s) - { - $y = '\/'; - if (DIRECTORY_SEPARATOR == '\\') { - $y = '\\\\'; - } - - $s = str_replace('/', DIRECTORY_SEPARATOR, $s); - $x = strtr($s, array('?' => '.', '*' => '.*', '.' => '\\.', '\\' => '\\\\', '/' => '\\/', - '[' => '\\[', ']' => '\\]', '-' => '\\-')); - - if (strpos($s, DIRECTORY_SEPARATOR) !== false && - strrpos($s, DIRECTORY_SEPARATOR) === strlen($s) - 1) { - $x = "(?:.*$y$x?.*|$x.*)"; - } - - return $x; - } - - /** - * Recursively move contents of $struc into associative array - * - * The contents of $struc have many indexes like 'dir/subdir/subdir2'. - * This function converts them to - * array('dir' => array('subdir' => array('subdir2'))) - * - * @param array $struc is array('dir' => array of files in dir, - * 'dir/subdir' => array of files in dir/subdir,...) - * @param array $dir array form of 'dir/subdir/subdir2' array('dir','subdir','subdir2') - * @param array $contents - * - * @return array same as struc but with array('dir' => - * array(file1,file2,'subdir' => array(file1,...))) - * @access private - */ - function _setupDirs($struc, $dir, $contents) - { - if (!count($dir)) { - foreach ($contents as $dir => $files) { - if (is_string($dir) && strpos($dir, '/')) { - $a = $contents[$dir]; - unset($contents[$dir]); - $b = explode('/', $dir); - $c = array_shift($b); - if (isset($contents[$c])) { - $contents[$c] = $this->_setDir($contents[$c], $this->_setupDirs(array(), $b, $a)); - } else { - $contents[$c] = $this->_setupDirs(array(), $b, $a); - } - } - } - - return $contents; - } - - $me = array_shift($dir); - if (!isset($struc[$me])) { - $struc[$me] = array(); - - } - $struc[$me] = $this->_setupDirs($struc[$me], $dir, $contents); - return $struc; - } - - /** - * Recursively add all the subdirectories of $contents to $dir - * without erasing anything in $dir - * - * @param array $dir - * @param array $contents - * - * @return array processed $dir - * @access private - */ - function _setDir($dir, $contents) - { - while (list($one,$two) = each($contents)) { - if (isset($dir[$one])) { - $dir[$one] = $this->_setDir($dir[$one], $contents[$one]); - } else { - $dir[$one] = $two; - } - } - return $dir; - } - - /**#@+ - * Sorting functions for the file list - * - * @param string $a - * @param string $b - * - * @access private - */ - function sortfiles($a, $b) - { - return strnatcasecmp($a['file'], $b['file']); - } - - function mystrucsort($a, $b) - { - if (is_numeric($a) && is_string($b)) return 1; - if (is_numeric($b) && is_string($a)) return -1; - if (is_numeric($a) && is_numeric($b)) { - if ($a > $b) return 1; - if ($a < $b) return -1; - if ($a == $b) return 0; - } - return strnatcasecmp($a, $b); - } - /**#@-*/ -} \ No newline at end of file diff --git a/data/package/PEAR/PackageFileManager/Perforce.php b/data/package/PEAR/PackageFileManager/Perforce.php deleted file mode 100644 index df5d1be..0000000 --- a/data/package/PEAR/PackageFileManager/Perforce.php +++ /dev/null @@ -1,99 +0,0 @@ - - * @copyright 2005-2009 The PEAR Group - * @license New BSD, Revised - * @version CVS: $Id: Perforce.php 272180 2008-12-29 04:57:55Z dufuz $ - * @link http://pear.php.net/package/PEAR_PackageFileManager_Plugins - * @since File available since Release 1.0.0alpha1 - */ - -require_once 'PEAR/PackageFileManager/File.php'; - -/** - * Generate a file list from a Perforce checkout. - * - * This requires the 'p4' command line client, - * a properly-configured Perforce environment, and a - * connection to the Perforce server. Specifically, the 'p4 have' command - * is used to determine which local files are under Perforce's control. - * - * @category PEAR - * @package PEAR_PackageFileManager_Plugins - * @author Jon Parise - * @copyright 2005-2009 The PEAR Group - * @license New BSD, Revised - * @version Release: 1.0.2 - * @link http://pear.php.net/package/PEAR_PackageFileManager_Plugins - * @since Class available since Release 1.0.0alpha1 - */ -class PEAR_PackageFileManager_Perforce extends PEAR_PackageFileManager_File -{ - /** - * Build a list of files based on the output of the 'p4 have' command. - * - * @param string $directory The directory in which to list the files. - * - * @return mixed An array of full filenames or a PEAR_Error value if - * $directory does not exist. - */ - function dirList($directory) - { - /* Return an error if the directory does not exist. */ - if (@is_dir($directory) === false) { - return parent::raiseError(PEAR_PACKAGEFILEMANAGER_PLUGINS_DIR_DOESNT_EXIST, $directory); - } - - /* List the files below $directory that are under Perforce control. */ - exec("p4 have $directory/...", $output); - - /* Strip off everything except the filename from each line of output. */ - $files = preg_replace('/^.* \- /', '', $output); - - /* If we have a list of files to include, remove all other entries. */ - if ($this->ignore[0]) { - $files = array_filter($files, array($this, '_includeFilter')); - } - - /* If we have a list of files to ignore, remove them from the array. */ - if ($this->ignore[1]) { - $files = array_filter($files, array($this, '_ignoreFilter')); - } - - return $files; - } - - /** - * Determine whether a given file should be excluded from the file list. - * - * @param string $file The full pathname of file to check. - * - * @return bool True if the specified file should be included. - * @access private - */ - function _includeFilter($file) - { - return ($this->_checkIgnore(basename($file), $file, 0) === 0); - } - - /** - * Determine whether a given file should be included (i.e., not ignored) - * from the file list. - * - * @param string $file The full pathname of file to check. - * - * @return bool True if the specified file should be included. - * @access private - */ - function _ignoreFilter($file) - { - return ($this->_checkIgnore(basename($file), $file, 1) !== 1); - } -} \ No newline at end of file diff --git a/data/package/PEAR/PackageFileManager/Plugins.php b/data/package/PEAR/PackageFileManager/Plugins.php deleted file mode 100644 index fae6c8b..0000000 --- a/data/package/PEAR/PackageFileManager/Plugins.php +++ /dev/null @@ -1,102 +0,0 @@ - - * @copyright 2009 The PEAR Group - * @license New BSD, Revised - * @version CVS: $Id: Plugins.php 309717 2011-03-26 18:14:32Z dufuz $ - * @link http://pear.php.net/package/PEAR_PackageFileManager_Plugins - * @since File available since Release 1.0.0alpha1 - */ - -/**#@+ - * Error Codes - */ -define('PEAR_PACKAGEFILEMANAGER_PLUGINS_NOCVSENTRIES', 12); -define('PEAR_PACKAGEFILEMANAGER_PLUGINS_DIR_DOESNT_EXIST', 13); -define('PEAR_PACKAGEFILEMANAGER_PLUGINS_NO_FILES', 20); -define('PEAR_PACKAGEFILEMANAGER_PLUGINS_IGNORED_EVERYTHING', 21); -define('PEAR_PACKAGEFILEMANAGER_PLUGINS_NOSVNENTRIES', 32); -/**#@-*/ -/** - * Error messages - * @global array $GLOBALS['_PEAR_PACKAGEFILEMANAGER_PLUGINS_ERRORS'] - */ -$GLOBALS['_PEAR_PACKAGEFILEMANAGER_PLUGINS_ERRORS'] = -array( - PEAR_PACKAGEFILEMANAGER_PLUGINS_NOCVSENTRIES => - 'Directory "%s" is not a CVS directory (it must have the CVS/Entries file)', - PEAR_PACKAGEFILEMANAGER_PLUGINS_DIR_DOESNT_EXIST => - 'Package source base directory "%s" doesn\'t exist or isn\'t a directory', - PEAR_PACKAGEFILEMANAGER_PLUGINS_NO_FILES => - 'No files found, check the path "%s"', - PEAR_PACKAGEFILEMANAGER_PLUGINS_IGNORED_EVERYTHING => - 'No files left, check the path "%s" and ignore option "%s"', - PEAR_PACKAGEFILEMANAGER_PLUGINS_NOSVNENTRIES => - 'Directory "%s" is not a SVN directory (it must have the .svn/entries file)', -); - -/** - * Generate a file list from a Subversion checkout - * - * Largely based on the CVS class, modified to suit - * subversion organization. - * - * Note that this will NOT work on a - * repository, only on a checked out Subversion module - * - * @category PEAR - * @package PEAR_PackageFileManager_Plugins - * @author Helgi Þormar Þorbjörnsson - * @copyright 2009 The PEAR Group - * @license New BSD, Revised - * @version Release: 1.0.2 - * @link http://pear.php.net/package/PEAR_PackageFileManager_Plugins - * @since Class available since Release 1.0.0alpha1 - */ -class PEAR_PackageFileManager_Plugins -{ - /** - * @var array - * @access protected - */ - var $_options = array(); - - /** - * Utility function to shorten error generation code - * - * {@source} - * - * @param integer $code error code - * @param string $i1 (optional) additional specific error info #1 - * @param string $i2 (optional) additional specific error info #2 - * - * @return PEAR_Error - * @static - * @access public - * @since 1.0.0alpha1 - */ - function raiseError($code, $i1 = '', $i2 = '') - { - return PEAR::raiseError('PEAR_PackageFileManager_Plugins Error: ' . - sprintf($GLOBALS['_PEAR_PACKAGEFILEMANAGER_PLUGINS_ERRORS'][$code], - $i1, $i2), $code); - } - - /** - * Merge a new set of options (as an array) to the currently set - * options - * - * @param $options array Options to merge with the current options - * @return void - */ - function setOptions($options) - { - $this->_options = array_merge($this->_options, $options); - } -} \ No newline at end of file diff --git a/data/package/PEAR/PackageFileManager/Svn.php b/data/package/PEAR/PackageFileManager/Svn.php deleted file mode 100644 index 4aeb1be..0000000 --- a/data/package/PEAR/PackageFileManager/Svn.php +++ /dev/null @@ -1,242 +0,0 @@ - - * @author Tim Jackson - * @copyright 2005-2009 The PEAR Group - * @license New BSD, Revised - * @version CVS: $Id: Svn.php 309762 2011-03-28 02:51:20Z dufuz $ - * @link http://pear.php.net/package/PEAR_PackageFileManager_Plugins - * @since File available since Release 1.0.0alpha1 - */ - -require_once 'PEAR/PackageFileManager/File.php'; - -/** - * Generate a file list from a Subversion checkout - * - * Largely based on the CVS class, modified to suit - * subversion organization. - * - * Note that this will NOT work on a - * repository, only on a checked out Subversion module - * - * @category PEAR - * @package PEAR_PackageFileManager_Plugins - * @author Arnaud Limbourg - * @author Tim Jackson - * @copyright 2005-2009 The PEAR Group - * @license New BSD, Revised - * @version Release: 1.0.2 - * @link http://pear.php.net/package/PEAR_PackageFileManager_Plugins - * @since Class available since Release 1.0.0alpha1 - */ -class PEAR_PackageFileManager_Svn extends PEAR_PackageFileManager_File -{ - function PEAR_PackageFileManager_Svn($options) - { - parent::PEAR_PackageFileManager_File($options); - } - - /** - * Return a list of all files in the SVN repository - * - * This function is like {@link parent::dirList()} except - * that instead of retrieving a regular filelist, it first - * retrieves a listing of all the .svn/entries files in - * $directory and all of the subdirectories. Then, it - * reads the entries file, and creates a listing of files - * that are a part of the Subversion checkout. No check is - * made to see if they have been modified, but removed files - * are ignored. - * - * @param string $directory full path to the directory you want the list of - * - * @access protected - * @return array list of files in a directory - * @uses _recurDirList() - * @uses _readSVNEntries() - */ - function dirList($directory) - { - static $in_recursion = false; - if ($in_recursion) { - return parent::dirList($directory); - } - - // include only .svn/entries files - // since subversion keeps its data in a hidden - // directory we must force PackageFileManager to - // consider hidden directories. - $this->_options['addhiddenfiles'] = true; - $this->_setupIgnore(array('*/.svn/entries'), 0); - $this->_setupIgnore(array(), 1); - $in_recursion = true; - $entries = parent::dirList($directory); - $in_recursion = false; - - if (!$entries || !is_array($entries)) { - $code = PEAR_PACKAGEFILEMANAGER_PLUGINS_NOSVNENTRIES; - return parent::raiseError($code, $directory); - } - return $this->_readSVNEntries($entries); - } - - /** - * Iterate over the SVN Entries files, and retrieve every - * file in the repository - * - * @param array $entries array of full paths to .svn/entries files - * - * @return array - * @uses _getSVNEntries() - * @access private - */ - function _readSVNEntries($entries) - { - $ret = array(); - $ignore = $this->_options['ignore']; - // implicitly ignore packagefile - $ignore[] = $this->_options['packagefile']; - $include = $this->_options['include']; - $this->ignore = array(false, false); - $this->_setupIgnore($ignore, 1); - $this->_setupIgnore($include, 0); - foreach ($entries as $entry) { - $directory = @dirname(@dirname($entry)); - if (!$directory) { - continue; - } - $d = $this->_getSVNEntries($entry); - if (!is_array($d)) { - continue; - } - - foreach ($d as $entry) { - if ($ignore) { - if ($this->_checkIgnore($entry, - $directory . DIRECTORY_SEPARATOR . $entry, 1)) { - continue; - } - } - - if ($include) { - if ($this->_checkIgnore($entry, - $directory . DIRECTORY_SEPARATOR . $entry, 0)) { - continue; - } - } - $ret[] = $directory . DIRECTORY_SEPARATOR . $entry; - } - } - return $ret; - } - - /** - * Retrieve the entries in a .svn/entries file - * - * Uses XML_Tree to parse the XML subversion file - * - * It keeps only files, excluding directories. It also - * makes sure no deleted file in included. - * - * @param string $svnentriesfilename full path to a .svn/entries file - * - * @return array an array with full paths to files - * @uses PEAR::XML_Tree - * @access private - */ - function _getSVNEntries($filename) - { - $content = file_get_contents($filename); - if (substr($content, 0, 5) != '= SVN 1.4) SVN entries format - // http://svn.apache.org/repos/asf/subversion/trunk/subversion/libsvn_wc/README - - // The directory entries are seperated by #0c; look for the first #0c - // The hex GUID (xxxx-xxxx-xxxx-xxxx-xxxx) may not always be set - // The list of files follows this - if (!preg_match('/\x0c\n(.*)$/ms', $content, $matches)) { - return false; - } - - // Each file entry seems to look something like this: - // [filename] - // [type of file e.g. "dir", "file"] - // [varying number of \n] - // [optional "deleted" string] - $files = explode("\x0c", trim($matches[1])); - foreach ($files as $file) { - $lines = explode("\n", trim($file)); - if (isset($lines[1]) && $lines[1] == 'file') { - $deleted = false; - foreach ($lines as $line) { - // 'deleted' means it's already gone - // 'delete' means it's marked as ready to delete - if ($line == 'deleted' || $line == 'delete') { - $deleted = true; - } - } - - if (!$deleted) { - $entries[] = $lines[0]; - } - } - } - } elseif (function_exists('simplexml_load_string')) { - // this breaks simplexml because "svn:" is an invalid namespace, so strip it - $content = str_replace('xmlns="svn:"', '', $content); - $all = simplexml_load_string($content); - $entries = array(); - foreach ($all->entry as $entry) { - if ($entry['kind'] == 'file') { - // 'deleted' means it's already gone - // 'delete' means it's marked as ready to delete - if (isset($entry['deleted']) || isset($entry['delete'])) { - continue; - } - array_push($entries, $entry['name']); - } - } - } else { - require_once 'XML/Unserializer.php'; - $options = array( - XML_UNSERIALIZER_OPTION_ATTRIBUTES_PARSE => true, - XML_UNSERIALIZER_OPTION_ATTRIBUTES_ARRAYKEY => false - ); - $unserializer = &new XML_Unserializer($options); - $status = $unserializer->unserialize($content); - if (PEAR::isError($status)) { - return false; - } - $tree = $unserializer->getUnserializedData(); - - // loop through the xml tree and keep only valid entries being files - $entries = array(); - foreach ($tree['entry'] as $entry) { - if ($entry['kind'] == 'file') { - // 'deleted' means it's already gone - // 'delete' means it's marked as ready to delete - if (isset($entry['deleted']) || isset($entry['delete'])) { - continue; - } - array_push($entries, $entry['name']); - } - } - - unset($unserializer, $tree); - } - - if (isset($entries) && is_array($entries)) { - return $entries; - } - - return false; - } -} \ No newline at end of file diff --git a/data/package/PEAR/PackageFileManager2.php b/data/package/PEAR/PackageFileManager2.php index f8f07e4..798d270 100644 --- a/data/package/PEAR/PackageFileManager2.php +++ b/data/package/PEAR/PackageFileManager2.php @@ -3,14 +3,13 @@ * PEAR_PackageFileManager2, like PEAR_PackageFileManager, is designed to * create and manipulate package.xml version 2.0. * - * PHP versions 4 and 5 + * PHP versions 5 and 7 * * @category PEAR * @package PEAR_PackageFileManager2 * @author Greg Beaver - * @copyright 2005-2009 The PEAR Group + * @copyright 2003-2015 The PEAR Group * @license New BSD, Revised - * @version CVS: $Id: PackageFileManager2.php 309758 2011-03-28 01:47:53Z dufuz $ * @link http://pear.php.net/package/PEAR_PackageFileManager2 * @since File available since Release 1.0.0alpha1 */ @@ -55,61 +54,61 @@ * @access private */ $GLOBALS['_PEAR_PACKAGEFILEMANAGER2_ERRORS'] = -array( - 'en' => array( - PEAR_PACKAGEFILEMANAGER2_NOPKGDIR => - 'Package source base directory (option \'packagedirectory\') must be ' . - 'specified in PEAR_PackageFileManager2 setOptions', - PEAR_PACKAGEFILEMANAGER2_PKGDIR_NOTREAL => - 'Package source base directory (option \'packagedirectory\') must be ' . - 'an existing directory (was "%s")', - PEAR_PACKAGEFILEMANAGER2_PATHTOPKGDIR_NOTREAL => - 'Path to a Package file to read in (option \'pathtopackagefile\') must be ' . - 'an existing directory (was "%s")', - PEAR_PACKAGEFILEMANAGER2_OUTPUTDIR_NOTREAL => - 'output directory (option \'outputdirectory\') must be ' . - 'an existing directory (was "%s")', - PEAR_PACKAGEFILEMANAGER2_NOBASEDIR => - 'Package install base directory (option \'baseinstalldir\') must be ' . - 'specified in PEAR_PackageFileManager2 setOptions', - PEAR_PACKAGEFILEMANAGER2_GENERATOR_NOTFOUND => - 'Base class "%s" can\'t be located', - PEAR_PACKAGEFILEMANAGER2_GENERATOR_NOTFOUND_ANYWHERE => - 'Base class "%s" can\'t be located in default or user-specified directories', - PEAR_PACKAGEFILEMANAGER2_CANTWRITE_PKGFILE => - 'Failed to write package.xml file to destination directory', - PEAR_PACKAGEFILEMANAGER2_DEST_UNWRITABLE => - 'Destination directory "%s" is unwritable', - PEAR_PACKAGEFILEMANAGER2_CANTCOPY_PKGFILE => - 'Failed to copy package.xml.tmp file to package.xml', - PEAR_PACKAGEFILEMANAGER2_CANTOPEN_TMPPKGFILE => - 'Failed to open temporary file "%s" for writing', - PEAR_PACKAGEFILEMANAGER2_PATH_DOESNT_EXIST => - 'package.xml file path "%s" doesn\'t exist or isn\'t a directory', - PEAR_PACKAGEFILEMANAGER2_DIR_DOESNT_EXIST => - 'Package source base directory "%s" doesn\'t exist or isn\'t a directory', - PEAR_PACKAGEFILEMANAGER2_RUN_SETOPTIONS => - 'Run $managerclass->setOptions() before any other methods', - PEAR_PACKAGEFILEMANAGER2_NO_FILES => - 'No files found, check the path "%s"', - PEAR_PACKAGEFILEMANAGER2_IGNORED_EVERYTHING => - 'No files left, check the path "%s" and ignore option "%s"', - PEAR_PACKAGEFILEMANAGER2_INVALID_PACKAGE => - 'Package validation failed:%s%s', - PEAR_PACKAGEFILEMANAGER2_INVALID_REPLACETYPE => - 'Replacement Type must be one of "%s", was passed "%s"', - PEAR_PACKAGEFILEMANAGER2_INVALID_POSTINSTALLSCRIPT => - 'Invalid post-install script task: %s', - PEAR_PACKAGEFILEMANAGER2_INVALID_ROLE => - 'Invalid file role passed to addRole, must be one of "%s", was passed "%s"', - PEAR_PACKAGEFILEMANAGER2_CVS_PACKAGED => - 'path "%path%" contains CVS directory', - PEAR_PACKAGEFILEMANAGER2_NO_PHPCOMPATINFO => - 'pear/PHP_CompatInfo is not installed, cannot detect dependencies', - ), + 'en' => + array( + PEAR_PACKAGEFILEMANAGER2_NOPKGDIR => + 'Package source base directory (option \'packagedirectory\') must be ' . + 'specified in PEAR_PackageFileManager2 setOptions', + PEAR_PACKAGEFILEMANAGER2_PKGDIR_NOTREAL => + 'Package source base directory (option \'packagedirectory\') must be ' . + 'an existing directory (was "%s")', + PEAR_PACKAGEFILEMANAGER2_PATHTOPKGDIR_NOTREAL => + 'Path to a Package file to read in (option \'pathtopackagefile\') must be ' . + 'an existing directory (was "%s")', + PEAR_PACKAGEFILEMANAGER2_OUTPUTDIR_NOTREAL => + 'output directory (option \'outputdirectory\') must be ' . + 'an existing directory (was "%s")', + PEAR_PACKAGEFILEMANAGER2_NOBASEDIR => + 'Package install base directory (option \'baseinstalldir\') must be ' . + 'specified in PEAR_PackageFileManager2 setOptions', + PEAR_PACKAGEFILEMANAGER2_GENERATOR_NOTFOUND => + 'Base class "%s" can\'t be located', + PEAR_PACKAGEFILEMANAGER2_GENERATOR_NOTFOUND_ANYWHERE => + 'Base class "%s" can\'t be located in default or user-specified directories', + PEAR_PACKAGEFILEMANAGER2_CANTWRITE_PKGFILE => + 'Failed to write package.xml file to destination directory', + PEAR_PACKAGEFILEMANAGER2_DEST_UNWRITABLE => + 'Destination directory "%s" is unwritable', + PEAR_PACKAGEFILEMANAGER2_CANTCOPY_PKGFILE => + 'Failed to copy package.xml.tmp file to package.xml', + PEAR_PACKAGEFILEMANAGER2_CANTOPEN_TMPPKGFILE => + 'Failed to open temporary file "%s" for writing', + PEAR_PACKAGEFILEMANAGER2_PATH_DOESNT_EXIST => + 'package.xml file path "%s" doesn\'t exist or isn\'t a directory', + PEAR_PACKAGEFILEMANAGER2_DIR_DOESNT_EXIST => + 'Package source base directory "%s" doesn\'t exist or isn\'t a directory', + PEAR_PACKAGEFILEMANAGER2_RUN_SETOPTIONS => + 'Run $managerclass->setOptions() before any other methods', + PEAR_PACKAGEFILEMANAGER2_NO_FILES => + 'No files found, check the path "%s"', + PEAR_PACKAGEFILEMANAGER2_IGNORED_EVERYTHING => + 'No files left, check the path "%s" and ignore option "%s"', + PEAR_PACKAGEFILEMANAGER2_INVALID_PACKAGE => + 'Package validation failed:%s%s', + PEAR_PACKAGEFILEMANAGER2_INVALID_REPLACETYPE => + 'Replacement Type must be one of "%s", was passed "%s"', + PEAR_PACKAGEFILEMANAGER2_INVALID_POSTINSTALLSCRIPT => + 'Invalid post-install script task: %s', + PEAR_PACKAGEFILEMANAGER2_INVALID_ROLE => + 'Invalid file role passed to addRole, must be one of "%s", was passed "%s"', + PEAR_PACKAGEFILEMANAGER2_CVS_PACKAGED => + 'path "%path%" contains CVS directory', + PEAR_PACKAGEFILEMANAGER2_NO_PHPCOMPATINFO => + 'pear/PHP_CompatInfo is not installed, cannot detect dependencies', + ), // other language translations go here - ); + ); /** * PEAR_PackageFileManager2, like PEAR_PackageFileManager, is designed to * create and manipulate package.xml version 2.0. @@ -190,9 +189,9 @@ * @category PEAR * @package PEAR_PackageFileManager2 * @author Greg Beaver - * @copyright 2005-2009 The PEAR Group + * @copyright 2003-2015 The PEAR Group * @license New BSD, Revised - * @version Release: 1.0.2 + * @version Release: 1.0.4 * @link http://pear.php.net/package/PEAR_PackageFileManager2 * @since Class available since Release 1.0.0alpha1 */ @@ -257,64 +256,59 @@ class PEAR_PackageFileManager2 extends PEAR_PackageFile_v2_rw * @since 1.0.0a1 */ var $_options = array( - 'packagefile' => 'package.xml', - 'filelistgenerator' => 'file', - 'license' => 'New BSD License', - 'baseinstalldir' => '', - 'changelogoldtonew' => true, - 'roles' => - array( - 'h' => 'src', - 'c' => 'src', - 'cpp' => 'src', - 'in' => 'src', - 'm4' => 'src', - 'w32' => 'src', - 'dll' => 'ext', - 'php' => 'php', - 'html' => 'doc', - '*' => 'data', - ), - 'dir_roles' => - array( - 'docs' => 'doc', - 'examples' => 'doc', - 'tests' => 'test', - 'scripts' => 'script', - ), - 'exceptions' => array(), - 'installexceptions' => array(), - 'ignore' => array(), - 'include' => false, - 'notes' => '', - 'changelognotes' => false, - 'outputdirectory' => false, - 'pathtopackagefile' => false, - 'lang' => 'en', - 'configure_options' => array(), - 'replacements' => array(), - 'globalreplacements' => array(), - 'globalreplaceexceptions' => array(), - 'simpleoutput' => false, - 'addhiddenfiles' => false, - 'cleardependencies' => false, - 'clearcontents' => true, - 'clearchangelog' => false, - ); + 'packagefile' => 'package.xml', + 'filelistgenerator' => 'file', + 'license' => 'New BSD License', + 'baseinstalldir' => '', + 'changelogoldtonew' => true, + 'roles' => + array( + 'h' => 'src', + 'c' => 'src', + 'cpp' => 'src', + 'in' => 'src', + 'm4' => 'src', + 'w32' => 'src', + 'dll' => 'ext', + 'php' => 'php', + 'html' => 'doc', + '*' => 'data', + ), + 'dir_roles' => + array( + 'docs' => 'doc', + 'examples' => 'doc', + 'tests' => 'test', + 'scripts' => 'script', + ), + 'exceptions' => array(), + 'installexceptions' => array(), + 'ignore' => array(), + 'include' => false, + 'notes' => '', + 'changelognotes' => false, + 'outputdirectory' => false, + 'pathtopackagefile' => false, + 'lang' => 'en', + 'configure_options' => array(), + 'replacements' => array(), + 'globalreplacements' => array(), + 'globalreplaceexceptions' => array(), + 'simpleoutput' => false, + 'addhiddenfiles' => false, + 'cleardependencies' => false, + 'clearcontents' => true, + 'clearchangelog' => false, + ); /** - * Does nothing, use factory - * - * The constructor is not used in order to be able to - * return a PEAR_Error from setOptions - * * @see setOptions() * @access public * @since 1.0.0a1 */ - function PEAR_PackageFileManager2() + function __construct() { - parent::PEAR_PackageFile_v2(); + parent::__construct(); $config = &PEAR_Config::singleton(); $this->setConfig($config); } @@ -509,8 +503,8 @@ function setOptions($options = array(), $internal = false) } $options['packagedirectory'] = str_replace(DIRECTORY_SEPARATOR, - '/', - realpath($options['packagedirectory'])); + '/', + realpath($options['packagedirectory'])); if ($options['packagedirectory']{strlen($options['packagedirectory']) - 1} != '/') { $options['packagedirectory'] .= '/'; } @@ -521,8 +515,8 @@ function setOptions($options = array(), $internal = false) $options['pathtopackagefile']); } $options['pathtopackagefile'] = str_replace(DIRECTORY_SEPARATOR, - '/', - realpath($options['pathtopackagefile'])); + '/', + realpath($options['pathtopackagefile'])); if ($options['pathtopackagefile']{strlen($options['pathtopackagefile']) - 1} != '/') { $options['pathtopackagefile'] .= '/'; } @@ -535,8 +529,8 @@ function setOptions($options = array(), $internal = false) } $options['outputdirectory'] = str_replace(DIRECTORY_SEPARATOR, - '/', - realpath($options['outputdirectory'])); + '/', + realpath($options['outputdirectory'])); if ($options['outputdirectory']{strlen($options['outputdirectory']) - 1} != '/') { $options['outputdirectory'] .= '/'; } @@ -552,12 +546,12 @@ function setOptions($options = array(), $internal = false) } $path = ($this->_options['pathtopackagefile'] ? - $this->_options['pathtopackagefile'] : $this->_options['packagedirectory']); + $this->_options['pathtopackagefile'] : $this->_options['packagedirectory']); $this->_options['filelistgenerator'] = ucfirst(strtolower($this->_options['filelistgenerator'])); if (!$internal) { if (PEAR::isError($res = PEAR_PackageFileManager2::_getExistingPackageXML($path, - $this->_options['packagefile'], array('cleardependencies' => true)))) { + $this->_options['packagefile'], array('cleardependencies' => true)))) { return $res; } $this->_oldPackageFile = $res; @@ -581,8 +575,8 @@ function setOptions($options = array(), $internal = false) if (is_dir(realpath($this->_options['usergeneratordir']))) { $this->_options['usergeneratordir'] = str_replace(DIRECTORY_SEPARATOR, - '/', - realpath($this->_options['usergeneratordir'])); + '/', + realpath($this->_options['usergeneratordir'])); if ($this->_options['usergeneratordir']{strlen($this->_options['usergeneratordir']) - 1} != '/') { $this->_options['usergeneratordir'] .= '/'; } @@ -591,7 +585,7 @@ function setOptions($options = array(), $internal = false) } $generator = $this->_options['usergeneratordir'] . - ucfirst(strtolower($this->_options['filelistgenerator'])) . '.php'; + ucfirst(strtolower($this->_options['filelistgenerator'])) . '.php'; if (file_exists($generator) && is_readable($generator)) { include_once $generator; } @@ -663,7 +657,7 @@ function specifySubpackage(&$pm, $dependency = null, $required = false) * @access public * @since 1.0.0a1 */ - function &importFromPackageFile1($packagefile, $options = array()) + public static function &importFromPackageFile1($packagefile, $options = array()) { $z = &PEAR_Config::singleton(); $pkg = new PEAR_PackageFile($z); @@ -691,7 +685,7 @@ function &importFromPackageFile1($packagefile, $options = array()) * @access public * @since 1.0.0a1 */ - function &importOptions($packagefile, $options = array()) + public static function &importOptions($packagefile, $options = array()) { if (is_a($packagefile, 'PEAR_PackageFile_v1')) { $gen = &$packagefile->getDefaultGenerator(); @@ -715,7 +709,7 @@ function &importOptions($packagefile, $options = array()) if (!isset($res)) { $res = &PEAR_PackageFileManager2::_getExistingPackageXML(dirname($packagefile) . - DIRECTORY_SEPARATOR, basename($packagefile), $options); + DIRECTORY_SEPARATOR, basename($packagefile), $options); if (PEAR::isError($res)) { return $res; } @@ -1071,7 +1065,7 @@ function writePackageFile($debuginterface = null) } $outputdir = ($this->_options['outputdirectory'] ? - $this->_options['outputdirectory'] : $this->_options['packagedirectory']); + $this->_options['outputdirectory'] : $this->_options['packagedirectory']); $this->setPackagefile($this->_options['packagedirectory'] . $this->_options['packagefile']); if (!$this->validate($state)) { $errors = $this->getValidationWarnings(); @@ -1123,7 +1117,7 @@ function writePackageFile($debuginterface = null) } return $this->raiseError(PEAR_PACKAGEFILEMANAGER2_CANTOPEN_TMPPKGFILE, - $outputdir . $this->_options['packagefile'] . '.tmp'); + $outputdir . $this->_options['packagefile'] . '.tmp'); } return $this->raiseError(PEAR_PACKAGEFILEMANAGER2_DEST_UNWRITABLE, $outputdir); @@ -1161,7 +1155,7 @@ function debugPackageFile() function pushWarning($code, $info) { $this->_warningStack[] = array('code' => $code, - 'message' => $this->_getMessage($code, $info)); + 'message' => $this->_getMessage($code, $info)); } /** @@ -1207,15 +1201,14 @@ function _getMessage($code, $info) * @param string $i2 (optional) additional specific error info #2 * * @return PEAR_Error - * @static * @access public * @since 1.0.0a1 */ function raiseError($code, $i1 = '', $i2 = '') { return PEAR::raiseError('PEAR_PackageFileManager2 Error: ' . - sprintf($GLOBALS['_PEAR_PACKAGEFILEMANAGER2_ERRORS'][$this->_options['lang']][$code], - $i1, $i2), $code); + sprintf($GLOBALS['_PEAR_PACKAGEFILEMANAGER2_ERRORS'][$this->_options['lang']][$code], + $i1, $i2), $code); } /** @@ -1337,7 +1330,7 @@ function _getSimpleDirTag($struc, $role = false, $_curdir = '') $diradd = dirname($files['path']); $this->addFile($diradd == '.' ? '/' : $diradd, $files['file'], $atts); if (isset($globalreplacements) && - !in_array($files['path'], $globalreplaceexceptions, true)) { + !in_array($files['path'], $globalreplaceexceptions, true)) { foreach ($globalreplacements as $task) { $this->addTaskToFile($files['path'], $task); } @@ -1425,8 +1418,8 @@ function _getDirTag($struc, $role = false, $_curdir = '') } $atts = array('role' => $myrole, - 'baseinstalldir' => $bi, - ); + 'baseinstalldir' => $bi, + ); if (!isset($this->_options['simpleoutput']) || !$this->_options['simpleoutput']) { $md5sum = @md5_file($this->_options['packagedirectory'] . $files['path']); if (!empty($md5sum)) { @@ -1436,7 +1429,7 @@ function _getDirTag($struc, $role = false, $_curdir = '') $diradd = dirname($files['path']); $this->addFile($diradd == '.' ? '/' : $diradd, $files['file'], $atts); if (isset($globalreplacements) && - !in_array($files['path'], $globalreplaceexceptions, true)) { + !in_array($files['path'], $globalreplaceexceptions, true)) { foreach ($globalreplacements as $task) { $this->addTaskToFile($files['path'], $task); } @@ -1723,7 +1716,7 @@ function _stripNamespace($params) * @static * @since 1.0.0a1 */ - function &_getExistingPackageXML($path, $packagefile = 'package.xml', $options = array()) + protected static function &_getExistingPackageXML($path, $packagefile = 'package.xml', $options = array()) { if (is_string($path) && is_dir($path)) { $contents = false; @@ -1737,10 +1730,10 @@ function &_getExistingPackageXML($path, $packagefile = 'package.xml', $options = } include_once 'PEAR/PackageFile/Parser/v2.php'; - $pkg = &new PEAR_PackageFile_Parser_v2(); + $pkg = new PEAR_PackageFile_Parser_v2(); $z = &PEAR_Config::singleton(); $pkg->setConfig($z); - $pf = &$pkg->parse($contents, $path . $packagefile, false, + $pf = $pkg->parse($contents, $path . $packagefile, false, 'PEAR_PackageFileManager2'); if (PEAR::isError($pf)) { return $pf; @@ -1797,10 +1790,10 @@ function &_getExistingPackageXML($path, $packagefile = 'package.xml', $options = * @static * @since 1.0.0a1 */ - function &_generateNewPackageXML() + protected static function &_generateNewPackageXML() { - $pf = &new PEAR_PackageFileManager2(); + $pf = new PEAR_PackageFileManager2(); $pf->_oldPackageFile = false; return $pf; } -} \ No newline at end of file +} diff --git a/data/package/make.php b/data/package/make.php index d6d46e7..4c9dbae 100644 --- a/data/package/make.php +++ b/data/package/make.php @@ -14,7 +14,6 @@ error_reporting(0); require_once __DIR__ . '/PEAR/PackageFileManager2.php'; require_once 'PEAR.php'; -require_once 'PEAR/PackageFileManager2.php'; require '../../Panda.php'; error_reporting(E_ERROR); $config['package'] = 'Panda';