http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89514

Revision: 89514
Author:   reedy
Date:     2011-06-05 18:05:45 +0000 (Sun, 05 Jun 2011)
Log Message:
-----------
MFT r89512, r89513

Modified Paths:
--------------
    branches/wmf/1.17wmf1/includes/api/ApiPageSet.php

Property Changed:
----------------
    branches/wmf/1.17wmf1/includes/
    branches/wmf/1.17wmf1/includes/api/


Property changes on: branches/wmf/1.17wmf1/includes
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3/includes:51646
/branches/new-installer/phase3/includes:43664-66004
/branches/sqlite/includes:58211-58321
/branches/wmf/1.16wmf4/includes:67177,69199,76243,77266
/branches/wmf-deployment/includes:53381,60970
/trunk/phase3/includes:83590
   + /branches/REL1_15/phase3/includes:51646
/branches/new-installer/phase3/includes:43664-66004
/branches/sqlite/includes:58211-58321
/branches/wmf/1.16wmf4/includes:67177,69199,76243,77266
/branches/wmf-deployment/includes:53381,60970
/trunk/phase3/includes:83590,89512-89513


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
   + /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

Modified: branches/wmf/1.17wmf1/includes/api/ApiPageSet.php
===================================================================
--- branches/wmf/1.17wmf1/includes/api/ApiPageSet.php   2011-06-05 18:01:30 UTC 
(rev 89513)
+++ branches/wmf/1.17wmf1/includes/api/ApiPageSet.php   2011-06-05 18:05:45 UTC 
(rev 89514)
@@ -446,6 +446,10 @@
                }
 
                $pageids = array_map( 'intval', $pageids ); // paranoia
+               $remaining = array_flip( $pageids );
+
+               $pageids = self::getPositiveIntegers( $pageids );
+
                $set = array(
                        'page_id' => $pageids
                );
@@ -457,7 +461,6 @@
                                        __METHOD__ );
                $this->profileDBOut();
 
-               $remaining = array_flip( $pageids );
                $this->initFromQueryResult( $db, $res, $remaining, false );     
// process PageIDs
 
                // Resolve any found redirects
@@ -535,6 +538,8 @@
                $pageids = array();
                $remaining = array_flip( $revids );
 
+               $revids = self::getPositiveIntegers( $revids );
+
                $tables = array( 'revision', 'page' );
                $fields = array( 'rev_id', 'rev_page' );
                $where = array( 'rev_id' => $revids, 'rev_page = page_id' );
@@ -712,6 +717,25 @@
                return $linkBatch;
        }
 
+       /**
+        * Returns the input array of integers with all values < 0 removed
+        *
+        * @param $array array
+        * @return array
+        */
+       private static function getPositiveIntegers( $array ) {
+               // bug 25734 API: possible issue with revids validation
+               // It seems with a load of revision rows, MySQL gets upset
+               // Remove any < 0 integers, as they can't be valid
+               foreach( $array as $i => $int ) {
+                       if ( $int < 0 ) {
+                               unset( $array[$i] );
+                       }
+               }
+
+               return $array;
+       }
+
        protected function getAllowedParams() {
                return array(
                        'titles' => array(


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to