[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhrictionHistoryConduitAPIMethod extends PhrictionConduitAPIMethod { 4 5 public function getAPIMethodName() { 6 return 'phriction.history'; 7 } 8 9 public function getMethodDescription() { 10 return pht('Retrieve history about a Phriction document.'); 11 } 12 13 public function defineParamTypes() { 14 return array( 15 'slug' => 'required string', 16 ); 17 } 18 19 public function defineReturnType() { 20 return 'nonempty list'; 21 } 22 23 public function defineErrorTypes() { 24 return array( 25 'ERR-BAD-DOCUMENT' => 'No such document exists.', 26 ); 27 } 28 29 protected function execute(ConduitAPIRequest $request) { 30 $slug = $request->getValue('slug'); 31 $doc = id(new PhrictionDocumentQuery()) 32 ->setViewer($request->getUser()) 33 ->withSlugs(array(PhabricatorSlug::normalize($slug))) 34 ->executeOne(); 35 if (!$doc) { 36 throw new ConduitException('ERR-BAD-DOCUMENT'); 37 } 38 39 $content = id(new PhrictionContent())->loadAllWhere( 40 'documentID = %d ORDER BY version DESC', 41 $doc->getID()); 42 43 $results = array(); 44 foreach ($content as $version) { 45 $results[] = $this->buildDocumentContentDictionary( 46 $doc, 47 $version); 48 } 49 50 return $results; 51 } 52 53 }
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 |