MediaWiki REL1_30
SpecialUnwatchedpages.php
Go to the documentation of this file.
1<?php
29
36
37 function __construct( $name = 'Unwatchedpages' ) {
38 parent::__construct( $name, 'unwatchedpages' );
39 }
40
41 public function isExpensive() {
42 return true;
43 }
44
45 function isSyndicated() {
46 return false;
47 }
48
55 public function preprocessResults( $db, $res ) {
56 if ( !$res->numRows() ) {
57 return;
58 }
59
60 $batch = new LinkBatch();
61 foreach ( $res as $row ) {
62 $batch->add( $row->namespace, $row->title );
63 }
64 $batch->execute();
65
66 $res->seek( 0 );
67 }
68
69 public function getQueryInfo() {
71 return [
72 'tables' => [ 'page', 'watchlist' ],
73 'fields' => [
74 'namespace' => 'page_namespace',
75 'title' => 'page_title',
76 'value' => 'page_namespace'
77 ],
78 'conds' => [
79 'wl_title IS NULL',
80 'page_is_redirect' => 0,
81 'page_namespace != ' . $dbr->addQuotes( NS_MEDIAWIKI ),
82 ],
83 'join_conds' => [ 'watchlist' => [
84 'LEFT JOIN', [ 'wl_title = page_title',
85 'wl_namespace = page_namespace' ] ] ]
86 ];
87 }
88
89 function sortDescending() {
90 return false;
91 }
92
93 function getOrderFields() {
94 return [ 'page_namespace', 'page_title' ];
95 }
96
101 public function execute( $par ) {
102 parent::execute( $par );
103 $this->getOutput()->addModules( 'mediawiki.special.unwatchedPages' );
104 }
105
111 function formatResult( $skin, $result ) {
112 global $wgContLang;
113
114 $nt = Title::makeTitleSafe( $result->namespace, $result->title );
115 if ( !$nt ) {
116 return Html::element( 'span', [ 'class' => 'mw-invalidtitle' ],
117 Linker::getInvalidTitleDescription( $this->getContext(), $result->namespace, $result->title ) );
118 }
119
120 $text = $wgContLang->convert( $nt->getPrefixedText() );
121
123
124 $plink = $linkRenderer->makeKnownLink( $nt, $text );
125 $wlink = $linkRenderer->makeKnownLink(
126 $nt,
127 $this->msg( 'watch' )->text(),
128 [ 'class' => 'mw-watch-link' ],
129 [ 'action' => 'watch' ]
130 );
131
132 return $this->getLanguage()->specialList( $plink, $wlink );
133 }
134
135 protected function getGroupName() {
136 return 'maintenance';
137 }
138}
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
Definition LinkBatch.php:34
static getInvalidTitleDescription(IContextSource $context, $namespace, $title)
Get a message saying that an invalid title was encountered.
Definition Linker.php:209
This is a class for doing query pages; since they're almost all the same, we factor out some of the f...
Definition QueryPage.php:34
getOutput()
Get the OutputPage being used for this instance.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key)
Wrapper around wfMessage that sets the current context.
getLanguage()
Shortcut to get user's language.
MediaWiki Linker LinkRenderer null $linkRenderer
A special page that displays a list of pages that are not on anyones watchlist.
isSyndicated()
Sometime we don't want to build rss / atom feeds.
preprocessResults( $db, $res)
Pre-cache page existence to speed up link generation.
__construct( $name='Unwatchedpages')
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
sortDescending()
Override to sort by increasing values.
formatResult( $skin, $result)
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
getOrderFields()
Subclasses return an array of fields to order by here.
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
Result wrapper for grabbing data queried from an IDatabase object.
if(! $regexes) $dbr
Definition cleanup.php:94
$res
Definition database.txt:21
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
Definition design.txt:57
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
Definition design.txt:18
Basic database interface for live and lazy-loaded relation database handles.
Definition IDatabase.php:40
$batch
Definition linkcache.txt:23
const DB_REPLICA
Definition defines.php:25