Index: trunk/extensions/CrossNamespaceLinks/CrossNamespaceLinks_body.php |
— | — | @@ -1,33 +1,8 @@ |
2 | 2 | <?php |
3 | 3 | if (!defined('MEDIAWIKI')) die(); |
4 | 4 | |
5 | | -global $wgHooks, $IP; |
6 | | - |
7 | | -require_once "$IP/includes/QueryPage.php"; |
8 | | - |
9 | | -class CrossNamespaceLinks extends SpecialPage { |
| 5 | +class CrossNamespaceLinks extends QueryPage { |
10 | 6 | /** |
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 | | - /** |
32 | 7 | * An inclusive list of namespaces that are acceptable for a |
33 | 8 | * page in the main namespace on Wikimedia sites (Wikipedia) to |
34 | 9 | * link to. |
— | — | @@ -62,7 +37,10 @@ |
63 | 38 | //NS_CATEGORY |
64 | 39 | ); |
65 | 40 | |
66 | | - function getName() { return 'CrossNamespaceLinks'; } |
| 41 | + public function __construct( $name = 'CrossNamespaceLinks' ) { |
| 42 | + parent::__construct( $name ); |
| 43 | + } |
| 44 | + |
67 | 45 | function isExpensive() { return true; } |
68 | 46 | function isSyndicated() { return false; } |
69 | 47 | |
— | — | @@ -87,12 +65,12 @@ |
88 | 66 | return array( |
89 | 67 | 'tables' => array( 'page', 'pagelinks' ), |
90 | 68 | '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' ), |
92 | 70 | 'conds' => array( 'page_is_redirect' => 0, |
93 | 71 | 'page_namespace' => NS_MAIN, |
94 | 72 | 'pl_namespace NOT' => $this->namespaces ), |
95 | 73 | 'join_conds' => array( |
96 | | - 'page' => array( 'LEFT JOIN' => array( 'page_id=pl_from' ) ) |
| 74 | + 'page' => array( 'LEFT JOIN', array( 'page_id=pl_from' ) ) |
97 | 75 | ) |
98 | 76 | ); |
99 | 77 | } |