Path: blob/master/src/applications/feed/management/PhabricatorFeedManagementRepublishWorkflow.php
12242 views
<?php12final class PhabricatorFeedManagementRepublishWorkflow3extends PhabricatorFeedManagementWorkflow {45protected function didConstruct() {6$this7->setName('republish')8->setExamples('**republish** __story_key__')9->setSynopsis(10pht(11'Republish a feed event to all consumers.'))12->setArguments(13array(14array(15'name' => 'key',16'wildcard' => true,17),18));19}2021public function execute(PhutilArgumentParser $args) {22$console = PhutilConsole::getConsole();23$viewer = $this->getViewer();2425$key = $args->getArg('key');26if (count($key) < 1) {27throw new PhutilArgumentUsageException(28pht('Specify a story key to republish.'));29} else if (count($key) > 1) {30throw new PhutilArgumentUsageException(31pht('Specify exactly one story key to republish.'));32}33$key = head($key);3435$story = id(new PhabricatorFeedQuery())36->setViewer($viewer)37->withChronologicalKeys(array($key))38->executeOne();3940if (!$story) {41throw new PhutilArgumentUsageException(42pht('No story exists with key "%s"!', $key));43}4445$console->writeOut("%s\n", pht('Republishing story...'));4647PhabricatorWorker::setRunAllTasksInProcess(true);4849PhabricatorWorker::scheduleTask(50'FeedPublisherWorker',51array(52'key' => $key,53));5455$console->writeOut("%s\n", pht('Done.'));5657return 0;58}5960}616263