Components_Pear_Environment::getPearConfig PHP Method

getPearConfig() public method

public getPearConfig ( )
    public function getPearConfig()
    {
        if (!isset($GLOBALS['_PEAR_Config_instance'])) {
            $GLOBALS['_PEAR_Config_instance'] = false;
        }
        if (empty($this->_config_file)) {
            $config = PEAR_Config::singleton();
            if (!$config->validConfiguration()) {
                throw new Components_Exception('Set the path to the PEAR environment first!');
            }
            return $config;
        }
        if (!file_exists($this->_config_file)) {
            $this->createPearConfig();
        }
        return Components_Exception_Pear::catchError(PEAR_Config::singleton($this->_config_file));
    }

Usage Example

示例#1
0
文件: Factory.php 项目: horde/horde
 /**
  * Return the PEAR Package representation based on a local *.tgz archive.
  *
  * @param string                          $package_tgz_path Path to the *.tgz file.
  * @param Components_Pear_Environment $environment      The PEAR environment.
  *
  * @return PEAR_PackageFile
  */
 public function getPackageFileFromTgz($package_tgz_path, Components_Pear_Environment $environment)
 {
     $pkg = new PEAR_PackageFile($environment->getPearConfig());
     return Components_Exception_Pear::catchError($pkg->fromTgzFile($package_tgz_path, PEAR_VALIDATE_NORMAL));
 }