r53785 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53784‎ | r53785 | r53786 >
Date:19:31, 26 July 2009
Author:aaron
Status:ok
Tags:
Comment:
Move api code to /api
Modified paths:
  • /trunk/extensions/CodeReview/ApiCodeComments.php (deleted) (history)
  • /trunk/extensions/CodeReview/ApiCodeDiff.php (deleted) (history)
  • /trunk/extensions/CodeReview/ApiCodeUpdate.php (deleted) (history)
  • /trunk/extensions/CodeReview/CodeReview.php (modified) (history)
  • /trunk/extensions/CodeReview/api (added) (history)
  • /trunk/extensions/CodeReview/api/ApiCodeComments.php (added) (history)
  • /trunk/extensions/CodeReview/api/ApiCodeDiff.php (added) (history)
  • /trunk/extensions/CodeReview/api/ApiCodeUpdate.php (added) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/ApiCodeUpdate.php
@@ -1,104 +0,0 @@
2 -<?php
3 -
4 -class ApiCodeUpdate extends ApiBase {
5 -
6 - public function execute() {
7 - global $wgUser;
8 - // Before doing anything at all, let's check permissions
9 - if( !$wgUser->isAllowed('codereview-use') ) {
10 - $this->dieUsage('You don\'t have permission update code','permissiondenied');
11 - }
12 - $params = $this->extractRequestParams();
13 -
14 - if ( !isset( $params['repo'] ) ) {
15 - $this->dieUsageMsg( array( 'missingparam', 'repo' ) );
16 - }
17 - if ( !isset( $params['rev'] ) ) {
18 - $this->dieUsageMsg( array( 'missingparam', 'rev' ) );
19 - }
20 -
21 - $repo = CodeRepository::newFromName( $params['repo'] );
22 - if ( !$repo ) {
23 - $this->dieUsage( "Invalid repo ``{$params['repo']}''", 'invalidrepo' );
24 - }
25 -
26 - $svn = SubversionAdaptor::newFromRepo( $repo->getPath() );
27 - $lastStoredRev = $repo->getLastStoredRev();
28 -
29 - if ( $lastStoredRev >= $params['rev'] ) {
30 - // Nothing to do, we're up to date.
31 - // Return an empty result
32 - $this->getResult()->addValue( null, $this->getModuleName(), array() );
33 - return;
34 - }
35 -
36 - // FIXME: this could be a lot?
37 - $log = $svn->getLog( '', $lastStoredRev + 1, $params['rev'] );
38 - if ( !$log ) {
39 - // FIXME: When and how often does this happen?
40 - // Should we use dieUsage() here instead?
41 - ApiBase::dieDebug( __METHOD__, "Something awry..." );
42 - }
43 -
44 - $result = array();
45 - foreach ( $log as $data ) {
46 - $codeRev = CodeRevision::newFromSvn( $repo, $data );
47 - $codeRev->save();
48 - $result[] = array(
49 - 'id' => $codeRev->getId(),
50 - 'author' => $codeRev->getAuthor(),
51 - 'timestamp' => wfTimestamp( TS_ISO_8601, $codeRev->getTimestamp() ),
52 - 'message' => $codeRev->getMessage()
53 - );
54 - }
55 - // Cache the diffs if there are a only a few.
56 - // Mainly for WMF post-commit ping hook...
57 - if ( count( $result ) <= 2 ) {
58 - foreach ( $result as $revData ) {
59 - $diff = $repo->getDiff( $revData['id'] ); // trigger caching
60 - }
61 - }
62 - $this->getResult()->setIndexedTagName( $result, 'rev' );
63 - $this->getResult()->addValue( null, $this->getModuleName(), $result );
64 - }
65 -
66 - public function mustBePosted() {
67 - // Discourage casual browsing :)
68 - return true;
69 - }
70 -
71 - public function isWriteMode() {
72 - return true;
73 - }
74 -
75 - public function getAllowedParams() {
76 - return array(
77 - 'repo' => null,
78 - 'rev' => array(
79 - ApiBase::PARAM_TYPE => 'integer',
80 - ApiBase::PARAM_MIN => 1
81 - )
82 - );
83 - }
84 -
85 - public function getParamDescription() {
86 - return array(
87 - 'repo' => 'Name of repository to update',
88 - 'rev' => 'Revision ID number to update to' );
89 - }
90 -
91 - public function getDescription() {
92 - return array(
93 - 'Update CodeReview repository data from master revision control system.' );
94 - }
95 -
96 - public function getExamples() {
97 - return array(
98 - 'api.php?action=codeupdate&repo=MediaWiki&rev=42080',
99 - );
100 - }
101 -
102 - public function getVersion() {
103 - return __CLASS__ . ': $Id$';
104 - }
105 -}
Index: trunk/extensions/CodeReview/ApiCodeComments.php
@@ -1,139 +0,0 @@
2 -<?php
3 -
4 -/*
5 - * Created on Oct 29, 2008
6 - *
7 - * API for MediaWiki 1.8+
8 - *
9 - * Copyright (C) 2008 Bryan Tong Minh <Bryan.TongMinh@Gmail.com>
10 - *
11 - * This program is free software; you can redistribute it and/or modify
12 - * it under the terms of the GNU General Public License as published by
13 - * the Free Software Foundation; either version 2 of the License, or
14 - * (at your option) any later version.
15 - *
16 - * This program is distributed in the hope that it will be useful,
17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 - * GNU General Public License for more details.
20 - *
21 - * You should have received a copy of the GNU General Public License along
22 - * with this program; if not, write to the Free Software Foundation, Inc.,
23 - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 - * http://www.gnu.org/copyleft/gpl.html
25 - */
26 -
27 -class ApiCodeComments extends ApiQueryBase {
28 - public function __construct( $query, $moduleName ) {
29 - parent::__construct( $query, $moduleName, 'cc' );
30 - }
31 -
32 - public function execute() {
33 - global $wgUser;
34 - // Before doing anything at all, let's check permissions
35 - if( !$wgUser->isAllowed('codereview-use') ) {
36 - $this->dieUsage('You don\'t have permission to view code comments','permissiondenied');
37 - }
38 - $params = $this->extractRequestParams();
39 - if ( is_null( $params['repo'] ) )
40 - $this->dieUsageMsg( array( 'missingparam', 'repo' ) );
41 - $this->props = array_flip( $params['prop'] );
42 -
43 - $listview = new CodeCommentsListView( $params['repo'] );
44 - if ( is_null( $listview->getRepo() ) )
45 - $this->dieUsage( "Invalid repo ``{$params['repo']}''", 'invalidrepo' );
46 - $pager = $listview->getPager();
47 -
48 - if ( !is_null( $params['start'] ) )
49 - $pager->setOffset( $this->getDB()->timestamp( $params['start'] ) );
50 - $limit = $params['limit'];
51 - $pager->setLimit( $limit );
52 -
53 - $pager->doQuery();
54 -
55 - $comments = $pager->getResult();
56 - $data = array();
57 -
58 - $count = 0;
59 - $lastTimestamp = 0;
60 - while ( $row = $comments->fetchObject() ) {
61 - if ( $count == $limit ) {
62 - $this->setContinueEnumParameter( 'start',
63 - wfTimestamp( TS_ISO_8601, $lastTimestamp ) );
64 - break;
65 - }
66 -
67 - $data[] = $this->formatRow( $row );
68 - $lastTimestamp = $row->cc_timestamp;
69 - $count++;
70 - }
71 - $comments->free();
72 -
73 - $result = $this->getResult();
74 - $result->setIndexedTagName( $data, 'comment' );
75 - $result->addValue( 'query', $this->getModuleName(), $data );
76 - }
77 -
78 - private function formatRow( $row ) {
79 - $item = array();
80 - if ( isset( $this->props['timestamp'] ) )
81 - $item['timestamp'] = wfTimestamp( TS_ISO_8601, $row->cc_timestamp );
82 - if ( isset( $this->props['user'] ) )
83 - $item['user'] = $row->cc_user_text;
84 - if ( isset( $this->props['revision'] ) )
85 - $item['status'] = $row->cr_status;
86 - if ( isset( $this->props['text'] ) )
87 - ApiResult::setContent( $item, $row->cc_text );
88 - return $item;
89 - }
90 -
91 - public function getAllowedParams() {
92 - return array (
93 - 'repo' => null,
94 - 'limit' => array (
95 - ApiBase :: PARAM_DFLT => 10,
96 - ApiBase :: PARAM_TYPE => 'limit',
97 - ApiBase :: PARAM_MIN => 1,
98 - ApiBase :: PARAM_MAX => ApiBase :: LIMIT_BIG1,
99 - ApiBase :: PARAM_MAX2 => ApiBase :: LIMIT_BIG2
100 - ),
101 - 'start' => array(
102 - ApiBase :: PARAM_TYPE => 'timestamp'
103 - ),
104 - 'prop' => array (
105 - ApiBase :: PARAM_ISMULTI => true,
106 - ApiBase :: PARAM_DFLT => 'timestamp|user|revision',
107 - ApiBase :: PARAM_TYPE => array (
108 - 'timestamp',
109 - 'user',
110 - 'revision',
111 - 'text',
112 - ),
113 - ),
114 - );
115 - }
116 -
117 - public function getParamDescription() {
118 - return array(
119 - 'repo' => 'Name of the repository',
120 - 'limit' => 'How many comments to return',
121 - 'start' => 'Timestamp to start listing at',
122 - 'prop' => 'Which properties to return',
123 - );
124 - }
125 -
126 - public function getDescription() {
127 - return 'List comments on revisions in CodeReview';
128 - }
129 -
130 - public function getExamples() {
131 - return array(
132 - 'api.php?action=query&list=codecomments&ccrepo=MediaWiki',
133 - 'api.php?action=query&list=codecomments&ccrepo=MediaWiki&ccprop=timestamp|user|revision|text',
134 - );
135 - }
136 -
137 - public function getVersion() {
138 - return __CLASS__ . ': $Id$';
139 - }
140 -}
Index: trunk/extensions/CodeReview/ApiCodeDiff.php
@@ -1,80 +0,0 @@
2 -<?php
3 -
4 -class ApiCodeDiff extends ApiBase {
5 -
6 - public function execute() {
7 - global $wgUser;
8 - // Before doing anything at all, let's check permissions
9 - if( !$wgUser->isAllowed('codereview-use') ) {
10 - $this->dieUsage('You don\'t have permission to view code diffs','permissiondenied');
11 - }
12 - $params = $this->extractRequestParams();
13 -
14 - if ( !isset( $params['repo'] ) ) {
15 - $this->dieUsageMsg( array( 'missingparam', 'repo' ) );
16 - }
17 - if ( !isset( $params['rev'] ) ) {
18 - $this->dieUsageMsg( array( 'missingparam', 'rev' ) );
19 - }
20 -
21 - $repo = CodeRepository::newFromName( $params['repo'] );
22 - if ( !$repo ) {
23 - $this->dieUsage( "Invalid repo ``{$params['repo']}''", 'invalidrepo' );
24 - }
25 -
26 - $svn = SubversionAdaptor::newFromRepo( $repo->getPath() );
27 - $lastStoredRev = $repo->getLastStoredRev();
28 -
29 - if ( $params['rev'] > $lastStoredRev ) {
30 - $this->dieUsage( "There is no revision with ID {$params['rev']}", 'nosuchrev' );
31 - }
32 -
33 - $diff = $repo->getDiff( $params['rev'] );
34 -
35 - if ( $diff ) {
36 - $hilite = new CodeDiffHighlighter();
37 - $html = $hilite->render( $diff );
38 - } else {
39 - // FIXME: Are we sure we don't want to throw an error here?
40 - $html = 'Failed to load diff.';
41 - }
42 -
43 - $data = array(
44 - 'repo' => $params['repo'],
45 - 'id' => $params['rev'],
46 - 'diff' => $html
47 - );
48 - $this->getResult()->addValue( 'code', 'rev', $data );
49 - }
50 -
51 - public function getAllowedParams() {
52 - return array(
53 - 'repo' => null,
54 - 'rev' => array(
55 - ApiBase::PARAM_TYPE => 'integer',
56 - ApiBase::PARAM_MIN => 1
57 - )
58 - );
59 - }
60 -
61 - public function getParamDescription() {
62 - return array(
63 - 'repo' => 'Name of repository to look at',
64 - 'rev' => 'Revision ID to fetch diff of' );
65 - }
66 -
67 - public function getDescription() {
68 - return array(
69 - 'Fetch formatted diff from CodeReview\'s backing revision control system.' );
70 - }
71 -
72 - public function getExamples() {
73 - return array(
74 - 'api.php?action=codediff&repo=MediaWiki&rev=42080',
75 - );
76 - }
77 -
78 - public function getVersion() {
79 - return __CLASS__ . ': $Id$';
80 - }
81 -}
Index: trunk/extensions/CodeReview/api/ApiCodeComments.php
@@ -0,0 +1,139 @@
 2+<?php
 3+
 4+/*
 5+ * Created on Oct 29, 2008
 6+ *
 7+ * API for MediaWiki 1.8+
 8+ *
 9+ * Copyright (C) 2008 Bryan Tong Minh <Bryan.TongMinh@Gmail.com>
 10+ *
 11+ * This program is free software; you can redistribute it and/or modify
 12+ * it under the terms of the GNU General Public License as published by
 13+ * the Free Software Foundation; either version 2 of the License, or
 14+ * (at your option) any later version.
 15+ *
 16+ * This program is distributed in the hope that it will be useful,
 17+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 18+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 19+ * GNU General Public License for more details.
 20+ *
 21+ * You should have received a copy of the GNU General Public License along
 22+ * with this program; if not, write to the Free Software Foundation, Inc.,
 23+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 24+ * http://www.gnu.org/copyleft/gpl.html
 25+ */
 26+
 27+class ApiCodeComments extends ApiQueryBase {
 28+ public function __construct( $query, $moduleName ) {
 29+ parent::__construct( $query, $moduleName, 'cc' );
 30+ }
 31+
 32+ public function execute() {
 33+ global $wgUser;
 34+ // Before doing anything at all, let's check permissions
 35+ if( !$wgUser->isAllowed('codereview-use') ) {
 36+ $this->dieUsage('You don\'t have permission to view code comments','permissiondenied');
 37+ }
 38+ $params = $this->extractRequestParams();
 39+ if ( is_null( $params['repo'] ) )
 40+ $this->dieUsageMsg( array( 'missingparam', 'repo' ) );
 41+ $this->props = array_flip( $params['prop'] );
 42+
 43+ $listview = new CodeCommentsListView( $params['repo'] );
 44+ if ( is_null( $listview->getRepo() ) )
 45+ $this->dieUsage( "Invalid repo ``{$params['repo']}''", 'invalidrepo' );
 46+ $pager = $listview->getPager();
 47+
 48+ if ( !is_null( $params['start'] ) )
 49+ $pager->setOffset( $this->getDB()->timestamp( $params['start'] ) );
 50+ $limit = $params['limit'];
 51+ $pager->setLimit( $limit );
 52+
 53+ $pager->doQuery();
 54+
 55+ $comments = $pager->getResult();
 56+ $data = array();
 57+
 58+ $count = 0;
 59+ $lastTimestamp = 0;
 60+ while ( $row = $comments->fetchObject() ) {
 61+ if ( $count == $limit ) {
 62+ $this->setContinueEnumParameter( 'start',
 63+ wfTimestamp( TS_ISO_8601, $lastTimestamp ) );
 64+ break;
 65+ }
 66+
 67+ $data[] = $this->formatRow( $row );
 68+ $lastTimestamp = $row->cc_timestamp;
 69+ $count++;
 70+ }
 71+ $comments->free();
 72+
 73+ $result = $this->getResult();
 74+ $result->setIndexedTagName( $data, 'comment' );
 75+ $result->addValue( 'query', $this->getModuleName(), $data );
 76+ }
 77+
 78+ private function formatRow( $row ) {
 79+ $item = array();
 80+ if ( isset( $this->props['timestamp'] ) )
 81+ $item['timestamp'] = wfTimestamp( TS_ISO_8601, $row->cc_timestamp );
 82+ if ( isset( $this->props['user'] ) )
 83+ $item['user'] = $row->cc_user_text;
 84+ if ( isset( $this->props['revision'] ) )
 85+ $item['status'] = $row->cr_status;
 86+ if ( isset( $this->props['text'] ) )
 87+ ApiResult::setContent( $item, $row->cc_text );
 88+ return $item;
 89+ }
 90+
 91+ public function getAllowedParams() {
 92+ return array (
 93+ 'repo' => null,
 94+ 'limit' => array (
 95+ ApiBase :: PARAM_DFLT => 10,
 96+ ApiBase :: PARAM_TYPE => 'limit',
 97+ ApiBase :: PARAM_MIN => 1,
 98+ ApiBase :: PARAM_MAX => ApiBase :: LIMIT_BIG1,
 99+ ApiBase :: PARAM_MAX2 => ApiBase :: LIMIT_BIG2
 100+ ),
 101+ 'start' => array(
 102+ ApiBase :: PARAM_TYPE => 'timestamp'
 103+ ),
 104+ 'prop' => array (
 105+ ApiBase :: PARAM_ISMULTI => true,
 106+ ApiBase :: PARAM_DFLT => 'timestamp|user|revision',
 107+ ApiBase :: PARAM_TYPE => array (
 108+ 'timestamp',
 109+ 'user',
 110+ 'revision',
 111+ 'text',
 112+ ),
 113+ ),
 114+ );
 115+ }
 116+
 117+ public function getParamDescription() {
 118+ return array(
 119+ 'repo' => 'Name of the repository',
 120+ 'limit' => 'How many comments to return',
 121+ 'start' => 'Timestamp to start listing at',
 122+ 'prop' => 'Which properties to return',
 123+ );
 124+ }
 125+
 126+ public function getDescription() {
 127+ return 'List comments on revisions in CodeReview';
 128+ }
 129+
 130+ public function getExamples() {
 131+ return array(
 132+ 'api.php?action=query&list=codecomments&ccrepo=MediaWiki',
 133+ 'api.php?action=query&list=codecomments&ccrepo=MediaWiki&ccprop=timestamp|user|revision|text',
 134+ );
 135+ }
 136+
 137+ public function getVersion() {
 138+ return __CLASS__ . ': $Id: ApiCodeComments.php 48777 2009-03-25 01:26:54Z aaron $';
 139+ }
 140+}
Index: trunk/extensions/CodeReview/api/ApiCodeDiff.php
@@ -0,0 +1,80 @@
 2+<?php
 3+
 4+class ApiCodeDiff extends ApiBase {
 5+
 6+ public function execute() {
 7+ global $wgUser;
 8+ // Before doing anything at all, let's check permissions
 9+ if( !$wgUser->isAllowed('codereview-use') ) {
 10+ $this->dieUsage('You don\'t have permission to view code diffs','permissiondenied');
 11+ }
 12+ $params = $this->extractRequestParams();
 13+
 14+ if ( !isset( $params['repo'] ) ) {
 15+ $this->dieUsageMsg( array( 'missingparam', 'repo' ) );
 16+ }
 17+ if ( !isset( $params['rev'] ) ) {
 18+ $this->dieUsageMsg( array( 'missingparam', 'rev' ) );
 19+ }
 20+
 21+ $repo = CodeRepository::newFromName( $params['repo'] );
 22+ if ( !$repo ) {
 23+ $this->dieUsage( "Invalid repo ``{$params['repo']}''", 'invalidrepo' );
 24+ }
 25+
 26+ $svn = SubversionAdaptor::newFromRepo( $repo->getPath() );
 27+ $lastStoredRev = $repo->getLastStoredRev();
 28+
 29+ if ( $params['rev'] > $lastStoredRev ) {
 30+ $this->dieUsage( "There is no revision with ID {$params['rev']}", 'nosuchrev' );
 31+ }
 32+
 33+ $diff = $repo->getDiff( $params['rev'] );
 34+
 35+ if ( $diff ) {
 36+ $hilite = new CodeDiffHighlighter();
 37+ $html = $hilite->render( $diff );
 38+ } else {
 39+ // FIXME: Are we sure we don't want to throw an error here?
 40+ $html = 'Failed to load diff.';
 41+ }
 42+
 43+ $data = array(
 44+ 'repo' => $params['repo'],
 45+ 'id' => $params['rev'],
 46+ 'diff' => $html
 47+ );
 48+ $this->getResult()->addValue( 'code', 'rev', $data );
 49+ }
 50+
 51+ public function getAllowedParams() {
 52+ return array(
 53+ 'repo' => null,
 54+ 'rev' => array(
 55+ ApiBase::PARAM_TYPE => 'integer',
 56+ ApiBase::PARAM_MIN => 1
 57+ )
 58+ );
 59+ }
 60+
 61+ public function getParamDescription() {
 62+ return array(
 63+ 'repo' => 'Name of repository to look at',
 64+ 'rev' => 'Revision ID to fetch diff of' );
 65+ }
 66+
 67+ public function getDescription() {
 68+ return array(
 69+ 'Fetch formatted diff from CodeReview\'s backing revision control system.' );
 70+ }
 71+
 72+ public function getExamples() {
 73+ return array(
 74+ 'api.php?action=codediff&repo=MediaWiki&rev=42080',
 75+ );
 76+ }
 77+
 78+ public function getVersion() {
 79+ return __CLASS__ . ': $Id: ApiCodeDiff.php 48777 2009-03-25 01:26:54Z aaron $';
 80+ }
 81+}
Index: trunk/extensions/CodeReview/api/ApiCodeUpdate.php
@@ -0,0 +1,104 @@
 2+<?php
 3+
 4+class ApiCodeUpdate extends ApiBase {
 5+
 6+ public function execute() {
 7+ global $wgUser;
 8+ // Before doing anything at all, let's check permissions
 9+ if( !$wgUser->isAllowed('codereview-use') ) {
 10+ $this->dieUsage('You don\'t have permission update code','permissiondenied');
 11+ }
 12+ $params = $this->extractRequestParams();
 13+
 14+ if ( !isset( $params['repo'] ) ) {
 15+ $this->dieUsageMsg( array( 'missingparam', 'repo' ) );
 16+ }
 17+ if ( !isset( $params['rev'] ) ) {
 18+ $this->dieUsageMsg( array( 'missingparam', 'rev' ) );
 19+ }
 20+
 21+ $repo = CodeRepository::newFromName( $params['repo'] );
 22+ if ( !$repo ) {
 23+ $this->dieUsage( "Invalid repo ``{$params['repo']}''", 'invalidrepo' );
 24+ }
 25+
 26+ $svn = SubversionAdaptor::newFromRepo( $repo->getPath() );
 27+ $lastStoredRev = $repo->getLastStoredRev();
 28+
 29+ if ( $lastStoredRev >= $params['rev'] ) {
 30+ // Nothing to do, we're up to date.
 31+ // Return an empty result
 32+ $this->getResult()->addValue( null, $this->getModuleName(), array() );
 33+ return;
 34+ }
 35+
 36+ // FIXME: this could be a lot?
 37+ $log = $svn->getLog( '', $lastStoredRev + 1, $params['rev'] );
 38+ if ( !$log ) {
 39+ // FIXME: When and how often does this happen?
 40+ // Should we use dieUsage() here instead?
 41+ ApiBase::dieDebug( __METHOD__, "Something awry..." );
 42+ }
 43+
 44+ $result = array();
 45+ foreach ( $log as $data ) {
 46+ $codeRev = CodeRevision::newFromSvn( $repo, $data );
 47+ $codeRev->save();
 48+ $result[] = array(
 49+ 'id' => $codeRev->getId(),
 50+ 'author' => $codeRev->getAuthor(),
 51+ 'timestamp' => wfTimestamp( TS_ISO_8601, $codeRev->getTimestamp() ),
 52+ 'message' => $codeRev->getMessage()
 53+ );
 54+ }
 55+ // Cache the diffs if there are a only a few.
 56+ // Mainly for WMF post-commit ping hook...
 57+ if ( count( $result ) <= 2 ) {
 58+ foreach ( $result as $revData ) {
 59+ $diff = $repo->getDiff( $revData['id'] ); // trigger caching
 60+ }
 61+ }
 62+ $this->getResult()->setIndexedTagName( $result, 'rev' );
 63+ $this->getResult()->addValue( null, $this->getModuleName(), $result );
 64+ }
 65+
 66+ public function mustBePosted() {
 67+ // Discourage casual browsing :)
 68+ return true;
 69+ }
 70+
 71+ public function isWriteMode() {
 72+ return true;
 73+ }
 74+
 75+ public function getAllowedParams() {
 76+ return array(
 77+ 'repo' => null,
 78+ 'rev' => array(
 79+ ApiBase::PARAM_TYPE => 'integer',
 80+ ApiBase::PARAM_MIN => 1
 81+ )
 82+ );
 83+ }
 84+
 85+ public function getParamDescription() {
 86+ return array(
 87+ 'repo' => 'Name of repository to update',
 88+ 'rev' => 'Revision ID number to update to' );
 89+ }
 90+
 91+ public function getDescription() {
 92+ return array(
 93+ 'Update CodeReview repository data from master revision control system.' );
 94+ }
 95+
 96+ public function getExamples() {
 97+ return array(
 98+ 'api.php?action=codeupdate&repo=MediaWiki&rev=42080',
 99+ );
 100+ }
 101+
 102+ public function getVersion() {
 103+ return __CLASS__ . ': $Id: ApiCodeUpdate.php 48928 2009-03-27 18:41:20Z catrope $';
 104+ }
 105+}
Index: trunk/extensions/CodeReview/CodeReview.php
@@ -37,9 +37,9 @@
3838
3939 $dir = dirname( __FILE__ ) . '/';
4040
41 -$wgAutoloadClasses['ApiCodeUpdate'] = $dir . 'ApiCodeUpdate.php';
42 -$wgAutoloadClasses['ApiCodeDiff'] = $dir . 'ApiCodeDiff.php';
43 -$wgAutoloadClasses['ApiCodeComments'] = $dir . 'ApiCodeComments.php';
 41+$wgAutoloadClasses['ApiCodeUpdate'] = $dir . 'api/ApiCodeUpdate.php';
 42+$wgAutoloadClasses['ApiCodeDiff'] = $dir . 'api/ApiCodeDiff.php';
 43+$wgAutoloadClasses['ApiCodeComments'] = $dir . 'api/ApiCodeComments.php';
4444
4545 $wgAutoloadClasses['CodeDiffHighlighter'] = $dir . 'DiffHighlighter.php';
4646 $wgAutoloadClasses['CodeRepository'] = $dir . 'CodeRepository.php';

Status & tagging log