Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / repository / management / PhabricatorRepositoryManagementMarkImportedWorkflow.php
blob034617deb2e82883e421ce7f0081c9aeee93282e
1 <?php
3 final class PhabricatorRepositoryManagementMarkImportedWorkflow
4 extends PhabricatorRepositoryManagementWorkflow {
6 protected function didConstruct() {
7 $this
8 ->setName('mark-imported')
9 ->setExamples('**mark-imported** __repository__ ...')
10 ->setSynopsis(pht('Mark __repository__ as imported.'))
11 ->setArguments(
12 array(
13 array(
14 'name' => 'mark-not-imported',
15 'help' => pht('Instead, mark repositories as NOT imported.'),
17 array(
18 'name' => 'repos',
19 'wildcard' => true,
21 ));
24 public function execute(PhutilArgumentParser $args) {
25 $repos = $this->loadRepositories($args, 'repos');
27 if (!$repos) {
28 throw new PhutilArgumentUsageException(
29 pht('Specify one or more repositories to mark imported.'));
32 $new_importing_value = (bool)$args->getArg('mark-not-imported');
34 $console = PhutilConsole::getConsole();
35 foreach ($repos as $repo) {
36 $name = $repo->getDisplayName();
38 if ($repo->isImporting() && $new_importing_value) {
39 $console->writeOut(
40 "%s\n",
41 pht(
42 'Repository "%s" is already importing.',
43 $name));
44 } else if (!$repo->isImporting() && !$new_importing_value) {
45 $console->writeOut(
46 "%s\n",
47 pht(
48 'Repository "%s" is already imported.',
49 $name));
50 } else {
51 if ($new_importing_value) {
52 $console->writeOut(
53 "%s\n",
54 pht(
55 'Marking repository "%s" as importing.',
56 $name));
57 } else {
58 $console->writeOut(
59 "%s\n",
60 pht(
61 'Marking repository "%s" as imported.',
62 $name));
65 $repo->setDetail('importing', $new_importing_value);
66 $repo->save();
70 $console->writeOut("%s\n", pht('Done.'));
72 return 0;