http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89646
Revision: 89646
Author: reedy
Date: 2011-06-07 14:04:25 +0000 (Tue, 07 Jun 2011)
Log Message:
-----------
MFT r89549, r89574
Modified Paths:
--------------
branches/wmf/1.17wmf1/includes/api/ApiPageSet.php
Property Changed:
----------------
branches/wmf/1.17wmf1/includes/api/
Property changes on: branches/wmf/1.17wmf1/includes/api
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/REL1_15/phase3/includes/api:51646
/branches/REL1_16/phase3/includes/api:63621-63636,69357
/branches/sqlite/includes/api:58211-58321
/branches/wmf/1.16wmf4/includes/api:67177,69199,69521,76243,77266
/branches/wmf-deployment/includes/api:53381,59952,60970
/trunk/phase3/includes/api:89512-89513
+ /branches/REL1_15/phase3/includes/api:51646
/branches/REL1_16/phase3/includes/api:63621-63636,69357
/branches/sqlite/includes/api:58211-58321
/branches/wmf/1.16wmf4/includes/api:67177,69199,69521,76243,77266
/branches/wmf-deployment/includes/api:53381,59952,60970
/trunk/phase3/includes/api:89512-89513,89549,89574
Modified: branches/wmf/1.17wmf1/includes/api/ApiPageSet.php
===================================================================
--- branches/wmf/1.17wmf1/includes/api/ApiPageSet.php 2011-06-07 13:43:31 UTC
(rev 89645)
+++ branches/wmf/1.17wmf1/includes/api/ApiPageSet.php 2011-06-07 14:04:25 UTC
(rev 89646)
@@ -450,17 +450,20 @@
$pageids = self::getPositiveIntegers( $pageids );
- $set = array(
- 'page_id' => $pageids
- );
- $db = $this->getDB();
+ $res = null;
+ if ( count( $pageids ) ) {
+ $set = array(
+ 'page_id' => $pageids
+ );
+ $db = $this->getDB();
- // Get pageIDs data from the `page` table
- $this->profileDBIn();
- $res = $db->select( 'page', $this->getPageTableFields(), $set,
- __METHOD__ );
- $this->profileDBOut();
-
+ // Get pageIDs data from the `page` table
+ $this->profileDBIn();
+ $res = $db->select( 'page',
$this->getPageTableFields(), $set,
+ __METHOD__ );
+ $this->profileDBOut();
+ }
+
$this->initFromQueryResult( $db, $res, $remaining, false );
// process PageIDs
// Resolve any found redirects
@@ -483,20 +486,22 @@
ApiBase::dieDebug( __METHOD__, 'Missing $processTitles
parameter when $remaining is provided' );
}
- foreach ( $res as $row ) {
- $pageId = intval( $row->page_id );
+ if ( $res ) {
+ foreach ( $res as $row ) {
+ $pageId = intval( $row->page_id );
- // Remove found page from the list of remaining items
- if ( isset( $remaining ) ) {
- if ( $processTitles ) {
- unset(
$remaining[$row->page_namespace][$row->page_title] );
- } else {
- unset( $remaining[$pageId] );
+ // Remove found page from the list of remaining
items
+ if ( isset( $remaining ) ) {
+ if ( $processTitles ) {
+ unset(
$remaining[$row->page_namespace][$row->page_title] );
+ } else {
+ unset( $remaining[$pageId] );
+ }
}
+
+ // Store any extra fields requested by modules
+ $this->processDbRow( $row );
}
-
- // Store any extra fields requested by modules
- $this->processDbRow( $row );
}
if ( isset( $remaining ) ) {
@@ -540,21 +545,23 @@
$revids = self::getPositiveIntegers( $revids );
- $tables = array( 'revision', 'page' );
- $fields = array( 'rev_id', 'rev_page' );
- $where = array( 'rev_id' => $revids, 'rev_page = page_id' );
+ if ( count( $revids ) ) {
+ $tables = array( 'revision', 'page' );
+ $fields = array( 'rev_id', 'rev_page' );
+ $where = array( 'rev_id' => $revids, 'rev_page =
page_id' );
- // Get pageIDs data from the `page` table
- $this->profileDBIn();
- $res = $db->select( $tables, $fields, $where, __METHOD__ );
- foreach ( $res as $row ) {
- $revid = intval( $row->rev_id );
- $pageid = intval( $row->rev_page );
- $this->mGoodRevIDs[$revid] = $pageid;
- $pageids[$pageid] = '';
- unset( $remaining[$revid] );
+ // Get pageIDs data from the `page` table
+ $this->profileDBIn();
+ $res = $db->select( $tables, $fields, $where,
__METHOD__ );
+ foreach ( $res as $row ) {
+ $revid = intval( $row->rev_id );
+ $pageid = intval( $row->rev_page );
+ $this->mGoodRevIDs[$revid] = $pageid;
+ $pageids[$pageid] = '';
+ unset( $remaining[$revid] );
+ }
+ $this->profileDBOut();
}
- $this->profileDBOut();
$this->mMissingRevIDs = array_keys( $remaining );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs