[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorFeedManagementRepublishWorkflow 4 extends PhabricatorFeedManagementWorkflow { 5 6 protected function didConstruct() { 7 $this 8 ->setName('republish') 9 ->setExamples('**republish** __story_key__') 10 ->setSynopsis( 11 pht( 12 'Republish a feed event to all consumers.')) 13 ->setArguments( 14 array( 15 array( 16 'name' => 'key', 17 'wildcard' => true, 18 ), 19 )); 20 } 21 22 public function execute(PhutilArgumentParser $args) { 23 $console = PhutilConsole::getConsole(); 24 $viewer = $this->getViewer(); 25 26 $key = $args->getArg('key'); 27 if (count($key) < 1) { 28 throw new PhutilArgumentUsageException( 29 pht('Specify a story key to republish.')); 30 } else if (count($key) > 1) { 31 throw new PhutilArgumentUsageException( 32 pht('Specify exactly one story key to republish.')); 33 } 34 $key = head($key); 35 36 $story = id(new PhabricatorFeedQuery()) 37 ->setViewer($viewer) 38 ->withChronologicalKeys(array($key)) 39 ->executeOne(); 40 41 if (!$story) { 42 throw new PhutilArgumentUsageException( 43 pht('No story exists with key "%s"!', $key)); 44 } 45 46 $console->writeOut("%s\n", pht('Republishing story...')); 47 48 PhabricatorWorker::setRunAllTasksInProcess(true); 49 50 PhabricatorWorker::scheduleTask( 51 'FeedPublisherWorker', 52 array( 53 'key' => $key, 54 )); 55 56 $console->writeOut("%s\n", pht('Done.')); 57 58 return 0; 59 } 60 61 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |