コード例 #1
0
 /**
  * Run phing action for the specified module
  *
  * @param string $app_code
  * @param string $action
  *
  * @throws \Exception
  */
 protected function runPhing($app_code, $action)
 {
     $base_dir = Locator::getBuildXmlPath($this->io);
     $phing_runner = new PhingRunner($this->io, realpath($base_dir));
     $phing_runner->Run($app_code, $action);
     //$this->io->write('    <warning>===Please run this command===</warning>');
     //$this->io->write("    phing -Dapp={$app_code} $action");
 }
コード例 #2
0
 public function __construct(IOInterface $io, $base_dir = null)
 {
     $this->io = $io;
     // this is added for compatibility with installer 1.0 when it's upgraded to 1.1
     if (is_null($base_dir)) {
         $base_dir = realpath(Locator::getBuildXmlPath($io));
     }
     if (!file_exists($base_dir . '/build.xml')) {
         $this->io->write("<error>{$base_dir}/build.xml doesn't exist there, failure imminent</error>");
     }
     $this->base_dir = $base_dir;
 }
コード例 #3
0
 public function onPostAutoloadDump(ScriptEvent $event)
 {
     if (empty($this->postprocess)) {
         return;
     }
     $io = $event->getIO();
     $io->write("All code has been downloaded, now running database installation and migrations");
     $io->write("Migrations to run:\n     " . join("     \n", array_map(function ($el) {
         return 'phing -Dapp=' . $el[1] . ' ' . $el[0];
     }, $this->postprocess)));
     $phing_runner = new PhingRunner($io, Locator::getBuildXmlPath($io));
     foreach ($this->postprocess as $el) {
         list($operation, $app_code) = $el;
         try {
             $phing_runner->Run($app_code, $operation);
         } catch (\Exception $e) {
             if ($operation === 'install') {
                 $io->writeError("\n\n<warning>Got exception while running phing task. " . get_class($e) . ': ' . $e->getMessage() . " </warning>");
                 $io->writeError("<info>Trying to run upgrade instead</info>");
                 $phing_runner->Run($app_code, 'upgrade');
             } else {
                 $io->writeError("\n\n<error>Got exception while running phing task. " . get_class($e) . ': ' . $e->getMessage() . " </error>");
             }
         }
     }
 }