Index: trunk/extensions/OAI/OAIRepo_body.php |
— | — | @@ -659,20 +659,13 @@ |
660 | 660 | else |
661 | 661 | $pages_where = " AND up_page IN (".implode(",",$page_ids).") "; |
662 | 662 | |
663 | | - extract( $this->_db->tableNames( 'updates', 'page', 'pagelinks' ) ); |
| 663 | + extract( $this->_db->tableNames( 'updates', 'page', 'redirect' ) ); |
664 | 664 | $sql = "SELECT up_page,up_sequence, |
665 | | - r.page_namespace AS page_namespace, |
666 | | - r.page_title AS page_title, |
667 | | - COUNT(pl.pl_from) AS num_page_ref |
668 | | - FROM $updates |
669 | | - LEFT JOIN $page AS p ON p.page_id=up_page |
670 | | - LEFT JOIN $pagelinks AS pl ON p.page_namespace=pl.pl_namespace AND p.page_title=pl.pl_title |
671 | | - LEFT JOIN $page AS ns ON pl.pl_from=ns.page_id |
672 | | - LEFT JOIN $page AS r ON pl.pl_from=r.page_id AND r.page_is_redirect=1 |
673 | | - LEFT JOIN $pagelinks AS rpl ON r.page_namespace=rpl.pl_namespace AND r.page_title=rpl.pl_title |
674 | | - WHERE p.page_namespace != 0 OR p.page_namespace = ns.page_namespace |
675 | | - $pages_where |
676 | | - GROUP BY up_page,r.page_id"; |
| 665 | + rp.page_namespace AS page_namespace, |
| 666 | + rp.page_title AS page_title |
| 667 | + FROM $updates AS u, $page AS p, $redirect AS r, $page AS rp |
| 668 | + WHERE u.up_page=p.page_id AND p.page_namespace=r.rd_namespace |
| 669 | + AND p.page_title=r.rd_title AND r.rd_from=rp.page_id"; |
677 | 670 | |
678 | 671 | return $this->_db->resultObject( $this->_db->query( $sql ) ); |
679 | 672 | } |
— | — | @@ -954,14 +947,9 @@ |
955 | 948 | function __construct($resultSet){ |
956 | 949 | parent::__construct(); |
957 | 950 | $this->_redirects = array(); |
958 | | - $this->_references = array(); |
959 | 951 | for($i = 0 ; $i < $resultSet->numRows(); $i++){ |
960 | 952 | $row = $resultSet->fetchObject(); |
961 | | - if(isset($row->page_title)) |
962 | | - $this->_redirects[$row->up_page][] = $row; |
963 | | - else |
964 | | - $this->_references[$row->up_page] = $row; |
965 | | - |
| 953 | + $this->_redirects[$row->up_page][] = $row; |
966 | 954 | } |
967 | 955 | } |
968 | 956 | |
— | — | @@ -982,11 +970,8 @@ |
983 | 971 | |
984 | 972 | function openPage( $row ) { |
985 | 973 | $out = parent::openPage( $row ); |
986 | | - if(isset($this->_references[$row->up_page]) && isset($this->_references[$row->up_page]->num_page_ref)) |
987 | | - $page_ref = $this->_references[$row->up_page]->num_page_ref; |
988 | | - else |
989 | | - $page_ref = 0; |
990 | | - $out .= ' ' . wfElement( 'references', array(), strval( $page_ref ) ) . "\n"; |
| 974 | + if(isset($row->num_page_ref)) |
| 975 | + $out .= ' ' . wfElement( 'references', array(), strval( $row->num_page_ref ) ) . "\n"; |
991 | 976 | return $out; |
992 | 977 | } |
993 | 978 | |