Quick fix: @fixme doesn't exist on doxygen ;)
[mediawiki.git] / includes / specials / SpecialUnusedtemplates.php
blob68bf95a27d554d0c7fdcd26c27274076867e46e5
1 <?php
2 /**
3 * Implements Special:Unusedtemplates
5 * Copyright © 2006 Rob Church
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * http://www.gnu.org/copyleft/gpl.html
22 * @file
23 * @ingroup SpecialPage
24 * @author Rob Church <robchur@gmail.com>
27 /**
28 * A special page that lists unused templates
30 * @ingroup SpecialPage
32 class UnusedtemplatesPage extends QueryPage {
34 function getName() { return( 'Unusedtemplates' ); }
35 function isExpensive() { return true; }
36 function isSyndicated() { return false; }
37 function sortDescending() { return false; }
39 function getSQL() {
40 $dbr = wfGetDB( DB_SLAVE );
41 list( $page, $templatelinks) = $dbr->tableNamesN( 'page', 'templatelinks' );
42 $sql = "SELECT 'Unusedtemplates' AS type, page_title AS title,
43 page_namespace AS namespace, 0 AS value
44 FROM $page
45 LEFT JOIN $templatelinks
46 ON page_namespace = tl_namespace AND page_title = tl_title
47 WHERE page_namespace = 10 AND tl_from IS NULL
48 AND page_is_redirect = 0";
49 return $sql;
52 function formatResult( $skin, $result ) {
53 $title = Title::makeTitle( NS_TEMPLATE, $result->title );
54 $pageLink = $skin->linkKnown(
55 $title,
56 null,
57 array(),
58 array( 'redirect' => 'no' )
60 $wlhLink = $skin->linkKnown(
61 SpecialPage::getTitleFor( 'Whatlinkshere' ),
62 wfMsgHtml( 'unusedtemplateswlh' ),
63 array(),
64 array( 'target' => $title->getPrefixedText() )
66 return wfSpecialList( $pageLink, $wlhLink );
69 function getPageHeader() {
70 return wfMsgExt( 'unusedtemplatestext', array( 'parse' ) );
75 function wfSpecialUnusedtemplates() {
76 list( $limit, $offset ) = wfCheckLimits();
77 $utp = new UnusedtemplatesPage();
78 $utp->doQuery( $offset, $limit );