Restored line accidentally removed in r70520
[mediawiki.git] / includes / specials / SpecialUnwatchedpages.php
blob71bdee8a9709e64f608f1d9830764fe709130c7e
1 <?php
2 /**
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 * http://www.gnu.org/copyleft/gpl.html
20 /**
21 * @file
22 * @ingroup SpecialPage
25 /**
26 * A special page that displays a list of pages that are not on anyones watchlist.
27 * Implements Special:Unwatchedpages
29 * @ingroup SpecialPage
30 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
31 * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
32 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
34 class UnwatchedpagesPage extends QueryPage {
36 function getName() { return 'Unwatchedpages'; }
37 function isExpensive() { return true; }
38 function isSyndicated() { return false; }
40 function getSQL() {
41 $dbr = wfGetDB( DB_SLAVE );
42 list( $page, $watchlist ) = $dbr->tableNamesN( 'page', 'watchlist' );
43 $mwns = NS_MEDIAWIKI;
44 return
46 SELECT
47 'Unwatchedpages' as type,
48 page_namespace as namespace,
49 page_title as title,
50 page_namespace as value
51 FROM $page
52 LEFT JOIN $watchlist ON wl_namespace = page_namespace AND page_title = wl_title
53 WHERE wl_title IS NULL AND page_is_redirect = 0 AND page_namespace<>$mwns
57 function sortDescending() { return false; }
59 function formatResult( $skin, $result ) {
60 global $wgContLang;
62 $nt = Title::makeTitle( $result->namespace, $result->title );
63 $text = $wgContLang->convert( $nt->getPrefixedText() );
65 $plink = $skin->linkKnown(
66 $nt,
67 htmlspecialchars( $text )
69 $wlink = $skin->linkKnown(
70 $nt,
71 wfMsgHtml( 'watch' ),
72 array(),
73 array( 'action' => 'watch' )
76 return wfSpecialList( $plink, $wlink );
80 /**
81 * constructor
83 function wfSpecialUnwatchedpages() {
84 global $wgUser, $wgOut;
86 if ( ! $wgUser->isAllowed( 'unwatchedpages' ) )
87 return $wgOut->permissionRequired( 'unwatchedpages' );
89 list( $limit, $offset ) = wfCheckLimits();
91 $wpp = new UnwatchedpagesPage();
93 $wpp->doQuery( $offset, $limit );