From 63601400e476c6cf43d985f3e7b9864681695ed4 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 18 Jan 2013 16:46:04 +0100 Subject: Update to MediaWiki 1.20.2 this update includes: * adjusted Arch Linux skin * updated FluxBBAuthPlugin * patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024 --- includes/api/ApiQueryRevisions.php | 98 ++++++++++++++++++++++++++++++++++---- 1 file changed, 89 insertions(+), 9 deletions(-) (limited to 'includes/api/ApiQueryRevisions.php') diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php index fa58bdf0..b89a8ea9 100644 --- a/includes/api/ApiQueryRevisions.php +++ b/includes/api/ApiQueryRevisions.php @@ -4,7 +4,7 @@ * * Created on Sep 7, 2006 * - * Copyright © 2006 Yuri Astrakhan @gmail.com + * Copyright © 2006 Yuri Astrakhan "@gmail.com" * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -224,6 +224,13 @@ class ApiQueryRevisions extends ApiQueryBase { } } + // add user name, if needed + if ( $this->fld_user ) { + $this->addTables( 'user' ); + $this->addJoinConds( array( 'user' => Revision::userJoinCond() ) ); + $this->addFields( Revision::selectUserFields() ); + } + // Bug 24166 - API error when using rvprop=tags $this->addTables( 'revision' ); @@ -241,6 +248,16 @@ class ApiQueryRevisions extends ApiQueryBase { $this->dieUsage( 'user and excludeuser cannot be used together', 'badparams' ); } + // Continuing effectively uses startid. But we can't use rvstartid + // directly, because there is no way to tell the client to ''not'' + // send rvstart if it sent it in the original query. So instead we + // send the continuation startid as rvcontinue, and ignore both + // rvstart and rvstartid when that is supplied. + if ( !is_null( $params['continue'] ) ) { + $params['startid'] = $params['continue']; + unset( $params['start'] ); + } + // This code makes an assumption that sorting by rev_id and rev_timestamp produces // the same result. This way users may request revisions starting at a given time, // but to page through results use the rev_id returned after each page. @@ -290,7 +307,7 @@ class ApiQueryRevisions extends ApiQueryBase { $this->addWhereFld( 'rev_id', array_keys( $revs ) ); if ( !is_null( $params['continue'] ) ) { - $this->addWhere( "rev_id >= '" . intval( $params['continue'] ) . "'" ); + $this->addWhere( 'rev_id >= ' . intval( $params['continue'] ) ); } $this->addOption( 'ORDER BY', 'rev_id' ); @@ -322,12 +339,15 @@ class ApiQueryRevisions extends ApiQueryBase { $pageid = intval( $cont[0] ); $revid = intval( $cont[1] ); $this->addWhere( - "rev_page > '$pageid' OR " . - "(rev_page = '$pageid' AND " . - "rev_id >= '$revid')" + "rev_page > $pageid OR " . + "(rev_page = $pageid AND " . + "rev_id >= $revid)" ); } - $this->addOption( 'ORDER BY', 'rev_page, rev_id' ); + $this->addOption( 'ORDER BY', array( + 'rev_page', + 'rev_id' + )); // assumption testing -- we should never get more then $pageCount rows. $limit = $pageCount; @@ -347,14 +367,14 @@ class ApiQueryRevisions extends ApiQueryBase { if ( !$enumRevMode ) { ApiBase::dieDebug( __METHOD__, 'Got more rows then expected' ); // bug report } - $this->setContinueEnumParameter( 'startid', intval( $row->rev_id ) ); + $this->setContinueEnumParameter( 'continue', intval( $row->rev_id ) ); break; } $fit = $this->addPageSubItem( $row->rev_page, $this->extractRowInfo( $row ), 'rev' ); if ( !$fit ) { if ( $enumRevMode ) { - $this->setContinueEnumParameter( 'startid', intval( $row->rev_id ) ); + $this->setContinueEnumParameter( 'continue', intval( $row->rev_id ) ); } elseif ( $revCount > 0 ) { $this->setContinueEnumParameter( 'continue', intval( $row->rev_id ) ); } else { @@ -528,7 +548,7 @@ class ApiQueryRevisions extends ApiQueryBase { return 'private'; } if ( !is_null( $params['prop'] ) && in_array( 'parsedcomment', $params['prop'] ) ) { - // formatComment() calls wfMsg() among other things + // formatComment() calls wfMessage() among other things return 'anon-public-user-private'; } return 'public'; @@ -638,6 +658,66 @@ class ApiQueryRevisions extends ApiQueryBase { ); } + public function getResultProperties() { + $props = array( + '' => array(), + 'ids' => array( + 'revid' => 'integer', + 'parentid' => array( + ApiBase::PROP_TYPE => 'integer', + ApiBase::PROP_NULLABLE => true + ) + ), + 'flags' => array( + 'minor' => 'boolean' + ), + 'user' => array( + 'userhidden' => 'boolean', + 'user' => 'string', + 'anon' => 'boolean' + ), + 'userid' => array( + 'userhidden' => 'boolean', + 'userid' => 'integer', + 'anon' => 'boolean' + ), + 'timestamp' => array( + 'timestamp' => 'timestamp' + ), + 'size' => array( + 'size' => 'integer' + ), + 'sha1' => array( + 'sha1' => 'string' + ), + 'comment' => array( + 'commenthidden' => 'boolean', + 'comment' => array( + ApiBase::PROP_TYPE => 'string', + ApiBase::PROP_NULLABLE => true + ) + ), + 'parsedcomment' => array( + 'commenthidden' => 'boolean', + 'parsedcomment' => array( + ApiBase::PROP_TYPE => 'string', + ApiBase::PROP_NULLABLE => true + ) + ), + 'content' => array( + '*' => array( + ApiBase::PROP_TYPE => 'string', + ApiBase::PROP_NULLABLE => true + ), + 'texthidden' => 'boolean' + ) + ); + + self::addTokenProperties( $props, $this->getTokenFunctions() ); + + return $props; + } + public function getDescription() { return array( 'Get revision information', -- cgit v1.2.3-54-g00ecf