Path: blob/master/src/applications/config/management/PhabricatorConfigManagementDoneWorkflow.php
12256 views
<?php12final class PhabricatorConfigManagementDoneWorkflow3extends PhabricatorConfigManagementWorkflow {45protected function didConstruct() {6$this7->setName('done')8->setExamples('**done** __activity__')9->setSynopsis(pht('Mark a manual upgrade activity as complete.'))10->setArguments(11array(12array(13'name' => 'force',14'short' => 'f',15'help' => pht(16'Mark activities complete even if there is no outstanding '.17'need to complete them.'),18),19array(20'name' => 'activities',21'wildcard' => true,22),23));24}2526public function execute(PhutilArgumentParser $args) {27$is_force = $args->getArg('force');2829$activities = $args->getArg('activities');30if (!$activities) {31throw new PhutilArgumentUsageException(32pht('Specify an activity to mark as completed.'));33}3435foreach ($activities as $type) {36$activity = id(new PhabricatorConfigManualActivity())->loadOneWhere(37'activityType = %s',38$type);39if (!$activity) {40if ($is_force) {41echo tsprintf(42"%s\n",43pht(44'Activity "%s" did not need to be marked as complete.',45$type));46} else {47throw new PhutilArgumentUsageException(48pht(49'Activity "%s" is not currently marked as required, so there '.50'is no need to complete it.',51$type));52}53} else {54$activity->delete();55echo tsprintf(56"%s\n",57pht(58'Marked activity "%s" as completed.',59$type));60}61}6263echo tsprintf(64"%s\n",65pht('Done.'));6667return 0;68}6970}717273