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

📄 config.php

📁 php-4.4.7学习linux时下载的源代码
💻 PHP
📖 第 1 页 / 共 5 页
字号:
            'default' => PEAR_CONFIG_DEFAULT_TEST_DIR,            'doc' => 'directory where regression tests are installed',            'prompt' => 'PEAR test directory',            'group' => 'File Locations (Advanced)',            ),        'cache_dir' => array(            'type' => 'directory',            'default' => PEAR_CONFIG_DEFAULT_CACHE_DIR,            'doc' => 'directory which is used for XMLRPC cache',            'prompt' => 'PEAR Installer cache directory',            'group' => 'File Locations (Advanced)',            ),        'php_bin' => array(            'type' => 'file',            'default' => PEAR_CONFIG_DEFAULT_PHP_BIN,            'doc' => 'PHP CLI/CGI binary for executing scripts',            'prompt' => 'PHP CLI/CGI binary',            'group' => 'File Locations (Advanced)',            ),        // Maintainers        'username' => array(            'type' => 'string',            'default' => '',            'doc' => '(maintainers) your PEAR account name',            'prompt' => 'PEAR username (for maintainers)',            'group' => 'Maintainers',            ),        'password' => array(            'type' => 'password',            'default' => '',            'doc' => '(maintainers) your PEAR account password',            'prompt' => 'PEAR password (for maintainers)',            'group' => 'Maintainers',            ),        // Advanced        'verbose' => array(            'type' => 'integer',            'default' => PEAR_CONFIG_DEFAULT_VERBOSE,            'doc' => 'verbosity level0: really quiet1: somewhat quiet2: verbose3: debug',            'prompt' => 'Debug Log Level',            'group' => 'Advanced',            ),        'preferred_state' => array(            'type' => 'set',            'default' => PEAR_CONFIG_DEFAULT_PREFERRED_STATE,            'doc' => 'the installer will prefer releases with this state when installing packages without a version or state specified',            'valid_set' => array(                'stable', 'beta', 'alpha', 'devel', 'snapshot'),            'prompt' => 'Preferred Package State',            'group' => 'Advanced',            ),        'umask' => array(            'type' => 'mask',            'default' => PEAR_CONFIG_DEFAULT_UMASK,            'doc' => 'umask used when creating files (Unix-like systems only)',            'prompt' => 'Unix file mask',            'group' => 'Advanced',            ),        'cache_ttl' => array(            'type' => 'integer',            'default' => PEAR_CONFIG_DEFAULT_CACHE_TTL,            'doc' => 'amount of secs where the local cache is used and not updated',            'prompt' => 'Cache TimeToLive',            'group' => 'Advanced',            ),        'sig_type' => array(            'type' => 'set',            'default' => PEAR_CONFIG_DEFAULT_SIG_TYPE,            'doc' => 'which package signature mechanism to use',            'valid_set' => array('gpg'),            'prompt' => 'Package Signature Type',            'group' => 'Maintainers',            ),        'sig_bin' => array(            'type' => 'string',            'default' => PEAR_CONFIG_DEFAULT_SIG_BIN,            'doc' => 'which package signature mechanism to use',            'prompt' => 'Signature Handling Program',            'group' => 'Maintainers',            ),        'sig_keyid' => array(            'type' => 'string',            'default' => '',            'doc' => 'which key to use for signing with',            'prompt' => 'Signature Key Id',            'group' => 'Maintainers',            ),        'sig_keydir' => array(            'type' => 'directory',            'default' => PEAR_CONFIG_DEFAULT_SIG_KEYDIR,            'doc' => 'directory where signature keys are located',            'prompt' => 'Signature Key Directory',            'group' => 'Maintainers',            ),        // __channels is reserved - used for channel-specific configuration        );    // }}}    // {{{ PEAR_Config([file], [defaults_file])    /**     * Constructor.     *     * @param string file to read user-defined options from     * @param string file to read system-wide defaults from     * @param bool   determines whether a registry object "follows"     *               the value of php_dir (is automatically created     *               and moved when php_dir is changed)     * @param bool   if true, fails if configuration files cannot be loaded     *     * @access public     *     * @see PEAR_Config::singleton     */    function PEAR_Config($user_file = '', $system_file = '', $ftp_file = false,                         $strict = true)    {        $this->PEAR();        PEAR_Installer_Role::initializeConfig($this);        $sl = DIRECTORY_SEPARATOR;        if (empty($user_file)) {            if (OS_WINDOWS) {                $user_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.ini';            } else {                $user_file = getenv('HOME') . $sl . '.pearrc';            }        }        if (empty($system_file)) {            if (OS_WINDOWS) {                $system_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pearsys.ini';            } else {                $system_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.conf';            }        }        $this->layers = array_keys($this->configuration);        $this->files['user'] = $user_file;        $this->files['system'] = $system_file;        if ($user_file && @file_exists($user_file)) {            $this->pushErrorHandling(PEAR_ERROR_RETURN);            $this->readConfigFile($user_file, 'user', $strict);            $this->popErrorHandling();            if ($this->_errorsFound > 0) {                return;            }        }        if ($system_file && @file_exists($system_file)) {            $this->mergeConfigFile($system_file, false, 'system', $strict);            if ($this->_errorsFound > 0) {                return;            }        }        if (!$ftp_file) {            $ftp_file = $this->get('remote_config');        }        if ($ftp_file && defined('PEAR_REMOTEINSTALL_OK')) {            $this->readFTPConfigFile($ftp_file);        }        foreach ($this->configuration_info as $key => $info) {            $this->configuration['default'][$key] = $info['default'];        }        $this->_registry['default'] = &new PEAR_Registry($this->configuration['default']['php_dir']);        $this->_registry['default']->setConfig($this);        $this->_regInitialized['default'] = false;        //$GLOBALS['_PEAR_Config_instance'] = &$this;    }    // }}}    // {{{ singleton([file], [defaults_file])    /**     * Static singleton method.  If you want to keep only one instance     * of this class in use, this method will give you a reference to     * the last created PEAR_Config object if one exists, or create a     * new object.     *     * @param string (optional) file to read user-defined options from     * @param string (optional) file to read system-wide defaults from     *     * @return object an existing or new PEAR_Config instance     *     * @access public     *     * @see PEAR_Config::PEAR_Config     */    function &singleton($user_file = '', $system_file = '', $strict = true)    {        if (is_object($GLOBALS['_PEAR_Config_instance'])) {            return $GLOBALS['_PEAR_Config_instance'];        }        $t_conf = &new PEAR_Config($user_file, $system_file, false, $strict);        if ($t_conf->_errorsFound > 0) {             return $t_conf->lastError;        }        $GLOBALS['_PEAR_Config_instance'] = &$t_conf;        return $GLOBALS['_PEAR_Config_instance'];    }    // }}}    // {{{ validConfiguration()    /**     * Determine whether any configuration files have been detected, and whether a     * registry object can be retrieved from this configuration.     * @return bool     * @since PEAR 1.4.0a1     */    function validConfiguration()    {        if ($this->isDefinedLayer('user') || $this->isDefinedLayer('system')) {            return true;        }        return false;    }    // }}}    // {{{ readConfigFile([file], [layer])    /**     * Reads configuration data from a file.  All existing values in     * the config layer are discarded and replaced with data from the     * file.     * @param string file to read from, if NULL or not specified, the     *               last-used file for the same layer (second param) is used     * @param string config layer to insert data into ('user' or 'system')     * @return bool TRUE on success or a PEAR error on failure     */    function readConfigFile($file = null, $layer = 'user', $strict = true)    {        if (empty($this->files[$layer])) {            return $this->raiseError("unknown config layer `$layer'");        }        if ($file === null) {            $file = $this->files[$layer];        }        $data = $this->_readConfigDataFrom($file);        if (PEAR::isError($data)) {            if ($strict) {                $this->_errorsFound++;                $this->lastError = $data;                return $data;            } else {                return true;            }        } else {            $this->files[$layer] = $file;        }        $this->_decodeInput($data);        $this->configuration[$layer] = $data;        $this->_setupChannels();        if (!$this->_noRegistry && ($phpdir = $this->get('php_dir', $layer, 'pear.php.net'))) {            $this->_registry[$layer] = &new PEAR_Registry($phpdir);            $this->_registry[$layer]->setConfig($this);            $this->_regInitialized[$layer] = false;        } else {            unset($this->_registry[$layer]);        }        return true;    }    // }}}    /**     * @param string url to the remote config file, like ftp://www.example.com/pear/config.ini     * @return true|PEAR_Error     */    function readFTPConfigFile($path)    {        do { // poor man's try            if (!class_exists('Net_FTP')) {                if (!class_exists('PEAR_Common')) {                    require_once 'PEAR/Common.php';                }                if (PEAR_Common::isIncludeable('Net/FTP.php')) {                    include_once 'Net/FTP.php';                }            }            if (class_exists('Net_FTP') &&                  (class_exists('PEAR_FTP') || PEAR_Common::isIncludeable('PEAR/FTP.php'))) {                require_once 'PEAR/FTP.php';                $this->_ftp = &new PEAR_FTP;                $this->_ftp->pushErrorHandling(PEAR_ERROR_RETURN);                $e = $this->_ftp->init($path);                if (PEAR::isError($e)) {                    $this->_ftp->popErrorHandling();                    return $e;                }                $tmp = System::mktemp('-d');                PEAR_Common::addTempFile($tmp);                $e = $this->_ftp->get(basename($path), $tmp . DIRECTORY_SEPARATOR .                    'pear.ini', false, FTP_BINARY);                if (PEAR::isError($e)) {                    $this->_ftp->popErrorHandling();                    return $e;                }                PEAR_Common::addTempFile($tmp . DIRECTORY_SEPARATOR . 'pear.ini');                $this->_ftp->disconnect();                $this->_ftp->popErrorHandling();                $this->files['ftp'] = $tmp . DIRECTORY_SEPARATOR . 'pear.ini';                $e = $this->readConfigFile(null, 'ftp');                if (PEAR::isError($e)) {                    return $e;                }                $fail = array();                foreach ($this->configuration_info as $key => $val) {                    if (in_array($this->getGroup($key),                          array('File Locations', 'File Locations (Advanced)')) &&                          $this->getType($key) == 'directory') {                        // any directory configs must be set for this to work                        if (!isset($this->configuration['ftp'][$key])) {                            $fail[] = $key;                        }                    }                }                if (count($fail)) {                    $fail = '"' . implode('", "', $fail) . '"';                    unset($this->files['ftp']);                    unset($this->configuration['ftp']);                    return PEAR::raiseError('ERROR: Ftp configuration file must set all ' .                        'directory configuration variables.  These variables were not set: ' .                        $fail);                } else {                    return true;                }            } else {                return PEAR::raiseError('Net_FTP must be installed to use remote config');            }        } while (false); // poor man's catch        unset($this->files['ftp']);        return PEAR::raiseError('no remote host specified');    }    // {{{ _setupChannels()        /**     * Reads the existing configurations and creates the _channels array from it     */    function _setupChannels()    {        $set = array_flip(array_values($this->_channels));        foreach ($this->configuration as $layer => $data) {            $i = 1000;            if (isset($data['__channels'])) {                foreach ($data['__channels'] as $channel => $info) {                    $set[$channel] = $i++;                }            }        }        $this->_channels = array_values(array_flip($set));        $this->setChannels($this->_channels);    }    // }}}    // {{{ deleteChannel(channel)    function deleteChannel($channel)    {        foreach ($this->configuration as $layer => $data) {            if (isset($data['__channels'])) {                if (isset($data['__channels'][strtolower($channel)])) {                    unset($this->configuration[$layer]['__channels'][strtolower($channel)]);                }            }        }        $this->_channels = array_flip($this->_channels);        unset($this->_channels[strtolower($channel)]);        $this->_channels = array_flip($this->_channels);    }    // }}}    // {{{ mergeConfigFile(file, [override], [layer])    /**     * Merges data into a config layer from a file.  Does the same     * thing as readConfigFile, except it does not replace all     * existing values in the config layer.     * @param string file to read from     * @param bool whether to overwrite existing data (default TRUE)     * @param string config layer to insert data into ('user' or 'system')     * @param string if true, errors are returned if file opening fails     * @return bool TRUE on success or a PEAR error on failure     */    function mergeConfigFile($file, $override = true, $layer = 'user', $strict = true)    {

⌨️ 快捷键说明

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