PEAR_Downloader::PEAR_Downloader PHP Method

PEAR_Downloader() public method

public PEAR_Downloader ( &$ui, $options, &$config )
    function PEAR_Downloader(&$ui, $options, &$config)
    {
        parent::PEAR_Common();
        $this->_options = $options;
        $this->config =& $config;
        $this->_preferredState = $this->config->get('preferred_state');
        $this->ui =& $ui;
        if (!$this->_preferredState) {
            // don't inadvertantly use a non-set preferred_state
            $this->_preferredState = null;
        }
        if (isset($this->_options['installroot'])) {
            $this->config->setInstallRoot($this->_options['installroot']);
        }
        $this->_registry =& $config->getRegistry();
        if (isset($this->_options['alldeps']) || isset($this->_options['onlyreqdeps'])) {
            $this->_installed = $this->_registry->listAllPackages();
            foreach ($this->_installed as $key => $unused) {
                if (!count($unused)) {
                    continue;
                }
                $strtolower = create_function('$a', 'return strtolower($a);');
                array_walk($this->_installed[$key], $strtolower);
            }
        }
    }

Usage Example

Example #1
0
 /**
  * Download any files and their dependencies, if necessary
  *
  * @param array a mixed list of package names, local files, or package.xml
  * @param PEAR_Config
  * @param array options from the command line
  * @param array this is the array that will be populated with packages to
  *              install.  Format of each entry:
  *
  * <code>
  * array('pkg' => 'package_name', 'file' => '/path/to/local/file',
  *    'info' => array() // parsed package.xml
  * );
  * </code>
  * @param array this will be populated with any error messages
  * @param false private recursion variable
  * @param false private recursion variable
  * @param false private recursion variable
  * @deprecated in favor of PEAR_Downloader
  */
 function download($packages, $options, &$config, &$installpackages, &$errors, $installed = false, $willinstall = false, $state = false)
 {
     // trickiness: initialize here
     parent::PEAR_Downloader($this->ui, $options, $config);
     $ret = parent::download($packages);
     $errors = $this->getErrorMsgs();
     $installpackages = $this->getDownloadedPackages();
     trigger_error("PEAR Warning: PEAR_Installer::download() is deprecated " . "in favor of PEAR_Downloader class", E_USER_WARNING);
     return $ret;
 }
All Usage Examples Of PEAR_Downloader::PEAR_Downloader