MediaWiki REL1_33
SpecialUnusedtemplates.php
Go to the documentation of this file.
1<?php
33 function __construct( $name = 'Unusedtemplates' ) {
34 parent::__construct( $name );
35 }
36
37 public function isExpensive() {
38 return true;
39 }
40
41 function isSyndicated() {
42 return false;
43 }
44
45 function sortDescending() {
46 return false;
47 }
48
49 function getOrderFields() {
50 return [ 'title' ];
51 }
52
53 public function getQueryInfo() {
54 return [
55 'tables' => [ 'page', 'templatelinks' ],
56 'fields' => [
57 'namespace' => 'page_namespace',
58 'title' => 'page_title',
59 ],
60 'conds' => [
61 'page_namespace' => NS_TEMPLATE,
62 'tl_from IS NULL',
63 'page_is_redirect' => 0
64 ],
65 'join_conds' => [ 'templatelinks' => [
66 'LEFT JOIN', [ 'tl_title = page_title',
67 'tl_namespace = page_namespace' ] ] ]
68 ];
69 }
70
76 function formatResult( $skin, $result ) {
78 $title = Title::makeTitle( NS_TEMPLATE, $result->title );
79 $pageLink = $linkRenderer->makeKnownLink(
80 $title,
81 null,
82 [],
83 [ 'redirect' => 'no' ]
84 );
85 $wlhLink = $linkRenderer->makeKnownLink(
86 SpecialPage::getTitleFor( 'Whatlinkshere', $title->getPrefixedText() ),
87 $this->msg( 'unusedtemplateswlh' )->text()
88 );
89
90 return $this->getLanguage()->specialList( $pageLink, $wlhLink );
91 }
92
93 function getPageHeader() {
94 return $this->msg( 'unusedtemplatestext' )->parseAsBlock();
95 }
96
97 protected function getGroupName() {
98 return 'maintenance';
99 }
100}
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:35
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
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 lists unused templates.
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
__construct( $name='Unusedtemplates')
sortDescending()
Override to sort by increasing values.
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.
isSyndicated()
Sometime we don't want to build rss / atom feeds.
getPageHeader()
The content returned by this function will be output before any result.
const NS_TEMPLATE
Definition Defines.php:83