Index: branches/wmf/1.17wmf1/includes/api/ApiPageSet.php |
— | — | @@ -450,17 +450,20 @@ |
451 | 451 | |
452 | 452 | $pageids = self::getPositiveIntegers( $pageids ); |
453 | 453 | |
454 | | - $set = array( |
455 | | - 'page_id' => $pageids |
456 | | - ); |
457 | | - $db = $this->getDB(); |
| 454 | + $res = null; |
| 455 | + if ( count( $pageids ) ) { |
| 456 | + $set = array( |
| 457 | + 'page_id' => $pageids |
| 458 | + ); |
| 459 | + $db = $this->getDB(); |
458 | 460 | |
459 | | - // Get pageIDs data from the `page` table |
460 | | - $this->profileDBIn(); |
461 | | - $res = $db->select( 'page', $this->getPageTableFields(), $set, |
462 | | - __METHOD__ ); |
463 | | - $this->profileDBOut(); |
464 | | - |
| 461 | + // Get pageIDs data from the `page` table |
| 462 | + $this->profileDBIn(); |
| 463 | + $res = $db->select( 'page', $this->getPageTableFields(), $set, |
| 464 | + __METHOD__ ); |
| 465 | + $this->profileDBOut(); |
| 466 | + } |
| 467 | + |
465 | 468 | $this->initFromQueryResult( $db, $res, $remaining, false ); // process PageIDs |
466 | 469 | |
467 | 470 | // Resolve any found redirects |
— | — | @@ -483,20 +486,22 @@ |
484 | 487 | ApiBase::dieDebug( __METHOD__, 'Missing $processTitles parameter when $remaining is provided' ); |
485 | 488 | } |
486 | 489 | |
487 | | - foreach ( $res as $row ) { |
488 | | - $pageId = intval( $row->page_id ); |
| 490 | + if ( $res ) { |
| 491 | + foreach ( $res as $row ) { |
| 492 | + $pageId = intval( $row->page_id ); |
489 | 493 | |
490 | | - // Remove found page from the list of remaining items |
491 | | - if ( isset( $remaining ) ) { |
492 | | - if ( $processTitles ) { |
493 | | - unset( $remaining[$row->page_namespace][$row->page_title] ); |
494 | | - } else { |
495 | | - unset( $remaining[$pageId] ); |
| 494 | + // Remove found page from the list of remaining items |
| 495 | + if ( isset( $remaining ) ) { |
| 496 | + if ( $processTitles ) { |
| 497 | + unset( $remaining[$row->page_namespace][$row->page_title] ); |
| 498 | + } else { |
| 499 | + unset( $remaining[$pageId] ); |
| 500 | + } |
496 | 501 | } |
| 502 | + |
| 503 | + // Store any extra fields requested by modules |
| 504 | + $this->processDbRow( $row ); |
497 | 505 | } |
498 | | - |
499 | | - // Store any extra fields requested by modules |
500 | | - $this->processDbRow( $row ); |
501 | 506 | } |
502 | 507 | |
503 | 508 | if ( isset( $remaining ) ) { |
— | — | @@ -540,21 +545,23 @@ |
541 | 546 | |
542 | 547 | $revids = self::getPositiveIntegers( $revids ); |
543 | 548 | |
544 | | - $tables = array( 'revision', 'page' ); |
545 | | - $fields = array( 'rev_id', 'rev_page' ); |
546 | | - $where = array( 'rev_id' => $revids, 'rev_page = page_id' ); |
| 549 | + if ( count( $revids ) ) { |
| 550 | + $tables = array( 'revision', 'page' ); |
| 551 | + $fields = array( 'rev_id', 'rev_page' ); |
| 552 | + $where = array( 'rev_id' => $revids, 'rev_page = page_id' ); |
547 | 553 | |
548 | | - // Get pageIDs data from the `page` table |
549 | | - $this->profileDBIn(); |
550 | | - $res = $db->select( $tables, $fields, $where, __METHOD__ ); |
551 | | - foreach ( $res as $row ) { |
552 | | - $revid = intval( $row->rev_id ); |
553 | | - $pageid = intval( $row->rev_page ); |
554 | | - $this->mGoodRevIDs[$revid] = $pageid; |
555 | | - $pageids[$pageid] = ''; |
556 | | - unset( $remaining[$revid] ); |
| 554 | + // Get pageIDs data from the `page` table |
| 555 | + $this->profileDBIn(); |
| 556 | + $res = $db->select( $tables, $fields, $where, __METHOD__ ); |
| 557 | + foreach ( $res as $row ) { |
| 558 | + $revid = intval( $row->rev_id ); |
| 559 | + $pageid = intval( $row->rev_page ); |
| 560 | + $this->mGoodRevIDs[$revid] = $pageid; |
| 561 | + $pageids[$pageid] = ''; |
| 562 | + unset( $remaining[$revid] ); |
| 563 | + } |
| 564 | + $this->profileDBOut(); |
557 | 565 | } |
558 | | - $this->profileDBOut(); |
559 | 566 | |
560 | 567 | $this->mMissingRevIDs = array_keys( $remaining ); |
561 | 568 | |
Property changes on: branches/wmf/1.17wmf1/includes/api |
___________________________________________________________________ |
Modified: svn:mergeinfo |
562 | 569 | Merged /trunk/phase3/includes/api:r89549,89574 |