container = $container; } protected function getContainer() { return $this->container; } public function run(array $options) { if (empty($options['step'])) { echo "Step is not specified.\n"; return; } if (empty($options['id'])) { echo "Upgrade ID is not specified.\n"; return; } $stepName = $options['step']; $upgradeId = $options['id']; return $this->runUpgradeStep($stepName, ['id' => $upgradeId]); } protected function runUpgradeStep($stepName, array $params) { $app = new \Espo\Core\Application(); $app->setupSystemUser(); $upgradeManager = new \Espo\Core\UpgradeManager($app->getContainer()); try { $result = $upgradeManager->runInstallStep($stepName, $params); // throw Exception on error } catch (\Exception $e) { die("Error: " . $e->getMessage() . "\n"); } if (is_bool($result)) { $result = $result ? "true" : "false"; } return $result; } }