Followup r80122, protected, just incase it's needed..
[lhc/web/wiklou.git] / includes / specials / SpecialBrokenRedirects.php
index 873125b..ddd6d48 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 /**
+ * Implements Special:Brokenredirects
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup SpecialPage
  */
 
 /**
  * A special page listing redirects tonon existent page. Those should be
  * fixed to point to an existing page.
  *
- * @file
  * @ingroup SpecialPage
  */
 class BrokenRedirectsPage extends PageQueryPage {
-       var $targets = array();
 
-       function getName() {
-               return 'BrokenRedirects';
+       function __construct( $name = 'BrokenRedirects' ) {
+               parent::__construct( $name );
        }
-
-       function isExpensive( ) { return true; }
+       
+       function isExpensive() { return true; }
        function isSyndicated() { return false; }
+       function sortDescending() { return false; }
 
-       function getPageHeader( ) {
+       function getPageHeader() {
                return wfMsgExt( 'brokenredirectstext', array( 'parse' ) );
        }
 
-       function getSQL() {
-               $dbr = wfGetDB( DB_SLAVE );
-               list( $page, $redirect ) = $dbr->tableNamesN( 'page', 'redirect' );
-
-               $sql = "SELECT 'BrokenRedirects'  AS type,
-                               p1.page_namespace AS namespace,
-                               p1.page_title     AS title,
-                               rd_namespace,
-                               rd_title
-                          FROM $redirect AS rd
-                     JOIN $page p1 ON (rd.rd_from=p1.page_id)
-                     LEFT JOIN $page AS p2 ON (rd_namespace=p2.page_namespace AND rd_title=p2.page_title )
-                                 WHERE rd_namespace >= 0
-                                   AND p2.page_namespace IS NULL";
-               return $sql;
+       function getQueryInfo() {
+               return array(
+                       'tables' => array( 'redirect', 'p1' => 'page',
+                                       'p2' => 'page' ),
+                       'fields' => array( 'p1.page_namespace AS namespace',
+                                       'p1.page_title AS title',
+                                       'rd_namespace',
+                                       'rd_title'
+                       ),
+                       'conds' => array( 'rd_namespace >= 0',
+                                       'p2.page_namespace IS NULL'
+                       ),
+                       'join_conds' => array( 'p1' => array( 'LEFT JOIN', array(
+                                               'rd_from=p1.page_id',
+                                       ) ),
+                                       'p2' => array( 'LEFT JOIN', array(
+                                               'rd_namespace=p2.page_namespace',
+                                               'rd_title=p2.page_title'
+                                       ) )
+                       )
+               );
        }
 
-       function getOrder() {
-               return '';
+       function getOrderFields() {
+               return array ( 'rd_namespace', 'rd_title', 'rd_from' );
        }
 
        function formatResult( $skin, $result ) {
@@ -117,14 +126,3 @@ class BrokenRedirectsPage extends PageQueryPage {
                return $out;
        }
 }
-
-/**
- * constructor
- */
-function wfSpecialBrokenRedirects() {
-       list( $limit, $offset ) = wfCheckLimits();
-
-       $sbr = new BrokenRedirectsPage();
-
-       return $sbr->doQuery( $offset, $limit );
-}