⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 registry.php

📁 php-4.4.7学习linux时下载的源代码
💻 PHP
📖 第 1 页 / 共 5 页
字号:
            return false;        }        if (PEAR::isError($e = $this->_lock(LOCK_EX))) {            return $e;        }        $ret = $this->_addChannel($channel, $update, $lastmodified);        $this->_unlock();        if (!$update && $ret && is_a($this->_config, 'PEAR_Config')) {            $this->_config->setChannels($this->listChannels());        }        return $ret;    }    // }}}    // {{{ deletePackage()    function deletePackage($package, $channel = 'pear.php.net')    {        if (PEAR::isError($e = $this->_lock(LOCK_EX))) {            return $e;        }        $file = $this->_packageFileName($package, $channel);        $ret = @unlink($file);        $this->_rebuildFileMap();        $this->_unlock();        $p = array('channel' => $channel, 'package' => $package);        $this->_dependencyDB->uninstallPackage($p);        return $ret;    }    // }}}    // {{{ updatePackage()    function updatePackage($package, $info, $merge = true)    {        if (is_object($info)) {            return $this->updatePackage2($info, $merge);        }        if (PEAR::isError($e = $this->_lock(LOCK_EX))) {            return $e;        }        $ret = $this->_updatePackage($package, $info, $merge);        $this->_unlock();        if ($ret) {            if (!class_exists('PEAR_PackageFile_v1')) {                require_once 'PEAR/PackageFile/v1.php';            }            $pf = new PEAR_PackageFile_v1;            $pf->setConfig($this->_config);            $pf->fromArray($this->packageInfo($package));            $this->_dependencyDB->uninstallPackage($pf);            $this->_dependencyDB->installPackage($pf);        }        return $ret;    }    // }}}    // {{{ updatePackage2()    function updatePackage2($info)    {        if (!is_object($info)) {            return $this->updatePackage($info['package'], $info, $merge);        }        if (!$info->validate(PEAR_VALIDATE_DOWNLOADING)) {            return false;        }        if (PEAR::isError($e = $this->_lock(LOCK_EX))) {            return $e;        }        $ret = $this->_updatePackage2($info);        $this->_unlock();        if ($ret) {            $this->_dependencyDB->uninstallPackage($info);            $this->_dependencyDB->installPackage($info);        }        return $ret;    }    // }}}    // {{{ getChannel()    /**     * @param string channel name     * @param bool whether to strictly return raw channels (no aliases)     * @return PEAR_ChannelFile|PEAR_Error     */    function &getChannel($channel, $noaliases = false)    {        if (PEAR::isError($e = $this->_lock(LOCK_SH))) {            return $e;        }        $ret = &$this->_getChannel($channel, $noaliases);        if (!$ret) {            return PEAR::raiseError('Unknown channel: ' . $channel);        }        $this->_unlock();        return $ret;    }    // }}}    // {{{ getPackage()    /**     * @param string package name     * @param string channel name     * @return PEAR_PackageFile_v1|PEAR_PackageFile_v2|null     */    function &getPackage($package, $channel = 'pear.php.net')    {        if (PEAR::isError($e = $this->_lock(LOCK_SH))) {            return $e;        }        $pf = &$this->_getPackage($package, $channel);        $this->_unlock();        return $pf;    }    // }}}    /**     * Get PEAR_PackageFile_v[1/2] objects representing the contents of     * a dependency group that are installed.     *     * This is used at uninstall-time     * @param array     * @return array|false     */    function getInstalledGroup($group)    {        $ret = array();        if (isset($group['package'])) {            if (!isset($group['package'][0])) {                $group['package'] = array($group['package']);            }            foreach ($group['package'] as $package) {                $depchannel = isset($package['channel']) ? $package['channel'] : '__uri';                $p = &$this->getPackage($package['name'], $depchannel);                if ($p) {                    $save = &$p;                    $ret[] = &$save;                }            }        }        if (isset($group['subpackage'])) {            if (!isset($group['subpackage'][0])) {                $group['subpackage'] = array($group['subpackage']);            }            foreach ($group['subpackage'] as $package) {                $depchannel = isset($package['channel']) ? $package['channel'] : '__uri';                $p = &$this->getPackage($package['name'], $depchannel);                if ($p) {                    $save = &$p;                    $ret[] = &$save;                }            }        }        if (!count($ret)) {            return false;        }        return $ret;    }    // {{{ getChannelValidator()    /**     * @param string channel name     * @return PEAR_Validate|false     */    function &getChannelValidator($channel)    {        $chan = $this->getChannel($channel);        if (PEAR::isError($chan)) {            return $chan;        }        $val = $chan->getValidationObject();        return $val;    }    // }}}    // {{{ getChannels()    /**     * @param string channel name     * @return array an array of PEAR_ChannelFile objects representing every installed channel     */    function &getChannels()    {        $ret = array();        if (PEAR::isError($e = $this->_lock(LOCK_SH))) {            return $e;        }        foreach ($this->_listChannels() as $channel) {            $e = &$this->_getChannel($channel);            if (!$e || PEAR::isError($e)) {                continue;            }            $ret[] = $e;        }        $this->_unlock();        return $ret;    }    // }}}    // {{{ checkFileMap()    /**     * Test whether a file or set of files belongs to a package.     *     * If an array is passed in     * @param string|array file path, absolute or relative to the pear     *                     install dir     * @param string|array name of PEAR package or array('package' => name, 'channel' =>     *                     channel) of a package that will be ignored     * @param string API version - 1.1 will exclude any files belonging to a package     * @param array private recursion variable     * @return array|false which package and channel the file belongs to, or an empty     *                     string if the file does not belong to an installed package,     *                     or belongs to the second parameter's package     */    function checkFileMap($path, $package = false, $api = '1.0', $attrs = false)    {        if (is_array($path)) {            static $notempty;            if (empty($notempty)) {                if (!class_exists('PEAR_Installer_Role')) {                    require_once 'PEAR/Installer/Role.php';                }                $notempty = create_function('$a','return !empty($a);');            }            $package = is_array($package) ? array(strtolower($package[0]), strtolower($package[1]))                : strtolower($package);            $pkgs = array();            foreach ($path as $name => $attrs) {                if (is_array($attrs)) {                    if (isset($attrs['install-as'])) {                        $name = $attrs['install-as'];                    }                    if (!in_array($attrs['role'], PEAR_Installer_Role::getInstallableRoles())) {                        // these are not installed                        continue;                    }                    if (!in_array($attrs['role'], PEAR_Installer_Role::getBaseinstallRoles())) {                        $attrs['baseinstalldir'] = is_array($package) ? $package[1] : $package;                    }                    if (isset($attrs['baseinstalldir'])) {                        $name = $attrs['baseinstalldir'] . DIRECTORY_SEPARATOR . $name;                    }                }                $pkgs[$name] = $this->checkFileMap($name, $package, $api, $attrs);                if (PEAR::isError($pkgs[$name])) {                    return $pkgs[$name];                }            }            return array_filter($pkgs, $notempty);        }        if (empty($this->filemap_cache)) {            if (PEAR::isError($e = $this->_lock(LOCK_SH))) {                return $e;            }            $err = $this->_readFileMap();            $this->_unlock();            if (PEAR::isError($err)) {                return $err;            }        }        if (!$attrs) {            $attrs = array('role' => 'php'); // any old call would be for PHP role only        }        if (isset($this->filemap_cache[$attrs['role']][$path])) {            if ($api >= '1.1' && $this->filemap_cache[$attrs['role']][$path] == $package) {                return false;            }            return $this->filemap_cache[$attrs['role']][$path];        }        $l = strlen($this->install_dir);        if (substr($path, 0, $l) == $this->install_dir) {            $path = preg_replace('!^'.DIRECTORY_SEPARATOR.'+!', '', substr($path, $l));        }        if (isset($this->filemap_cache[$attrs['role']][$path])) {            if ($api >= '1.1' && $this->filemap_cache[$attrs['role']][$path] == $package) {                return false;            }            return $this->filemap_cache[$attrs['role']][$path];        }        return false;    }    // }}}    // {{{ apiVersion()    /**     * Get the expected API version.  Channels API is version 1.1, as it is backwards     * compatible with 1.0     * @return string     */    function apiVersion()    {        return '1.1';    }    // }}}    /**     * Parse a package name, or validate a parsed package name array     * @param string|array pass in an array of format     *                     array(     *                      'package' => 'pname',     *                     ['channel' => 'channame',]     *                     ['version' => 'version',]     *                     ['state' => 'state',]     *                     ['group' => 'groupname'])     *                     or a string of format     *                     [channel://][channame/]pname[-version|-state][/group=groupname]     * @return array|PEAR_Error     */    function parsePackageName($param, $defaultchannel = 'pear.php.net')    {        $saveparam = $param;        if (is_array($param)) {            // convert to string for error messages            $saveparam = $this->parsedPackageNameToString($param);            // process the array            if (!isset($param['package'])) {                return PEAR::raiseError('parsePackageName(): array $param ' .                    'must contain a valid package name in index "param"',                    'package', null, null, $param);            }            if (!isset($param['uri'])) {                if (!isset($param['channel'])) {                    $param['channel'] = $defaultchannel;                }            } else {                $param['channel'] = '__uri';            }        } else {            $components = @parse_url($param);            if (isset($components['scheme'])) {                if ($components['scheme'] == 'http') {                    // uri package                    $param = array('uri' => $param, 'channel' => '__uri');                } elseif($components['scheme'] != 'channel') {                    return PEAR::raiseError('parsePackageName(): only channel:// uris may ' .                        'be downloaded, not "' . $param . '"', 'invalid', null, null, $param);                }            }            if (!isset($components['path'])) {                return PEAR::raiseError('parsePackageName(): array $param ' .                    'must contain a valid package name in "' . $param . '"',                    'package', null, null, $param);            }            if (isset($components['host'])) {                // remove the leading "/"                $components['path'] = substr($components['path'], 1);            }            if (!isset($components['scheme'])) {                if (strpos($components['path'], '/') !== false) {                    if ($components['path']{0} == '/') {                        return PEAR::raiseError('parsePackageName(): this is not ' .                            'a package name, it begins with "/" in "' . $param . '"',                            'invalid', null, null, $param);                    }                    $parts = explode('/', $components['path']);                    $components['host'] = array_shift($parts);                    if (count($parts) > 1) {                        $components['path'] = array_pop($parts);                        $components['host'] .= '/' . implode('/', $parts);                    } else {                        $components['path'] = implode('/', $parts);                    }                } else {                    $components['host'] = $defaultchannel;                }            } else {                if (strpos($components['path'], '/')) {                    $parts = explode('/', $components['path']);                    $components['path'] = array_pop($parts);                    $components['host'] .= '/' . implode('/', $parts);                }            }            if (is_array($param)) {                $param['package'] = $components['path'];            } else {                $param = array(                    'package' => $components['path']                    );                if (isset($components['host'])) {                    $param['channel'] = $components['host'];                }            }            if (isset($components['fragment'])) {                $param['group'] = $components['fragment'];            }            if (isset($components['user'])) {                $param['user'] = $components['user'];            }            if (isset($components['pass'])) {                $param['pass'] = $components['pass'];            }            if (isset($components['query'])) {                parse_str($components['query'], $param['opts']);            }            // check for extension            $pathinfo = pathinfo($param['package']);            if (isset($pathinfo['extension']) &&                  in_array(strtolower($pathinfo['extension']), array('tgz', 'tar'))) {                $param['extension'] = $pathinfo['extension'];                $param['package'] = substr

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -