Differential D14463 Diff 35378 src/infrastructure/storage/management/workflow/PhabricatorStorageManagementStatusWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/storage/management/workflow/PhabricatorStorageManagementStatusWorkflow.php
| <?php | <?php | ||||
| final class PhabricatorStorageManagementStatusWorkflow | final class PhabricatorStorageManagementStatusWorkflow | ||||
| extends PhabricatorStorageManagementWorkflow { | extends PhabricatorStorageManagementWorkflow { | ||||
| protected function didConstruct() { | protected function didConstruct() { | ||||
| $this | $this | ||||
| ->setName('status') | ->setName('status') | ||||
| ->setExamples('**status** [__options__]') | ->setExamples('**status** [__options__]') | ||||
| ->setSynopsis(pht('Show patch application status.')); | ->setSynopsis(pht('Show patch application status.')); | ||||
| } | } | ||||
| public function execute(PhutilArgumentParser $args) { | public function didExecute(PhutilArgumentParser $args) { | ||||
| $api = $this->getAPI(); | $api = $this->getAPI(); | ||||
| $patches = $this->getPatches(); | $patches = $this->getPatches(); | ||||
| $applied = $api->getAppliedPatches(); | $applied = $api->getAppliedPatches(); | ||||
| if ($applied === null) { | if ($applied === null) { | ||||
| echo phutil_console_format( | echo phutil_console_format( | ||||
| "**%s**: %s\n", | "**%s**: %s\n", | ||||
| pht('Database Not Initialized'), | pht('Database Not Initialized'), | ||||
| pht('Run **%s** to initialize.', 'storage upgrade')); | pht('Run **%s** to initialize.', './bin/storage upgrade')); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| $table = id(new PhutilConsoleTable()) | $table = id(new PhutilConsoleTable()) | ||||
| ->setShowHeader(false) | ->setShowHeader(false) | ||||
| ->addColumn('id', array('title' => pht('ID'))) | ->addColumn('id', array('title' => pht('ID'))) | ||||
| ->addColumn('status', array('title' => pht('Status'))) | ->addColumn('status', array('title' => pht('Status'))) | ||||
| ->addColumn('duration', array('title' => pht('Duration'))) | ->addColumn('duration', array('title' => pht('Duration'))) | ||||
| ->addColumn('type', array('title' => pht('Type'))) | ->addColumn('type', array('title' => pht('Type'))) | ||||
| ->addColumn('name', array('title' => pht('Name'))); | ->addColumn('name', array('title' => pht('Name'))); | ||||
| $durations = $api->getPatchDurations(); | $durations = $api->getPatchDurations(); | ||||
| foreach ($patches as $patch) { | foreach ($patches as $patch) { | ||||
| $duration = idx($durations, $patch->getFullKey()); | $duration = idx($durations, $patch->getFullKey()); | ||||
| if ($duration === null) { | if ($duration === null) { | ||||
| $duration = '-'; | $duration = '-'; | ||||
| } else { | } else { | ||||
| Show All 19 Lines | |||||