3 * Implements Special:Lonelypaages
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.
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.
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
21 * @ingroup SpecialPage
24 use MediaWiki\MediaWikiServices
;
27 * A special page looking for articles with no article linking to them,
30 * @ingroup SpecialPage
32 class SpecialLonelyPages
extends PageQueryPage
{
33 function __construct( $name = 'Lonelypages' ) {
34 parent
::__construct( $name );
37 function getPageHeader() {
38 return $this->msg( 'lonelypagestext' )->parseAsBlock();
41 function sortDescending() {
45 function isExpensive() {
49 function isSyndicated() {
53 function getQueryInfo() {
54 $tables = [ 'page', 'pagelinks', 'templatelinks' ];
56 'pl_namespace IS NULL',
57 'page_namespace' => MediaWikiServices
::getInstance()->getNamespaceInfo()->
58 getContentNamespaces(),
59 'page_is_redirect' => 0,
60 'tl_namespace IS NULL'
65 'pl_namespace = page_namespace',
66 'pl_title = page_title'
71 'tl_namespace = page_namespace',
72 'tl_title = page_title'
77 // Allow extensions to modify the query
78 Hooks
::run( 'LonelyPagesQuery', [ &$tables, &$conds, &$joinConds ] );
83 'namespace' => 'page_namespace',
84 'title' => 'page_title',
85 'value' => 'page_title'
88 'join_conds' => $joinConds
92 function getOrderFields() {
93 // For some crazy reason ordering by a constant
94 // causes a filesort in MySQL 5
95 if ( count( MediaWikiServices
::getInstance()->getNamespaceInfo()->
96 getContentNamespaces() ) > 1
98 return [ 'page_namespace', 'page_title' ];
100 return [ 'page_title' ];
104 protected function getGroupName() {
105 return 'maintenance';