/** * {@inheritdoc} */ public function execute() { try { $this->status->add('Starting composer remove...'); if (isset($this->params['components'])) { $packages = []; foreach ($this->params['components'] as $compObj) { $packages[] = $compObj['name']; } $this->status->add($this->composerApp->runComposerCommand(['command' => 'remove', 'packages' => $packages, '--no-update' => true])); } else { throw new \RuntimeException('Cannot find component to uninstall'); } $this->status->add($this->composerApp->runComposerCommand(['command' => 'update'])); $this->status->add('Composer remove completed successfully'); $this->queue->addJobs([['name' => \Magento\Update\Queue\JobFactory::NAME_MAINTENANCE_MODE, 'params' => ['enable' => false]]]); } catch (\Exception $e) { $this->status->setUpdateError(true); throw new \RuntimeException(sprintf('Could not complete %s successfully: %s', $this, $e->getMessage())); } return $this; }
/** * Create setup:upgrade task for setup application cron * * @return void */ private function createSetupUpgradeTasks() { $jobs = [['name' => 'setup:upgrade', 'params' => []]]; $this->queue->addJobs($jobs); }
/** * @expectedException \RuntimeException * @expectedExceptionMessage field is missing for one or more jobs */ public function testAddJobsInvalidJobs() { $this->queue->addJobs([['no_name' => 'no job', 'no_params' => []]]); }