@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
at upstream/main 74 lines 1.8 kB view raw
1<?php 2 3final class PasteQueryConduitAPIMethod extends PasteConduitAPIMethod { 4 5 public function getAPIMethodName() { 6 return 'paste.query'; 7 } 8 9 public function getMethodDescription() { 10 return pht('Query Pastes.'); 11 } 12 13 public function getMethodStatus() { 14 return self::METHOD_STATUS_DEPRECATED; 15 } 16 17 public function getMethodStatusDescription() { 18 return pht( 19 'This method has been deprecated since %s in favor of %s.', 20 '10/2025', 21 'paste.search'); 22 } 23 24 protected function defineParamTypes() { 25 return array( 26 'ids' => 'optional list<int>', 27 'phids' => 'optional list<phid>', 28 'authorPHIDs' => 'optional list<phid>', 29 'after' => 'optional int', 30 'limit' => 'optional int, default = 100', 31 ); 32 } 33 34 protected function defineReturnType() { 35 return 'list<dict>'; 36 } 37 38 protected function execute(ConduitAPIRequest $request) { 39 $query = id(new PhabricatorPasteQuery()) 40 ->setViewer($request->getUser()) 41 ->needRawContent(true); 42 43 if ($request->getValue('ids')) { 44 $query->withIDs($request->getValue('ids')); 45 } 46 47 if ($request->getValue('phids')) { 48 $query->withPHIDs($request->getValue('phids')); 49 } 50 51 if ($request->getValue('authorPHIDs')) { 52 $query->withAuthorPHIDs($request->getValue('authorPHIDs')); 53 } 54 55 if ($request->getValue('after')) { 56 $query->setAfterID($request->getValue('after')); 57 } 58 59 $limit = $request->getValue('limit', 100); 60 if ($limit) { 61 $query->setLimit($limit); 62 } 63 64 $pastes = $query->execute(); 65 66 $results = array(); 67 foreach ($pastes as $paste) { 68 $results[$paste->getPHID()] = $this->buildPasteInfoDictionary($paste); 69 } 70 71 return $results; 72 } 73 74}