[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class DifferentialFindConduitAPIMethod 4 extends DifferentialConduitAPIMethod { 5 6 public function getAPIMethodName() { 7 return 'differential.find'; 8 } 9 10 public function getMethodStatus() { 11 return self::METHOD_STATUS_DEPRECATED; 12 } 13 14 public function getMethodStatusDescription() { 15 return "Replaced by 'differential.query'."; 16 } 17 18 public function getMethodDescription() { 19 return 'Query Differential revisions which match certain criteria.'; 20 } 21 22 public function defineParamTypes() { 23 $types = array( 24 'open', 25 'committable', 26 'revision-ids', 27 'phids', 28 ); 29 30 return array( 31 'query' => 'required '.$this->formatStringConstants($types), 32 'guids' => 'required nonempty list<guids>', 33 ); 34 } 35 36 public function defineReturnType() { 37 return 'nonempty list<dict>'; 38 } 39 40 public function defineErrorTypes() { 41 return array( 42 ); 43 } 44 45 protected function execute(ConduitAPIRequest $request) { 46 $type = $request->getValue('query'); 47 $guids = $request->getValue('guids'); 48 49 $results = array(); 50 if (!$guids) { 51 return $results; 52 } 53 54 $query = id(new DifferentialRevisionQuery()) 55 ->setViewer($request->getUser()); 56 57 switch ($type) { 58 case 'open': 59 $query 60 ->withStatus(DifferentialRevisionQuery::STATUS_OPEN) 61 ->withAuthors($guids); 62 break; 63 case 'committable': 64 $query 65 ->withStatus(DifferentialRevisionQuery::STATUS_ACCEPTED) 66 ->withAuthors($guids); 67 break; 68 case 'revision-ids': 69 $query 70 ->withIDs($guids); 71 break; 72 case 'owned': 73 $query->withAuthors($guids); 74 break; 75 case 'phids': 76 $query 77 ->withPHIDs($guids); 78 break; 79 } 80 81 $revisions = $query->execute(); 82 83 foreach ($revisions as $revision) { 84 $diff = $revision->loadActiveDiff(); 85 if (!$diff) { 86 continue; 87 } 88 $id = $revision->getID(); 89 $results[] = array( 90 'id' => $id, 91 'phid' => $revision->getPHID(), 92 'name' => $revision->getTitle(), 93 'uri' => PhabricatorEnv::getProductionURI('/D'.$id), 94 'dateCreated' => $revision->getDateCreated(), 95 'authorPHID' => $revision->getAuthorPHID(), 96 'statusName' => 97 ArcanistDifferentialRevisionStatus::getNameForRevisionStatus( 98 $revision->getStatus()), 99 'sourcePath' => $diff->getSourcePath(), 100 ); 101 } 102 103 return $results; 104 } 105 106 }
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 |