Index: trunk/extensions/OAI/OAIRepo_body.php |
— | — | @@ -645,25 +645,25 @@ |
646 | 646 | |
647 | 647 | function fetchReferenceData( $rows ) { |
648 | 648 | $page_ids = array(); |
649 | | - foreach($rows as $row){ |
| 649 | + foreach( $rows as $row ){ |
650 | 650 | $page_ids[] = $row->up_page; |
651 | 651 | } |
652 | 652 | |
653 | | - if(count($page_ids) == 1) |
654 | | - $pages_where = " AND up_page = $page_ids[0] "; |
655 | | - else |
656 | | - $pages_where = " AND up_page IN (".implode(",",$page_ids).") "; |
| 653 | + $res = $this->_db->select( |
| 654 | + array( 'updates', 'page', 'redirect' ), |
| 655 | + array( 'up_page,up_sequence', 'rp.page_namespace AS page_namespace', |
| 656 | + 'rp.page_title AS page_title' ), |
| 657 | + array( |
| 658 | + 'u.up_page=p.page_id', |
| 659 | + 'p.page_namespace=r.rd_namespace', |
| 660 | + 'p.page_title=r.rd_title', |
| 661 | + 'r.rd_from=rp.page_id', |
| 662 | + 'up_page' => $page_ids |
| 663 | + ), |
| 664 | + __METHOD__ |
| 665 | + ); |
657 | 666 | |
658 | | - extract( $this->_db->tableNames( 'updates', 'page', 'redirect' ) ); |
659 | | - $sql = "SELECT up_page,up_sequence, |
660 | | - rp.page_namespace AS page_namespace, |
661 | | - rp.page_title AS page_title |
662 | | - FROM $updates AS u, $page AS p, $redirect AS r, $page AS rp |
663 | | - WHERE u.up_page=p.page_id AND p.page_namespace=r.rd_namespace |
664 | | - AND p.page_title=r.rd_title AND r.rd_from=rp.page_id |
665 | | - $pages_where"; |
666 | | - |
667 | | - return $this->_db->resultObject( $this->_db->query( $sql ) ); |
| 667 | + return $this->_db->resultObject( $res ); |
668 | 668 | } |
669 | 669 | |
670 | 670 | |