Allow aliased field names with separated syntax
[lhc/web/wiklou.git] / includes / specials / SpecialLonelypages.php
1 <?php
2 /**
3 * Implements Special:Lonelypaages
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 * @ingroup SpecialPage
22 */
23
24 /**
25 * A special page looking for articles with no article linking to them,
26 * thus being lonely.
27 *
28 * @ingroup SpecialPage
29 */
30 class LonelyPagesPage extends PageQueryPage {
31
32 function __construct( $name = 'Lonelypages' ) {
33 parent::__construct( $name );
34 }
35
36 function getPageHeader() {
37 return $this->msg( 'lonelypagestext' )->parseAsBlock();
38 }
39
40 function sortDescending() {
41 return false;
42 }
43
44 function isExpensive() {
45 return true;
46 }
47 function isSyndicated() { return false; }
48
49 function getQueryInfo() {
50 return array (
51 'tables' => array ( 'page', 'pagelinks',
52 'templatelinks' ),
53 'fields' => array ( 'namespace' => 'page_namespace',
54 'title' => 'page_title',
55 'value' => 'page_title' ),
56 'conds' => array ( 'pl_namespace IS NULL',
57 'page_namespace' => MWNamespace::getContentNamespaces(),
58 'page_is_redirect' => 0,
59 'tl_namespace IS NULL' ),
60 'join_conds' => array (
61 'pagelinks' => array (
62 'LEFT JOIN', array (
63 'pl_namespace = page_namespace',
64 'pl_title = page_title' ) ),
65 'templatelinks' => array (
66 'LEFT JOIN', array (
67 'tl_namespace = page_namespace',
68 'tl_title = page_title' ) ) )
69 );
70 }
71
72 function getOrderFields() {
73 // For some crazy reason ordering by a constant
74 // causes a filesort in MySQL 5
75 if( count( MWNamespace::getContentNamespaces() ) > 1 ) {
76 return array( 'page_namespace', 'page_title' );
77 } else {
78 return array( 'page_title' );
79 }
80 }
81 }