Example #1
0
 function doUninstall($command, $options, $params)
 {
     if (empty($this->installer)) {
         $this->installer =& new PEAR_Installer($this->ui);
     }
     if (sizeof($params) < 1) {
         return $this->raiseError("Please supply the package(s) you want to uninstall");
     }
     include_once 'PEAR/Registry.php';
     $reg = new PEAR_Registry($this->config->get('php_dir'));
     $newparams = array();
     $badparams = array();
     foreach ($params as $pkg) {
         $info = $reg->packageInfo($pkg);
         if ($info === null) {
             $badparams[] = $pkg;
         } else {
             $newparams[] = $info;
         }
     }
     PEAR_Common::sortPkgDeps($newparams, true);
     $params = array();
     foreach ($newparams as $info) {
         $params[] = $info['info']['package'];
     }
     $params = array_merge($params, $badparams);
     foreach ($params as $pkg) {
         if ($this->installer->uninstall($pkg, $options)) {
             if ($this->config->get('verbose') > 0) {
                 $this->ui->outputData("uninstall ok: {$pkg}", $command);
             }
         } else {
             return $this->raiseError("uninstall failed: {$pkg}");
         }
     }
     return true;
 }