Index: trunk/extensions/OAI/OAIRepo_body.php |
— | — | @@ -578,18 +578,11 @@ |
579 | 579 | function fetchRecord( $pageid ) { |
580 | 580 | $db = $this->_db; |
581 | 581 | |
582 | | - $tables = array( 'updates', 'page', 'revision', 'text' ); |
583 | | - $fields = array( 'page_namespace', 'page_title', 'old_text', 'old_flags', |
584 | | - 'rev_id', 'rev_deleted', 'rev_comment', 'rev_user', |
585 | | - 'rev_user_text', 'rev_timestamp', 'page_restrictions', |
586 | | - 'rev_minor_edit', 'page_is_redirect', 'up_sequence', |
587 | | - 'page_id', 'up_timestamp', 'up_action', 'up_page', |
588 | | - 'page_len', 'page_touched', 'page_counter', 'page_latest',); |
| 582 | + $tables = $this->getTables(); |
| 583 | + $fields = $this->getFields(); |
589 | 584 | $conds = array(); |
590 | 585 | $options = array(); |
591 | | - $join_conds = array( 'page' => array( 'LEFT JOIN', 'page_id=up_page' ), |
592 | | - 'revision' => array( 'LEFT JOIN', 'page_latest=rev_id' ), |
593 | | - 'text' => array( 'LEFT JOIN', 'rev_text_id=old_id' ) ); |
| 586 | + $join_conds = $this->getJoinConds(); |
594 | 587 | |
595 | 588 | $conds['up_page'] = $pageid; |
596 | 589 | |
— | — | @@ -602,22 +595,44 @@ |
603 | 596 | $options, $join_conds ); |
604 | 597 | } |
605 | 598 | |
| 599 | + /** |
| 600 | + * @return array |
| 601 | + */ |
| 602 | + private function getFields() { |
| 603 | + return array( 'page_namespace', 'page_title', 'old_text', 'old_flags', |
| 604 | + 'rev_id', 'rev_deleted', 'rev_comment', 'rev_user', |
| 605 | + 'rev_user_text', 'rev_timestamp', 'page_restrictions', |
| 606 | + 'rev_minor_edit', 'rev_len', 'page_is_redirect', 'up_sequence', |
| 607 | + 'page_id', 'up_timestamp', 'up_action', 'up_page', |
| 608 | + 'page_len', 'page_touched', 'page_counter', 'page_latest' |
| 609 | + ); |
| 610 | + } |
| 611 | + |
| 612 | + /** |
| 613 | + * @return array |
| 614 | + */ |
| 615 | + private function getJoinConds() { |
| 616 | + return array( 'page' => array( 'LEFT JOIN', 'page_id=up_page' ), |
| 617 | + 'revision' => array( 'LEFT JOIN', 'page_latest=rev_id' ), |
| 618 | + 'text' => array( 'LEFT JOIN', 'rev_text_id=old_id' ) |
| 619 | + ); |
| 620 | + } |
| 621 | + |
| 622 | + /** |
| 623 | + * @return array |
| 624 | + */ |
| 625 | + private function getTables() { |
| 626 | + return array( 'updates', 'page', 'revision', 'text' ); |
| 627 | + } |
| 628 | + |
606 | 629 | function fetchRows( $from, $until, $chunk, $token = null ) { |
607 | 630 | |
608 | 631 | $db = $this->_db; |
609 | | - |
610 | | - $tables = array( 'updates', 'page', 'revision', 'text' ); |
611 | | - $fields = array( 'page_namespace', 'page_title', 'old_text', 'old_flags', |
612 | | - 'rev_id', 'rev_deleted', 'rev_comment', 'rev_user', |
613 | | - 'rev_user_text', 'rev_timestamp', 'page_restrictions', |
614 | | - 'rev_minor_edit', 'page_is_redirect', 'up_sequence', |
615 | | - 'page_id', 'up_timestamp', 'up_action', 'up_page', |
616 | | - 'page_len', 'page_touched', 'page_counter', 'page_latest',); |
| 632 | + $tables = $this->getTables(); |
| 633 | + $fields = $this->getFields(); |
617 | 634 | $conds = array(); |
618 | 635 | $options = array(); |
619 | | - $join_conds = array( 'page' => array( 'LEFT JOIN', 'page_id=up_page' ), |
620 | | - 'revision' => array( 'LEFT JOIN', 'page_latest=rev_id' ), |
621 | | - 'text' => array( 'LEFT JOIN', 'rev_text_id=old_id' ) ); |
| 636 | + $join_conds = $this->getJoinConds(); |
622 | 637 | |
623 | 638 | if( $token ) { |
624 | 639 | $conds[] = 'up_sequence>=' . $db->addQuotes( $token ); |