当前位置: 首页>>代码示例>>PHP>>正文


PHP PackageManager::getRollback方法代码示例

本文整理汇总了PHP中PackageManager::getRollback方法的典型用法代码示例。如果您正苦于以下问题:PHP PackageManager::getRollback方法的具体用法?PHP PackageManager::getRollback怎么用?PHP PackageManager::getRollback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PackageManager的用法示例。


在下文中一共展示了PackageManager::getRollback方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: cmdUninstall

 /**
  * Удаление указанного пакета
  */
 function cmdUninstall()
 {
     if (($nvr = ArgsHolder::get()->shiftCommand(false)) == false) {
         return IO::out('Specify package file', IO::MESSAGE_FAIL) | 1;
     }
     try {
         PackageManager::get()->startup();
         PackageManager::uninstall(trim($nvr, '\'"'));
         PackageManager::get()->shutdown();
     } catch (Exception $e) {
         PackageManager::getRollback()->stepBack();
         return io::out($e->getMessage(), IO::MESSAGE_FAIL) | (is_null($e->getCode()) ? 2 : $e->getCode());
     }
 }
开发者ID:point,项目名称:cassea,代码行数:17,代码来源:PackageManagerFacade.php

示例2: install

 /**
  * Инсталяция пакета
  *
  * Пакет $package может быть представлен ввиде локального фала(~/mypackage.tbz),
  * имени пакета (admin) или ввиде имени пакет, версии и отношения (news>=2.0-alpha)
  *
  * @throw PackageManagerException, RepositoryListException
  * @param string $package
  */
 static function install($package)
 {
     // локальный файл
     if (($fp = realpath($package)) !== false) {
         if (($p = Package::isPackage(new File($fp, true))) !== false) {
             $package = $p;
         } else {
             throw new PackageManagerException('Given file (' . $package . ') isn\'t a well formed  package.');
         }
     }
     // зависимости
     io::out('~WHITE~Checking dependencies~~~');
     $installList = Deps::calculate($package);
     if ($installList === false) {
         throw new PackageManagerException('Невозможно удовлетворить зависимости, или не найдены требуемые пакеты.');
     } elseif ($installList instanceof Package) {
         return IO::out('Установленная версия пакета ' . $installList->name . ': ' . $installList->version) | 0;
     }
     $newPackages = array();
     $updatePackages = array();
     $installedPackages = array();
     $list = array();
     for ($i = 0, $c = count($installList); $i < $c; $i++) {
         $package = $installList[$i];
         if ($package->status != Package::INSTALLED) {
             $list[] = $package;
         }
         // for information oupput
         if ($package->status == Package::INSTALLED) {
             $installedPackages[] = $package;
         } else {
             if (false === ($p = PackageManager::getInstalledPackage($package->name))) {
                 $newPackages[] = $package;
             } else {
                 $updatePackages[] = $p;
             }
         }
     }
     foreach ($newPackages as $p) {
         $n[] = $p->name . '(' . $p->version . ')';
     }
     if (isset($n)) {
         io::out('New Packages: ' . implode(', ', $n));
     }
     foreach ($updatePackages as $p) {
         $u[] = $p->name . '(' . $p->version . ')';
     }
     if (isset($u)) {
         io::out('Packages to be updated: ' . implode(', ', $u));
     }
     foreach ($installedPackages as $p) {
         $inst[] = $p->name . '(' . $p->version . ')';
     }
     if (isset($inst)) {
         io::out('Installed Packages: ' . implode(', ', $inst));
     }
     // доставка
     $deployList = array();
     io::out('~WHITE~Fetching packages~~~');
     $dDir = self::getDownloadDir();
     foreach ($list as $package) {
         io::out($package->name . '_' . $package->version . ': ', false);
         $tFile = $dDir->getFile($package->name . '_' . $package->version . '.tbz');
         //look in downloaded dir
         $p = Package::isPackage($tFile);
         if ($p instanceof Package && $p->name == $package->name && $p->version == $package->version) {
             io::out('Already downloaded', false);
             $deployList[] = $p;
         } else {
             // откат для скачанногофайла
             PackageManager::getRollback()->push('delete', $tFile);
             $deployList[] = $package->delivery($tFile);
         }
         io::done();
     }
     try {
         foreach ($deployList as $p) {
             io::out('~WHITE~Deploying ' . $p->name . '(' . $p->version . '):~~~');
             $p->deploy();
             $p->file->move(PackageManager::getInstalledDir()->getFile($p->name . '_' . $p->version . '.tbz'));
             PackageManager::get()->packagesSequence->addPackage($p->name, $p->version);
         }
     } catch (Exception $e) {
         echo $e->getMessage();
         PackageManager::getRollback()->stepBack();
     }
     return;
 }
开发者ID:point,项目名称:cassea,代码行数:97,代码来源:PackageManager.php

示例3: deploy

 /**
  * Размещение пакета
  *
  * @throws Exception if one of deploy task throws an exception
  */
 function deploy()
 {
     // распаковть в buildpad
     $bp = PackageManager::getBuildpadDir()->getDir($this->name . '_' . $this->version);
     PackageManager::getRollback()->push('delete', $bp);
     Packer::unpack($this->file, $bp);
     // Вырезать нужный кусок их Package.xml
     $rp = new DOMXPath($this->xml);
     $nodes = $rp->query('//deploy');
     if ($nodes->length == 0) {
         return io::out('Nothing to deploy') | 0;
     }
     $tasks = $nodes->item(0)->childNodes;
     // создать deployer
     $d = new Deployer($bp);
     $d->setTaskList($tasks);
     $d->executeTasks();
     // удалить директорию в билдпаде
     $bp->delete();
 }
开发者ID:point,项目名称:cassea,代码行数:25,代码来源:Package.php

示例4: executeTasks

 /**
  * Выполнение задач для развертывания пакета.
  *
  * Для каждой задачи из списка задач taskList вызвется метод deploy()
  *
  * @thorows Exception если одна из задач выбросит исключение
  */
 function executeTasks()
 {
     PackageManager::getRollback()->push('undeploy', $this->rollbackDir);
     $this->taskList = array_values($this->taskList);
     foreach ($this->taskList as $task) {
         $task->deploy();
     }
 }
开发者ID:point,项目名称:cassea,代码行数:15,代码来源:Deployer.php


注:本文中的PackageManager::getRollback方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。