r78812 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78811‎ | r78812 | r78813 >
Date:18:00, 22 December 2010
Author:catrope
Status:ok
Tags:
Comment:
Fix query error in CrossNamespaceLinks, unify QueryPage and SpecialPage while I'm at it
Modified paths:
  • /trunk/extensions/CrossNamespaceLinks/CrossNamespaceLinks_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CrossNamespaceLinks/CrossNamespaceLinks_body.php
@@ -1,33 +1,8 @@
22 <?php
33 if (!defined('MEDIAWIKI')) die();
44
5 -global $wgHooks, $IP;
6 -
7 -require_once "$IP/includes/QueryPage.php";
8 -
9 -class CrossNamespaceLinks extends SpecialPage {
 5+class CrossNamespaceLinks extends QueryPage {
106 /**
11 - * Constructor
12 - */
13 - function __construct() {
14 - parent::__construct( 'CrossNamespaceLinks' );
15 - }
16 -
17 - /**
18 - * main()
19 - */
20 - function execute( $parameters ) {
21 - $this->setHeaders();
22 - list( $limit, $offset ) = wfCheckLimits();
23 -
24 - $cnl = new CrossNamespaceLinksPage();
25 -
26 - $cnl->doQuery( $offset, $limit );
27 - }
28 -}
29 -
30 -class CrossNamespaceLinksPage extends QueryPage {
31 - /**
327 * An inclusive list of namespaces that are acceptable for a
338 * page in the main namespace on Wikimedia sites (Wikipedia) to
349 * link to.
@@ -62,7 +37,10 @@
6338 //NS_CATEGORY
6439 );
6540
66 - function getName() { return 'CrossNamespaceLinks'; }
 41+ public function __construct( $name = 'CrossNamespaceLinks' ) {
 42+ parent::__construct( $name );
 43+ }
 44+
6745 function isExpensive() { return true; }
6846 function isSyndicated() { return false; }
6947
@@ -87,12 +65,12 @@
8866 return array(
8967 'tables' => array( 'page', 'pagelinks' ),
9068 'fields' => array( 'COUNT(*) AS namespace', 'page_title AS title', 'pl_namespace AS value' ),
91 - 'options' => array ( 'GROUP BY' => 'page_id' ),
 69+ 'options' => array( 'GROUP BY' => 'page_id' ),
9270 'conds' => array( 'page_is_redirect' => 0,
9371 'page_namespace' => NS_MAIN,
9472 'pl_namespace NOT' => $this->namespaces ),
9573 'join_conds' => array(
96 - 'page' => array( 'LEFT JOIN' => array( 'page_id=pl_from' ) )
 74+ 'page' => array( 'LEFT JOIN', array( 'page_id=pl_from' ) )
9775 )
9876 );
9977 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r78813Fix r78812: update class namecatrope18:04, 22 December 2010

Status & tagging log