예제 #1
0
 /**
  * Удаление пакета
  */
 static function uninstall($package)
 {
     $nvr = PackageManager::parseNRV($package);
     // проверка обратных зависимостей
     $res = Deps::isNoNeeded($nvr, $unstatisfied);
     if (count($res) == 0) {
         return IO::out('Packages to uninstall not found', IO::MESSAGE_FAIL);
     }
     if ($res === false) {
         io::out('Unable uninstall package ~WHITE~' . $nvr['name'] . '~~~ because', IO::MESSAGE_FAIL);
         foreach ($unstatisfied as $p => $d) {
             io::out('Package ' . $p . ' require  ' . implode(', ', array_keys($d)));
         }
         return false;
     }
     io::out('Packages to be removed: ', false);
     foreach ($res as $p) {
         io::out($p->name . '(' . $p->version . ') ', false);
     }
     io::out();
     if (IO::NO == io::dialog('Continue?', IO::YES | IO::NO, IO::NO)) {
         return 1;
     }
     foreach ($res as $p) {
         io::out('~WHITE~Undeploying ' . $p->name . '(' . $p->version . '):~~~');
         $r = Deployer::undeploy(Deployer::getPackageRollbackDir($p));
         if ($r || IO::OK != IO::dialog('Some part of rollback failed. Remove anyway?', IO::YES | IO::NO, IO::YES)) {
             Deployer::getPackageRollbackDir($p)->delete();
             $p->file->delete();
             PackageManager::get()->packagesSequence->removePackage($p->name, $p->version);
         }
     }
 }