00001 <?php
00014 class UnusedtemplatesPage extends QueryPage {
00015
00016 function getName() { return( 'Unusedtemplates' ); }
00017 function isExpensive() { return true; }
00018 function isSyndicated() { return false; }
00019 function sortDescending() { return false; }
00020
00021 function getSQL() {
00022 $dbr = wfGetDB( DB_SLAVE );
00023 list( $page, $templatelinks) = $dbr->tableNamesN( 'page', 'templatelinks' );
00024 $sql = "SELECT 'Unusedtemplates' AS type, page_title AS title,
00025 page_namespace AS namespace, 0 AS value
00026 FROM $page
00027 LEFT JOIN $templatelinks
00028 ON page_namespace = tl_namespace AND page_title = tl_title
00029 WHERE page_namespace = 10 AND tl_from IS NULL
00030 AND page_is_redirect = 0";
00031 return $sql;
00032 }
00033
00034 function formatResult( $skin, $result ) {
00035 $title = Title::makeTitle( NS_TEMPLATE, $result->title );
00036 $pageLink = $skin->makeKnownLinkObj( $title, '', 'redirect=no' );
00037 $wlhLink = $skin->makeKnownLinkObj(
00038 SpecialPage::getTitleFor( 'Whatlinkshere' ),
00039 wfMsgHtml( 'unusedtemplateswlh' ),
00040 'target=' . $title->getPrefixedUrl() );
00041 return wfSpecialList( $pageLink, $wlhLink );
00042 }
00043
00044 function getPageHeader() {
00045 return wfMsgExt( 'unusedtemplatestext', array( 'parse' ) );
00046 }
00047
00048 }
00049
00050 function wfSpecialUnusedtemplates() {
00051 list( $limit, $offset ) = wfCheckLimits();
00052 $utp = new UnusedtemplatesPage();
00053 $utp->doQuery( $offset, $limit );
00054 }