Moved the bulk of dbsource() to Database.php. Added support for updating wikis with...
[mediawiki.git] / includes / SpecialUnwatchedpages.php
blob1111f1ca294f3d747962597daee0b42cfe586e4d
1 <?php
2 /**
3 * A special page that displays a list of pages that are not on anyones watchlist
5 * @package MediaWiki
6 * @subpackage SpecialPage
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
13 /* */
14 require_once 'QueryPage.php';
16 /**
17 * @package MediaWiki
18 * @subpackage SpecialPage
20 class UnwatchedpagesPage extends QueryPage {
22 function getName() { return 'Unwatchedpages'; }
23 function isExpensive() { return true; }
24 function isSyndicated() { return false; }
26 function getSQL() {
27 $dbr =& wfGetDB( DB_SLAVE );
28 extract( $dbr->tableNames( 'page', 'watchlist' ) );
29 return
31 SELECT
32 'Unwatchedpages' as type,
33 page_namespace as namespace,
34 page_title as title,
35 page_namespace as value
36 FROM $page
37 LEFT JOIN $watchlist ON wl_namespace = page_namespace AND page_title = wl_title
38 WHERE wl_title IS NULL AND page_is_redirect = 0
42 function sortDescending() { return false; }
44 function formatResult( $skin, $result ) {
45 global $wgContLang;
47 $nt = Title::makeTitle( $result->namespace, $result->title );
48 $text = $wgContLang->convert( $nt->getPrefixedText() );
50 $plink = $skin->makeKnownLinkObj( $nt, htmlspecialchars( $text ) );
51 $wlink = $skin->makeKnownLinkObj( $nt, wfMsgHtml( 'watch' ), 'action=watch' );
53 return $plink . ' (' . $wlink . ')';
57 /**
58 * constructor
60 function wfSpecialUnwatchedpages() {
61 global $wgUser, $wgOut;
63 if ( ! $wgUser->isAllowed( 'unwatchedpages' ) )
64 return $wgOut->permissionRequired( 'unwatchedpages' );
66 list( $limit, $offset ) = wfCheckLimits();
68 $wpp = new UnwatchedpagesPage();
70 $wpp->doQuery( $offset, $limit );