PEAR_Config::setInstallRoot PHP Method

setInstallRoot() public method

public setInstallRoot ( $root )
    function setInstallRoot($root)
    {
        if (substr($root, -1) == DIRECTORY_SEPARATOR) {
            $root = substr($root, 0, -1);
        }
        $old = $this->_installRoot;
        $this->_installRoot = $root;
        if ($old != $root && !$this->_noRegistry) {
            foreach (array_keys($this->_registry) as $layer) {
                if ($layer == 'ftp' || !isset($this->_registry[$layer])) {
                    continue;
                }
                $this->_registry[$layer] =& new PEAR_Registry($this->get('php_dir', $layer, 'pear.php.net'));
                $this->_registry[$layer]->setConfig($this, false);
                $this->_regInitialized[$layer] = false;
            }
        }
    }

Usage Example

Beispiel #1
0
 /**
  * @param PEAR_Downloader
  */
 function PEAR_Downloader_Package(&$downloader)
 {
     $this->_downloader =& $downloader;
     $this->_config =& $this->_downloader->config;
     $this->_registry =& $this->_config->getRegistry();
     $options = $downloader->getOptions();
     if (isset($options['packagingroot'])) {
         $this->_config->setInstallRoot($options['packagingroot']);
         $this->_installRegistry =& $this->_config->getRegistry();
         $this->_config->setInstallRoot(false);
     } else {
         $this->_installRegistry =& $this->_registry;
     }
     $this->_valid = $this->_analyzed = false;
 }