Don't list pages from the MediaWiki namespace, it makes updateSpecialPages.php take...
[lhc/web/wiklou.git] / includes / SpecialUnwatchedpages.php
1 <?php
2 /**
3 * A special page that displays a list of pages that are not on anyones watchlist
4 *
5 * @package MediaWiki
6 * @subpackage SpecialPage
7 *
8 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
9 * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
10 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
11 */
12
13 /* */
14 require_once 'QueryPage.php';
15
16 /**
17 * @package MediaWiki
18 * @subpackage SpecialPage
19 */
20 class UnwatchedpagesPage extends QueryPage {
21
22 function getName() { return 'Unwatchedpages'; }
23 function isExpensive() { return true; }
24 function isSyndicated() { return false; }
25
26 function getSQL() {
27 $dbr =& wfGetDB( DB_SLAVE );
28 extract( $dbr->tableNames( 'page', 'watchlist' ) );
29 $mwns = NS_MEDIAWIKI;
30 return
31 "
32 SELECT
33 'Unwatchedpages' as type,
34 page_namespace as namespace,
35 page_title as title,
36 page_namespace as value
37 FROM $page
38 LEFT JOIN $watchlist ON wl_namespace = page_namespace AND page_title = wl_title
39 WHERE wl_title IS NULL AND page_is_redirect = 0 AND page_namespace<>$mwns
40 ";
41 }
42
43 function sortDescending() { return false; }
44
45 function formatResult( $skin, $result ) {
46 global $wgContLang;
47
48 $nt = Title::makeTitle( $result->namespace, $result->title );
49 $text = $wgContLang->convert( $nt->getPrefixedText() );
50
51 $plink = $skin->makeKnownLinkObj( $nt, htmlspecialchars( $text ) );
52 $wlink = $skin->makeKnownLinkObj( $nt, wfMsgHtml( 'watch' ), 'action=watch' );
53
54 return $plink . ' (' . $wlink . ')';
55 }
56 }
57
58 /**
59 * constructor
60 */
61 function wfSpecialUnwatchedpages() {
62 global $wgUser, $wgOut;
63
64 if ( ! $wgUser->isAllowed( 'unwatchedpages' ) )
65 return $wgOut->permissionRequired( 'unwatchedpages' );
66
67 list( $limit, $offset ) = wfCheckLimits();
68
69 $wpp = new UnwatchedpagesPage();
70
71 $wpp->doQuery( $offset, $limit );
72 }
73
74 ?>