예제 #1
0
 /**
  * @return Application
  */
 protected function createComposerApplication()
 {
     $composer = new Application();
     $composer->setAutoExit(false);
     $composer->setCatchExceptions(false);
     return $composer;
 }
예제 #2
0
 /**
  * Fires the job.
  *
  * @param       $job
  * @param array $data
  * @throws \Exception
  */
 public function fire($job, $data)
 {
     echo 'Running: OxygenModule\\Marketplace\\Installer\\ComposerInstallJob' . "\n";
     // Composer\Factory::getHomeDir() method
     // needs COMPOSER_HOME environment variable set
     putenv('COMPOSER=' . base_path() . '/composer.json');
     putenv('COMPOSER_HOME=' . base_path() . '/.composer');
     $log = $this->config->get('oxygen.mod-marketplace.install.log');
     $progress = $this->config->get('oxygen.mod-marketplace.install.progress');
     foreach ([$log, $progress] as $file) {
         $this->files->delete($file);
         if (!$this->files->exists(dirname($file))) {
             $this->files->makeDirectory(dirname($file));
         }
     }
     $input = new ArrayInput($this->config->get('oxygen.mod-marketplace.install.command'));
     $this->output = new StreamOutput(fopen($log, 'a', false), OutputInterface::VERBOSITY_DEBUG);
     $this->progress = new FileProgress($progress, $this->output);
     $this->progress->section('Beginning Installation');
     $this->progress->indeterminate();
     $this->progress->notification('Installation Started');
     $application = new Application();
     $application->setAutoExit(false);
     $application->setCatchExceptions(false);
     try {
         $application->run($input, $this->output, $this->progress);
         $this->events->fire('oxygen.marketplace.postUpdate', [$this->progress, $this->output]);
         $this->progress->notification('Installation Complete');
         $this->progress->section('Complete');
         $this->progress->stopPolling();
         $job->delete();
     } catch (Exception $e) {
         $this->progress->notification($e->getMessage(), 'failed');
         $this->progress->stopPolling();
         throw $e;
     }
 }