[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorFactManagementCursorsWorkflow 4 extends PhabricatorFactManagementWorkflow { 5 6 public function didConstruct() { 7 $this 8 ->setName('cursors') 9 ->setSynopsis(pht('Show a list of fact iterators and cursors.')) 10 ->setExamples( 11 "**cursors**\n". 12 "**cursors** --reset __cursor__") 13 ->setArguments( 14 array( 15 array( 16 'name' => 'reset', 17 'param' => 'cursor', 18 'repeat' => true, 19 'help' => 'Reset cursor __cursor__.', 20 ), 21 )); 22 } 23 24 public function execute(PhutilArgumentParser $args) { 25 $console = PhutilConsole::getConsole(); 26 27 $reset = $args->getArg('reset'); 28 if ($reset) { 29 foreach ($reset as $name) { 30 $cursor = id(new PhabricatorFactCursor())->loadOneWhere( 31 'name = %s', 32 $name); 33 if ($cursor) { 34 $console->writeOut("%s\n", pht('Resetting cursor %s...', $name)); 35 $cursor->delete(); 36 } else { 37 $console->writeErr( 38 "%s\n", 39 pht('Cursor %s does not exist or is already reset.', $name)); 40 } 41 } 42 return 0; 43 } 44 45 $iterator_map = PhabricatorFactDaemon::getAllApplicationIterators(); 46 if (!$iterator_map) { 47 $console->writeErr("%s\n", pht('No cursors.')); 48 return 0; 49 } 50 51 $cursors = id(new PhabricatorFactCursor())->loadAllWhere( 52 'name IN (%Ls)', 53 array_keys($iterator_map)); 54 $cursors = mpull($cursors, 'getPosition', 'getName'); 55 56 foreach ($iterator_map as $iterator_name => $iterator) { 57 $console->writeOut( 58 "%s (%s)\n", 59 $iterator_name, 60 idx($cursors, $iterator_name, 'start')); 61 } 62 63 return 0; 64 } 65 66 }
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 |