Index: trunk/phase3/includes/api/ApiPageSet.php |
— | — | @@ -451,17 +451,19 @@ |
452 | 452 | |
453 | 453 | $pageids = self::getPositiveIntegers( $pageids ); |
454 | 454 | |
455 | | - $set = array( |
456 | | - 'page_id' => $pageids |
457 | | - ); |
458 | | - $db = $this->getDB(); |
| 455 | + if ( count( $pageids ) ) { |
| 456 | + $set = array( |
| 457 | + 'page_id' => $pageids |
| 458 | + ); |
| 459 | + $db = $this->getDB(); |
459 | 460 | |
460 | | - // Get pageIDs data from the `page` table |
461 | | - $this->profileDBIn(); |
462 | | - $res = $db->select( 'page', $this->getPageTableFields(), $set, |
463 | | - __METHOD__ ); |
464 | | - $this->profileDBOut(); |
465 | | - |
| 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 | + |
466 | 468 | $this->initFromQueryResult( $res, $remaining, false ); // process PageIDs |
467 | 469 | |
468 | 470 | // Resolve any found redirects |
— | — | @@ -540,21 +542,23 @@ |
541 | 543 | |
542 | 544 | $revids = self::getPositiveIntegers( $revids ); |
543 | 545 | |
544 | | - $tables = array( 'revision', 'page' ); |
545 | | - $fields = array( 'rev_id', 'rev_page' ); |
546 | | - $where = array( 'rev_id' => $revids, 'rev_page = page_id' ); |
| 546 | + if ( count( $revids ) ) { |
| 547 | + $tables = array( 'revision', 'page' ); |
| 548 | + $fields = array( 'rev_id', 'rev_page' ); |
| 549 | + $where = array( 'rev_id' => $revids, 'rev_page = page_id' ); |
547 | 550 | |
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] ); |
| 551 | + // Get pageIDs data from the `page` table |
| 552 | + $this->profileDBIn(); |
| 553 | + $res = $db->select( $tables, $fields, $where, __METHOD__ ); |
| 554 | + foreach ( $res as $row ) { |
| 555 | + $revid = intval( $row->rev_id ); |
| 556 | + $pageid = intval( $row->rev_page ); |
| 557 | + $this->mGoodRevIDs[$revid] = $pageid; |
| 558 | + $pageids[$pageid] = ''; |
| 559 | + unset( $remaining[$revid] ); |
| 560 | + } |
| 561 | + $this->profileDBOut(); |
557 | 562 | } |
558 | | - $this->profileDBOut(); |
559 | 563 | |
560 | 564 | $this->mMissingRevIDs = array_keys( $remaining ); |
561 | 565 | |