Index: trunk/extensions/CodeReview/ApiCodeDiff.php |
— | — | @@ -63,6 +63,12 @@ |
64 | 64 | 'Fetch formatted diff from CodeReview\'s backing revision control system.' ); |
65 | 65 | } |
66 | 66 | |
| 67 | + public function getExamples() { |
| 68 | + return array( |
| 69 | + 'api.php?action=codediff&repo=MediaWiki&rev=42080', |
| 70 | + ); |
| 71 | + } |
| 72 | + |
67 | 73 | public function getVersion() { |
68 | 74 | return __CLASS__ . ': $Id$'; |
69 | 75 | } |
Index: trunk/extensions/CodeReview/ApiCodeUpdate.php |
— | — | @@ -76,6 +76,12 @@ |
77 | 77 | 'Update CodeReview repository data from master revision control system.' ); |
78 | 78 | } |
79 | 79 | |
| 80 | + public function getExamples() { |
| 81 | + return array( |
| 82 | + 'api.php?action=codeupdate&repo=MediaWiki&rev=42080', |
| 83 | + ); |
| 84 | + } |
| 85 | + |
80 | 86 | public function getVersion() { |
81 | 87 | return __CLASS__ . ': $Id$'; |
82 | 88 | } |
Index: trunk/extensions/CodeReview/CodeCommentsListView.php |
— | — | @@ -2,6 +2,8 @@ |
3 | 3 | |
4 | 4 | // Special:Code/MediaWiki |
5 | 5 | class CodeCommentsListView extends CodeView { |
| 6 | + public $mRepo; |
| 7 | + |
6 | 8 | function __construct( $repoName ) { |
7 | 9 | parent::__construct(); |
8 | 10 | $this->mRepo = CodeRepository::newFromName( $repoName ); |
— | — | @@ -17,7 +19,7 @@ |
18 | 20 | $pager->getNavigationBar() |
19 | 21 | ); |
20 | 22 | } |
21 | | - |
| 23 | + |
22 | 24 | function getPager() { |
23 | 25 | return new CodeCommentsTablePager( $this ); |
24 | 26 | } |
Index: trunk/extensions/CodeReview/ApiCodeComments.php |
— | — | @@ -35,6 +35,8 @@ |
36 | 36 | $this->props = array_flip( $params['prop'] ); |
37 | 37 | |
38 | 38 | $listview = new CodeCommentsListView( $params['repo'] ); |
| 39 | + if( is_null( $listview->mRepo ) ) |
| 40 | + $this->dieUsage( "Invalid repo ``{$params['repo']}''", 'invalidrepo' ); |
39 | 41 | $pager = $listview->getPager(); |
40 | 42 | |
41 | 43 | if ( !is_null( $params['start'] ) ) |
— | — | @@ -48,27 +50,29 @@ |
49 | 51 | $data = array(); |
50 | 52 | |
51 | 53 | $count = 0; |
52 | | - $lastTimestamp = 0; // Stop Eclipse from whining |
| 54 | + $lastTimestamp = 0; |
53 | 55 | while ( $row = $comments->fetchObject() ) { |
54 | 56 | if ( $count == $limit ) { |
55 | | - $this->setContinueEnumParameter( 'start', $lastTimestamp ); |
| 57 | + $this->setContinueEnumParameter( 'start', |
| 58 | + wfTimestamp( TS_ISO_8601, $lastTimestamp ) ); |
56 | 59 | break; |
57 | 60 | } |
58 | 61 | |
59 | | - $data[] = self::formatRow( $row ); |
| 62 | + $data[] = $this->formatRow( $row ); |
60 | 63 | $lastTimestamp = $row->cc_timestamp; |
61 | 64 | $count++; |
62 | 65 | } |
63 | 66 | $comments->free(); |
64 | 67 | |
65 | | - $result = $this->getMain()->getResult(); |
| 68 | + $result = $this->getResult(); |
66 | 69 | $result->setIndexedTagName( $data, 'comment' ); |
67 | 70 | $result->addValue( 'query', $this->getModuleName(), $data ); |
68 | 71 | } |
| 72 | + |
69 | 73 | private function formatRow( $row ) { |
70 | 74 | $item = array(); |
71 | 75 | if ( isset( $this->props['timestamp'] ) ) |
72 | | - $item['timestamp'] = $row->cc_timestamp; |
| 76 | + $item['timestamp'] = wfTimestamp( TS_ISO_8601, $row->cc_timestamp ); |
73 | 77 | if ( isset( $this->props['user'] ) ) |
74 | 78 | $item['user'] = $row->cc_user_text; |
75 | 79 | if ( isset( $this->props['revision'] ) ) |
— | — | @@ -104,6 +108,26 @@ |
105 | 109 | ); |
106 | 110 | } |
107 | 111 | |
| 112 | + public function getParamDescription() { |
| 113 | + return array( |
| 114 | + 'repo' => 'Name of the repository', |
| 115 | + 'limit' => 'How many comments to return', |
| 116 | + 'start' => 'Timestamp to start listing at', |
| 117 | + 'prop' => 'Which properties to return', |
| 118 | + ); |
| 119 | + } |
| 120 | + |
| 121 | + public function getDescription() { |
| 122 | + return 'List comments on revisions in CodeReview'; |
| 123 | + } |
| 124 | + |
| 125 | + public function getExamples() { |
| 126 | + return array( |
| 127 | + 'api.php?action=query&list=codecomments&ccrepo=MediaWiki', |
| 128 | + 'api.php?action=query&list=codecomments&ccrepo=MediaWiki&ccprop=timestamp|user|revision|text', |
| 129 | + ); |
| 130 | + } |
| 131 | + |
108 | 132 | public function getVersion() { |
109 | 133 | return __CLASS__ . ': $Id$'; |
110 | 134 | } |