Components_Pear_Environment::createPearConfig PHP Метод

createPearConfig() публичный Метод

public createPearConfig ( )
    public function createPearConfig()
    {
        if (empty($this->_config_file)) {
            throw new Components_Exception('Set the path to the PEAR environment first!');
        }
        if (file_exists($this->_config_file)) {
            throw new Components_Exception(sprintf('PEAR configuration file %s already exists!', $this->_config_file));
        }
        ob_start();
        $config = Components_Exception_Pear::catchError(PEAR_Config::singleton($this->_config_file, '#no#system#config#', false));
        $root = dirname($this->_config_file);
        $config->noRegistry();
        $config->set('php_dir', "{$root}/pear/php", 'user');
        $config->set('data_dir', "{$root}/pear/data");
        $config->set('www_dir', "{$root}/pear/www");
        $config->set('cfg_dir', "{$root}/pear/cfg");
        $config->set('ext_dir', "{$root}/pear/ext");
        $config->set('doc_dir', "{$root}/pear/docs");
        $config->set('test_dir', "{$root}/pear/tests");
        $config->set('cache_dir', "{$root}/pear/cache");
        $config->set('download_dir', "{$root}/pear/download");
        $config->set('temp_dir', "{$root}/pear/temp");
        $config->set('bin_dir', "{$root}/pear");
        $config->writeConfigFile();
        $config->_noRegistry = false;
        $config->_registry['default'] = new PEAR_Registry("{$root}/pear/php");
        $config->_noRegistry = true;
        if (!file_exists("{$root}/pear")) {
            mkdir("{$root}/pear/php", 0777, true);
        }
        $this->_output->pear(ob_get_clean());
        $this->_output->ok(sprintf('Successfully created PEAR configuration %s', $this->_config_file));
    }