Файловый менеджер - Редактировать - /home/skymarketplace/public_html/uploads/Task.zip
Назад
PK �~�Z�-! Common.phpnu �[��� <?php /** * PEAR_Task_Common, base class for installer tasks * * PHP versions 4 and 5 * * @category pear * @package PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /**#@+ * Error codes for task validation routines */ define('PEAR_TASK_ERROR_NOATTRIBS', 1); define('PEAR_TASK_ERROR_MISSING_ATTRIB', 2); define('PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE', 3); define('PEAR_TASK_ERROR_INVALID', 4); /**#@-*/ define('PEAR_TASK_PACKAGE', 1); define('PEAR_TASK_INSTALL', 2); define('PEAR_TASK_PACKAGEANDINSTALL', 3); /** * A task is an operation that manipulates the contents of a file. * * Simple tasks operate on 1 file. Multiple tasks are executed after all files have been * processed and installed, and are designed to operate on all files containing the task. * The Post-install script task simply takes advantage of the fact that it will be run * after installation, replace is a simple task. * * Combining tasks is possible, but ordering is significant. * * <file name="test.php" role="php"> * <tasks:replace from="@data-dir@" to="data_dir" type="pear-config"/> * <tasks:postinstallscript/> * </file> * * This will first replace any instance of @data-dir@ in the test.php file * with the path to the current data directory. Then, it will include the * test.php file and run the script it contains to configure the package post-installation. * * @category pear * @package PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: 1.10.16 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 * @abstract */ class PEAR_Task_Common { /** * Valid types for this version are 'simple' and 'multiple' * * - simple tasks operate on the contents of a file and write out changes to disk * - multiple tasks operate on the contents of many files and write out the * changes directly to disk * * Child task classes must override this property. * * @access protected */ protected $type = 'simple'; /** * Determines which install phase this task is executed under */ public $phase = PEAR_TASK_INSTALL; /** * @access protected */ protected $config; /** * @access protected */ protected $registry; /** * @access protected */ public $logger; /** * @access protected */ protected $installphase; /** * @param PEAR_Config * @param PEAR_Common */ function __construct(&$config, &$logger, $phase) { $this->config = &$config; $this->registry = &$config->getRegistry(); $this->logger = &$logger; $this->installphase = $phase; if ($this->type == 'multiple') { $GLOBALS['_PEAR_TASK_POSTINSTANCES'][get_class($this)][] = &$this; } } /** * Validate the basic contents of a task tag. * * @param PEAR_PackageFile_v2 * @param array * @param PEAR_Config * @param array the entire parsed <file> tag * * @return true|array On error, return an array in format: * array(PEAR_TASK_ERROR_???[, param1][, param2][, ...]) * * For PEAR_TASK_ERROR_MISSING_ATTRIB, pass the attribute name in * For PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, pass the attribute name and * an array of legal values in * * @abstract */ public static function validateXml($pkg, $xml, $config, $fileXml) { } /** * Initialize a task instance with the parameters * * @param array raw, parsed xml * @param array attributes from the <file> tag containing this task * @param string|null last installed version of this package * @abstract */ public function init($xml, $fileAttributes, $lastVersion) { } /** * Begin a task processing session. All multiple tasks will be processed * after each file has been successfully installed, all simple tasks should * perform their task here and return any errors using the custom * throwError() method to allow forward compatibility * * This method MUST NOT write out any changes to disk * * @param PEAR_PackageFile_v2 * @param string file contents * @param string the eventual final file location (informational only) * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail * (use $this->throwError), otherwise return the new contents * @abstract */ public function startSession($pkg, $contents, $dest) { } /** * This method is used to process each of the tasks for a particular * multiple class type. Simple tasks need not implement this method. * * @param array an array of tasks * @access protected */ public static function run($tasks) { } /** * @final */ public static function hasPostinstallTasks() { return isset($GLOBALS['_PEAR_TASK_POSTINSTANCES']); } /** * @final */ public static function runPostinstallTasks() { foreach ($GLOBALS['_PEAR_TASK_POSTINSTANCES'] as $class => $tasks) { $err = call_user_func( array($class, 'run'), $GLOBALS['_PEAR_TASK_POSTINSTANCES'][$class] ); if ($err) { return PEAR_Task_Common::throwError($err); } } unset($GLOBALS['_PEAR_TASK_POSTINSTANCES']); } /** * Determines whether a role is a script * @return bool */ public function isScript() { return $this->type == 'script'; } public function throwError($msg, $code = -1) { include_once 'PEAR.php'; return PEAR::raiseError($msg, $code); } } PK �~�Z& i. Postinstallscript/rw.phpnu �[��� <?php /** * <tasks:postinstallscript> - read/write version * * PHP versions 4 and 5 * * @category pear * @package PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a10 */ /** * Base class */ require_once 'PEAR/Task/Postinstallscript.php'; /** * Abstracts the postinstallscript file task xml. * @category pear * @package PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: 1.10.16 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a10 */ class PEAR_Task_Postinstallscript_rw extends PEAR_Task_Postinstallscript { /** * parent package file object * * @var PEAR_PackageFile_v2_rw */ public $_pkg; /** * Enter description here... * * @param PEAR_PackageFile_v2_rw $pkg Package * @param PEAR_Config $config Config * @param PEAR_Frontend $logger Logger * @param array $fileXml XML * * @return PEAR_Task_Postinstallscript_rw */ function __construct(&$pkg, &$config, &$logger, $fileXml) { parent::__construct($config, $logger, PEAR_TASK_PACKAGE); $this->_contents = $fileXml; $this->_pkg = &$pkg; $this->_params = array(); } public function validate() { return $this->validateXml($this->_pkg, $this->_params, $this->config, $this->_contents); } public function getName() { return 'postinstallscript'; } /** * add a simple <paramgroup> to the post-install script * * Order is significant, so call this method in the same * sequence the users should see the paramgroups. The $params * parameter should either be the result of a call to {@link getParam()} * or an array of calls to getParam(). * * Use {@link addConditionTypeGroup()} to add a <paramgroup> containing * a <conditiontype> tag * * @param string $id <paramgroup> id as seen by the script * @param array|false $params array of getParam() calls, or false for no params * @param string|false $instructions */ public function addParamGroup($id, $params = false, $instructions = false) { if ($params && isset($params[0]) && !isset($params[1])) { $params = $params[0]; } $stuff = array( $this->_pkg->getTasksNs().':id' => $id, ); if ($instructions) { $stuff[$this->_pkg->getTasksNs().':instructions'] = $instructions; } if ($params) { $stuff[$this->_pkg->getTasksNs().':param'] = $params; } $this->_params[$this->_pkg->getTasksNs().':paramgroup'][] = $stuff; } /** * Add a complex <paramgroup> to the post-install script with conditions * * This inserts a <paramgroup> with * * Order is significant, so call this method in the same * sequence the users should see the paramgroups. The $params * parameter should either be the result of a call to {@link getParam()} * or an array of calls to getParam(). * * Use {@link addParamGroup()} to add a simple <paramgroup> * * @param string $id <paramgroup> id as seen by the script * @param string $oldgroup <paramgroup> id of the section referenced by * <conditiontype> * @param string $param name of the <param> from the older section referenced * by <contitiontype> * @param string $value value to match of the parameter * @param string $conditiontype one of '=', '!=', 'preg_match' * @param array|false $params array of getParam() calls, or false for no params * @param string|false $instructions */ public function addConditionTypeGroup($id, $oldgroup, $param, $value, $conditiontype = '=', $params = false, $instructions = false ) { if ($params && isset($params[0]) && !isset($params[1])) { $params = $params[0]; } $stuff = array( $this->_pkg->getTasksNs().':id' => $id, ); if ($instructions) { $stuff[$this->_pkg->getTasksNs().':instructions'] = $instructions; } $stuff[$this->_pkg->getTasksNs().':name'] = $oldgroup.'::'.$param; $stuff[$this->_pkg->getTasksNs().':conditiontype'] = $conditiontype; $stuff[$this->_pkg->getTasksNs().':value'] = $value; if ($params) { $stuff[$this->_pkg->getTasksNs().':param'] = $params; } $this->_params[$this->_pkg->getTasksNs().':paramgroup'][] = $stuff; } public function getXml() { return $this->_params; } /** * Use to set up a param tag for use in creating a paramgroup * * @param mixed $name Name of parameter * @param mixed $prompt Prompt * @param string $type Type, defaults to 'string' * @param mixed $default Default value * * @return array */ public function getParam( $name, $prompt, $type = 'string', $default = null ) { if ($default !== null) { return array( $this->_pkg->getTasksNs().':name' => $name, $this->_pkg->getTasksNs().':prompt' => $prompt, $this->_pkg->getTasksNs().':type' => $type, $this->_pkg->getTasksNs().':default' => $default, ); } return array( $this->_pkg->getTasksNs().':name' => $name, $this->_pkg->getTasksNs().':prompt' => $prompt, $this->_pkg->getTasksNs().':type' => $type, ); } } PK �~�ZZ�E�x9 x9 Postinstallscript.phpnu �[��� <?php /** * <tasks:postinstallscript> * * PHP versions 4 and 5 * * @category pear * @package PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * Base class */ require_once 'PEAR/Task/Common.php'; /** * Implements the postinstallscript file task. * * Note that post-install scripts are handled separately from installation, by the * "pear run-scripts" command * * @category pear * @package PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: 1.10.16 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Task_Postinstallscript extends PEAR_Task_Common { public $type = 'script'; public $_class; public $_params; public $_obj; /** * * @var PEAR_PackageFile_v2 */ public $_pkg; public $_contents; public $phase = PEAR_TASK_INSTALL; /** * Validate the raw xml at parsing-time. * * This also attempts to validate the script to make sure it meets the criteria * for a post-install script * * @param PEAR_PackageFile_v2 * @param array The XML contents of the <postinstallscript> tag * @param PEAR_Config * @param array the entire parsed <file> tag */ public static function validateXml($pkg, $xml, $config, $fileXml) { if ($fileXml['role'] != 'php') { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" must be role="php"', ); } PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $file = $pkg->getFileContents($fileXml['name']); if (PEAR::isError($file)) { PEAR::popErrorHandling(); return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" is not valid: '. $file->getMessage(), ); } elseif ($file === null) { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" could not be retrieved for processing!', ); } else { $analysis = $pkg->analyzeSourceCode($file, true); if (!$analysis) { PEAR::popErrorHandling(); $warnings = ''; foreach ($pkg->getValidationWarnings() as $warn) { $warnings .= $warn['message']."\n"; } return array(PEAR_TASK_ERROR_INVALID, 'Analysis of post-install script "'. $fileXml['name'].'" failed: '.$warnings, ); } if (count($analysis['declared_classes']) != 1) { PEAR::popErrorHandling(); return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" must declare exactly 1 class', ); } $class = $analysis['declared_classes'][0]; if ($class != str_replace( array('/', '.php'), array('_', ''), $fileXml['name'] ).'_postinstall') { PEAR::popErrorHandling(); return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" class "'.$class.'" must be named "'. str_replace( array('/', '.php'), array('_', ''), $fileXml['name'] ).'_postinstall"', ); } if (!isset($analysis['declared_methods'][$class])) { PEAR::popErrorHandling(); return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" must declare methods init() and run()', ); } $methods = array('init' => 0, 'run' => 1); foreach ($analysis['declared_methods'][$class] as $method) { if (isset($methods[$method])) { unset($methods[$method]); } } if (count($methods)) { PEAR::popErrorHandling(); return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" must declare methods init() and run()', ); } } PEAR::popErrorHandling(); $definedparams = array(); $tasksNamespace = $pkg->getTasksNs().':'; if (!isset($xml[$tasksNamespace.'paramgroup']) && isset($xml['paramgroup'])) { // in order to support the older betas, which did not expect internal tags // to also use the namespace $tasksNamespace = ''; } if (isset($xml[$tasksNamespace.'paramgroup'])) { $params = $xml[$tasksNamespace.'paramgroup']; if (!is_array($params) || !isset($params[0])) { $params = array($params); } foreach ($params as $param) { if (!isset($param[$tasksNamespace.'id'])) { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" <paramgroup> must have '. 'an '.$tasksNamespace.'id> tag', ); } if (isset($param[$tasksNamespace.'name'])) { if (!in_array($param[$tasksNamespace.'name'], $definedparams)) { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" '.$tasksNamespace. 'paramgroup> id "'.$param[$tasksNamespace.'id']. '" parameter "'.$param[$tasksNamespace.'name']. '" has not been previously defined', ); } if (!isset($param[$tasksNamespace.'conditiontype'])) { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" '.$tasksNamespace. 'paramgroup> id "'.$param[$tasksNamespace.'id']. '" must have a '.$tasksNamespace. 'conditiontype> tag containing either "=", '. '"!=", or "preg_match"', ); } if (!in_array( $param[$tasksNamespace.'conditiontype'], array('=', '!=', 'preg_match') )) { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" '.$tasksNamespace. 'paramgroup> id "'.$param[$tasksNamespace.'id']. '" must have a '.$tasksNamespace. 'conditiontype> tag containing either "=", '. '"!=", or "preg_match"', ); } if (!isset($param[$tasksNamespace.'value'])) { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" '.$tasksNamespace. 'paramgroup> id "'.$param[$tasksNamespace.'id']. '" must have a '.$tasksNamespace. 'value> tag containing expected parameter value', ); } } if (isset($param[$tasksNamespace.'instructions'])) { if (!is_string($param[$tasksNamespace.'instructions'])) { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" '.$tasksNamespace. 'paramgroup> id "'.$param[$tasksNamespace.'id']. '" '.$tasksNamespace.'instructions> must be simple text', ); } } if (!isset($param[$tasksNamespace.'param'])) { continue; // <param> is no longer required } $subparams = $param[$tasksNamespace.'param']; if (!is_array($subparams) || !isset($subparams[0])) { $subparams = array($subparams); } foreach ($subparams as $subparam) { if (!isset($subparam[$tasksNamespace.'name'])) { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" parameter for '. $tasksNamespace.'paramgroup> id "'. $param[$tasksNamespace.'id'].'" must have '. 'a '.$tasksNamespace.'name> tag', ); } if (!preg_match( '/[a-zA-Z0-9]+/', $subparam[$tasksNamespace.'name'] )) { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" parameter "'. $subparam[$tasksNamespace.'name']. '" for '.$tasksNamespace.'paramgroup> id "'. $param[$tasksNamespace.'id']. '" is not a valid name. Must contain only alphanumeric characters', ); } if (!isset($subparam[$tasksNamespace.'prompt'])) { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" parameter "'. $subparam[$tasksNamespace.'name']. '" for '.$tasksNamespace.'paramgroup> id "'. $param[$tasksNamespace.'id']. '" must have a '.$tasksNamespace.'prompt> tag', ); } if (!isset($subparam[$tasksNamespace.'type'])) { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" parameter "'. $subparam[$tasksNamespace.'name']. '" for '.$tasksNamespace.'paramgroup> id "'. $param[$tasksNamespace.'id']. '" must have a '.$tasksNamespace.'type> tag', ); } $definedparams[] = $param[$tasksNamespace.'id'].'::'. $subparam[$tasksNamespace.'name']; } } } return true; } /** * Initialize a task instance with the parameters * @param array $xml raw, parsed xml * @param array $fileattribs attributes from the <file> tag containing * this task * @param string|null $lastversion last installed version of this package, * if any (useful for upgrades) */ public function init($xml, $fileattribs, $lastversion) { $this->_class = str_replace('/', '_', $fileattribs['name']); $this->_filename = $fileattribs['name']; $this->_class = str_replace('.php', '', $this->_class).'_postinstall'; $this->_params = $xml; $this->_lastversion = $lastversion; } /** * Strip the tasks: namespace from internal params * * @access private */ public function _stripNamespace($params = null) { if ($params === null) { $params = array(); if (!is_array($this->_params)) { return; } foreach ($this->_params as $i => $param) { if (is_array($param)) { $param = $this->_stripNamespace($param); } $params[str_replace($this->_pkg->getTasksNs().':', '', $i)] = $param; } $this->_params = $params; } else { $newparams = array(); foreach ($params as $i => $param) { if (is_array($param)) { $param = $this->_stripNamespace($param); } $newparams[str_replace($this->_pkg->getTasksNs().':', '', $i)] = $param; } return $newparams; } } /** * Unlike other tasks, the installed file name is passed in instead of the * file contents, because this task is handled post-installation * * @param mixed $pkg PEAR_PackageFile_v1|PEAR_PackageFile_v2 * @param string $contents file name * @param string $dest the eventual final file location (informational only) * * @return bool|PEAR_Error false to skip this file, PEAR_Error to fail * (use $this->throwError) */ public function startSession($pkg, $contents, $dest) { if ($this->installphase != PEAR_TASK_INSTALL) { return false; } // remove the tasks: namespace if present $this->_pkg = $pkg; $this->_stripNamespace(); $this->logger->log( 0, 'Including external post-installation script "'. $contents.'" - any errors are in this script' ); include_once $contents; if (class_exists($this->_class)) { $this->logger->log(0, 'Inclusion succeeded'); } else { return $this->throwError( 'init of post-install script class "'.$this->_class .'" failed' ); } $this->_obj = new $this->_class(); $this->logger->log(1, 'running post-install script "'.$this->_class.'->init()"'); PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $res = $this->_obj->init($this->config, $pkg, $this->_lastversion); PEAR::popErrorHandling(); if ($res) { $this->logger->log(0, 'init succeeded'); } else { return $this->throwError( 'init of post-install script "'.$this->_class. '->init()" failed' ); } $this->_contents = $contents; return true; } /** * No longer used * * @see PEAR_PackageFile_v2::runPostinstallScripts() * @param array an array of tasks * @param string install or upgrade * @access protected */ public static function run($tasks) { } } PK �~�Z�3} Replace/rw.phpnu �[��� <?php /** * <tasks:replace> - read/write version * * PHP versions 4 and 5 * * @category pear * @package PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a10 */ /** * Base class */ require_once 'PEAR/Task/Replace.php'; /** * Abstracts the replace task xml. * @category pear * @package PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: 1.10.16 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a10 */ class PEAR_Task_Replace_rw extends PEAR_Task_Replace { public function __construct(&$pkg, &$config, &$logger, $fileXml) { parent::__construct($config, $logger, PEAR_TASK_PACKAGE); $this->_contents = $fileXml; $this->_pkg = &$pkg; $this->_params = array(); } public function validate() { return $this->validateXml($this->_pkg, $this->_params, $this->config, $this->_contents); } public function setInfo($from, $to, $type) { $this->_params = array('attribs' => array('from' => $from, 'to' => $to, 'type' => $type)); } public function getName() { return 'replace'; } public function getXml() { return $this->_params; } } PK �~�Z�JD� � Replace.phpnu �[��� <?php /** * <tasks:replace> * * PHP versions 4 and 5 * * @category pear * @package PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * Base class */ require_once 'PEAR/Task/Common.php'; /** * Implements the replace file task. * @category pear * @package PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: 1.10.16 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Task_Replace extends PEAR_Task_Common { public $type = 'simple'; public $phase = PEAR_TASK_PACKAGEANDINSTALL; public $_replacements; /** * Validate the raw xml at parsing-time. * * @param PEAR_PackageFile_v2 * @param array raw, parsed xml * @param PEAR_Config */ public static function validateXml($pkg, $xml, $config, $fileXml) { if (!isset($xml['attribs'])) { return array(PEAR_TASK_ERROR_NOATTRIBS); } if (!isset($xml['attribs']['type'])) { return array(PEAR_TASK_ERROR_MISSING_ATTRIB, 'type'); } if (!isset($xml['attribs']['to'])) { return array(PEAR_TASK_ERROR_MISSING_ATTRIB, 'to'); } if (!isset($xml['attribs']['from'])) { return array(PEAR_TASK_ERROR_MISSING_ATTRIB, 'from'); } if ($xml['attribs']['type'] == 'pear-config') { if (!in_array($xml['attribs']['to'], $config->getKeys())) { return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'to', $xml['attribs']['to'], $config->getKeys(), ); } } elseif ($xml['attribs']['type'] == 'php-const') { if (defined($xml['attribs']['to'])) { return true; } else { return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'to', $xml['attribs']['to'], array('valid PHP constant'), ); } } elseif ($xml['attribs']['type'] == 'package-info') { if (in_array( $xml['attribs']['to'], array('name', 'summary', 'channel', 'notes', 'extends', 'description', 'release_notes', 'license', 'release-license', 'license-uri', 'version', 'api-version', 'state', 'api-state', 'release_date', 'date', 'time', ) )) { return true; } else { return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'to', $xml['attribs']['to'], array('name', 'summary', 'channel', 'notes', 'extends', 'description', 'release_notes', 'license', 'release-license', 'license-uri', 'version', 'api-version', 'state', 'api-state', 'release_date', 'date', 'time', ), ); } } else { return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'type', $xml['attribs']['type'], array('pear-config', 'package-info', 'php-const'), ); } return true; } /** * Initialize a task instance with the parameters * @param array raw, parsed xml * @param unused * @param unused */ public function init($xml, $attribs, $lastVersion = null) { $this->_replacements = isset($xml['attribs']) ? array($xml) : $xml; } /** * Do a package.xml 1.0 replacement, with additional package-info fields available * * See validateXml() source for the complete list of allowed fields * * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 * @param string file contents * @param string the eventual final file location (informational only) * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail * (use $this->throwError), otherwise return the new contents */ public function startSession($pkg, $contents, $dest) { $subst_from = $subst_to = array(); foreach ($this->_replacements as $a) { $a = $a['attribs']; $to = ''; if ($a['type'] == 'pear-config') { if ($this->installphase == PEAR_TASK_PACKAGE) { return false; } if ($a['to'] == 'master_server') { $chan = $this->registry->getChannel($pkg->getChannel()); if (!PEAR::isError($chan)) { $to = $chan->getServer(); } else { $this->logger->log(0, "$dest: invalid pear-config replacement: $a[to]"); return false; } } else { if ($this->config->isDefinedLayer('ftp')) { // try the remote config file first $to = $this->config->get($a['to'], 'ftp', $pkg->getChannel()); if (is_null($to)) { // then default to local $to = $this->config->get($a['to'], null, $pkg->getChannel()); } } else { $to = $this->config->get($a['to'], null, $pkg->getChannel()); } } if (is_null($to)) { $this->logger->log(0, "$dest: invalid pear-config replacement: $a[to]"); return false; } } elseif ($a['type'] == 'php-const') { if ($this->installphase == PEAR_TASK_PACKAGE) { return false; } if (defined($a['to'])) { $to = constant($a['to']); } else { $this->logger->log(0, "$dest: invalid php-const replacement: $a[to]"); return false; } } else { if ($t = $pkg->packageInfo($a['to'])) { $to = $t; } else { $this->logger->log(0, "$dest: invalid package-info replacement: $a[to]"); return false; } } if (!is_null($to)) { $subst_from[] = $a['from']; $subst_to[] = $to; } } $this->logger->log( 3, "doing ".sizeof($subst_from). " substitution(s) for $dest" ); if (sizeof($subst_from)) { $contents = str_replace($subst_from, $subst_to, $contents); } return $contents; } } PK �~�Z\k�� Unixeol/rw.phpnu �[��� <?php /** * <tasks:unixeol> - read/write version * * PHP versions 4 and 5 * * @category pear * @package PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a10 */ /** * Base class */ require_once 'PEAR/Task/Unixeol.php'; /** * Abstracts the unixeol task xml. * @category pear * @package PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: 1.10.16 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a10 */ class PEAR_Task_Unixeol_rw extends PEAR_Task_Unixeol { function __construct(&$pkg, &$config, &$logger, $fileXml) { parent::__construct($config, $logger, PEAR_TASK_PACKAGE); $this->_contents = $fileXml; $this->_pkg = &$pkg; $this->_params = array(); } public function validate() { return true; } public function getName() { return 'unixeol'; } public function getXml() { return ''; } } ?> PK �~�Z���� � Unixeol.phpnu �[��� <?php /** * <tasks:unixeol> * * PHP versions 4 and 5 * * @category pear * @package PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * Base class */ require_once 'PEAR/Task/Common.php'; /** * Implements the unix line endings file task. * @category pear * @package PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: 1.10.16 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Task_Unixeol extends PEAR_Task_Common { public $type = 'simple'; public $phase = PEAR_TASK_PACKAGE; public $_replacements; /** * Validate the raw xml at parsing-time. * * @param PEAR_PackageFile_v2 * @param array raw, parsed xml * @param PEAR_Config */ public static function validateXml($pkg, $xml, $config, $fileXml) { if ($xml != '') { return array(PEAR_TASK_ERROR_INVALID, 'no attributes allowed'); } return true; } /** * Initialize a task instance with the parameters * @param array raw, parsed xml * @param unused * @param unused */ public function init($xml, $attribs, $lastVersion = null) { } /** * Replace all line endings with line endings customized for the current OS * * See validateXml() source for the complete list of allowed fields * * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 * @param string file contents * @param string the eventual final file location (informational only) * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail * (use $this->throwError), otherwise return the new contents */ public function startSession($pkg, $contents, $dest) { $this->logger->log(3, "replacing all line endings with \\n in $dest"); return preg_replace("/\r\n|\n\r|\r|\n/", "\n", $contents); } } PK �~�Z&%75) ) Windowseol/rw.phpnu �[��� <?php /** * <tasks:windowseol> - read/write version * * PHP versions 4 and 5 * * @category pear * @package PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a10 */ /** * Base class */ require_once 'PEAR/Task/Windowseol.php'; /** * Abstracts the windowseol task xml. * * @category pear * @package PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: 1.10.16 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a10 */ class PEAR_Task_Windowseol_rw extends PEAR_Task_Windowseol { function __construct(&$pkg, &$config, &$logger, $fileXml) { parent::__construct($config, $logger, PEAR_TASK_PACKAGE); $this->_contents = $fileXml; $this->_pkg = &$pkg; $this->_params = array(); } public function validate() { return true; } public function getName() { return 'windowseol'; } public function getXml() { return ''; } } ?> PK �~�ZD$�� � Windowseol.phpnu �[��� <?php /** * <tasks:windowseol> * * PHP versions 4 and 5 * * @category pear * @package PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * Base class */ require_once 'PEAR/Task/Common.php'; /** * Implements the windows line endsings file task. * * @category pear * @package PEAR * @author Greg Beaver <cellog@php.net> * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: 1.10.16 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Task_Windowseol extends PEAR_Task_Common { public $type = 'simple'; public $phase = PEAR_TASK_PACKAGE; public $_replacements; /** * Validate the raw xml at parsing-time. * * @param PEAR_PackageFile_v2 * @param array raw, parsed xml * @param PEAR_Config */ public static function validateXml($pkg, $xml, $config, $fileXml) { if ($xml != '') { return array(PEAR_TASK_ERROR_INVALID, 'no attributes allowed'); } return true; } /** * Initialize a task instance with the parameters * @param array raw, parsed xml * @param unused * @param unused */ public function init($xml, $attribs, $lastVersion = null) { } /** * Replace all line endings with windows line endings * * See validateXml() source for the complete list of allowed fields * * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 * @param string file contents * @param string the eventual final file location (informational only) * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail * (use $this->throwError), otherwise return the new contents */ public function startSession($pkg, $contents, $dest) { $this->logger->log(3, "replacing all line endings with \\r\\n in $dest"); return preg_replace("/\r\n|\n\r|\r|\n/", "\r\n", $contents); } } PK �~�Z�-! Common.phpnu �[��� PK �~�Z& i. Y Postinstallscript/rw.phpnu �[��� PK �~�ZZ�E�x9 x9 �0 Postinstallscript.phpnu �[��� PK �~�Z�3} zj Replace/rw.phpnu �[��� PK �~�Z�JD� � �p Replace.phpnu �[��� PK �~�Z\k�� � Unixeol/rw.phpnu �[��� PK �~�Z���� � ]� Unixeol.phpnu �[��� PK �~�Z&%75) ) �� Windowseol/rw.phpnu �[��� PK �~�ZD$�� � � Windowseol.phpnu �[��� PK � 2�
| ver. 1.4 |
Github
|
.
| PHP 8.1.31 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка