Fix regression in even sizing of diff columns; forgot to restore a couple bits I...
[mediawiki.git] / includes / SpecialUnusedtemplates.php
blob8b72e8a7dcfb06583e2d971da40390414cf0bc00
1 <?php
3 /**
4 * implements Special:Unusedtemplates
5 * @author Rob Church <robchur@gmail.com>
6 * @copyright © 2006 Rob Church
7 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
8 * @addtogroup SpecialPage
9 */
10 class UnusedtemplatesPage extends QueryPage {
12 function getName() { return( 'Unusedtemplates' ); }
13 function isExpensive() { return true; }
14 function isSyndicated() { return false; }
15 function sortDescending() { return false; }
17 function getSQL() {
18 $dbr = wfGetDB( DB_SLAVE );
19 list( $page, $templatelinks) = $dbr->tableNamesN( 'page', 'templatelinks' );
20 $sql = "SELECT 'Unusedtemplates' AS type, page_title AS title,
21 page_namespace AS namespace, 0 AS value
22 FROM $page
23 LEFT JOIN $templatelinks
24 ON page_namespace = tl_namespace AND page_title = tl_title
25 WHERE page_namespace = 10 AND tl_from IS NULL";
26 return $sql;
29 function formatResult( $skin, $result ) {
30 $title = Title::makeTitle( NS_TEMPLATE, $result->title );
31 $pageLink = $skin->makeKnownLinkObj( $title, '', 'redirect=no' );
32 $wlhLink = $skin->makeKnownLinkObj(
33 SpecialPage::getTitleFor( 'Whatlinkshere' ),
34 wfMsgHtml( 'unusedtemplateswlh' ),
35 'target=' . $title->getPrefixedUrl() );
36 return wfSpecialList( $pageLink, $wlhLink );
39 function getPageHeader() {
40 global $wgOut;
41 return $wgOut->parse( wfMsg( 'unusedtemplatestext' ) );
46 function wfSpecialUnusedtemplates() {
47 list( $limit, $offset ) = wfCheckLimits();
48 $utp = new UnusedtemplatesPage();
49 $utp->doQuery( $offset, $limit );