r88899 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88898‎ | r88899 | r88900 >
Date:16:42, 26 May 2011
Author:reedy
Status:ok
Tags:
Comment:
* (bug 29142) Add path filtering to list=coderevisions
Modified paths:
  • /trunk/extensions/CodeReview/api/ApiQueryCodeRevisions.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRevisionListView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/api/ApiQueryCodeRevisions.php
@@ -49,6 +49,10 @@
5050 $data = array();
5151
5252 $listview = new CodeRevisionListView( $repo );
 53+ if ( isset( $params['path'] ) && $params['path'] !== '' ) {
 54+ $listview->mPath = CodeRevisionListView::pathsToArray( $params['path'] );
 55+ }
 56+
5357 $pager = $listview->getPager();
5458
5559 $revsSet = count( $params['revs'] );
@@ -133,6 +137,7 @@
134138 ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
135139 ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
136140 ),
 141+ 'path' => null,
137142 'start' => array(
138143 ApiBase::PARAM_TYPE => 'integer'
139144 ),
@@ -162,6 +167,7 @@
163168 return array(
164169 'repo' => 'Name of the repository',
165170 'limit' => 'How many revisions to return',
 171+ 'path' => 'Only show revisions in these path(s)',
166172 'start' => 'Timestamp to start listing at',
167173 'revs' => "List of revisions to get information about. Overrides {$p}start",
168174 'prop' => 'Which properties to return',
Index: trunk/extensions/CodeReview/ui/CodeRevisionListView.php
@@ -23,7 +23,7 @@
2424 $path = $wgRequest->getVal( 'path' );
2525
2626 if ( $path != '' ) {
27 - $this->mPath = array_map( array( $this, 'preparePaths' ), explode( '|', $path ) );
 27+ $this->mPath = self::pathsToArray( $path );
2828 } else {
2929 $this->mPath = array();
3030 }
@@ -47,10 +47,18 @@
4848 }
4949
5050 /**
51 - * @param string $path
 51+ * @param $path string
 52+ * @return array
 53+ */
 54+ public static function pathsToArray( $path ) {
 55+ return array_map( array( 'self', 'preparePaths' ), explode( '|', $path ) );
 56+ }
 57+
 58+ /**
 59+ * @param $path string
5260 * @return string
5361 */
54 - function preparePaths( $path ) {
 62+ public static function preparePaths( $path ) {
5563 $path = trim( $path );
5664 $path = rtrim( $path, '/' );
5765 $path = htmlspecialchars( $path );

Status & tagging log