@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhabricatorConfigManagementDoneWorkflow
4 extends PhabricatorConfigManagementWorkflow {
5
6 protected function didConstruct() {
7 $this
8 ->setName('done')
9 ->setExamples('**done** __activity__')
10 ->setSynopsis(pht('Mark a manual upgrade activity as complete.'))
11 ->setArguments(
12 array(
13 array(
14 'name' => 'force',
15 'short' => 'f',
16 'help' => pht(
17 'Mark activities complete even if there is no outstanding '.
18 'need to complete them.'),
19 ),
20 array(
21 'name' => 'activities',
22 'wildcard' => true,
23 ),
24 ));
25 }
26
27 public function execute(PhutilArgumentParser $args) {
28 $is_force = $args->getArg('force');
29
30 $activities = $args->getArg('activities');
31 if (!$activities) {
32 throw new PhutilArgumentUsageException(
33 pht('Specify an activity to mark as completed.'));
34 }
35
36 foreach ($activities as $type) {
37 $activity = id(new PhabricatorConfigManualActivity())->loadOneWhere(
38 'activityType = %s',
39 $type);
40 if (!$activity) {
41 if ($is_force) {
42 echo tsprintf(
43 "%s\n",
44 pht(
45 'Activity "%s" did not need to be marked as complete.',
46 $type));
47 } else {
48 throw new PhutilArgumentUsageException(
49 pht(
50 'Activity "%s" is not currently marked as required, so there '.
51 'is no need to complete it.',
52 $type));
53 }
54 } else {
55 $activity->delete();
56 echo tsprintf(
57 "%s\n",
58 pht(
59 'Marked activity "%s" as completed.',
60 $type));
61 }
62 }
63
64 echo tsprintf(
65 "%s\n",
66 pht('Done.'));
67
68 return 0;
69 }
70
71}