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->linkKnown(
00037 $title,
00038 null,
00039 array(),
00040 array( 'redirect' => 'no' )
00041 );
00042 $wlhLink = $skin->linkKnown(
00043 SpecialPage::getTitleFor( 'Whatlinkshere' ),
00044 wfMsgHtml( 'unusedtemplateswlh' ),
00045 array(),
00046 array( 'target' => $title->getPrefixedText() )
00047 );
00048 return wfSpecialList( $pageLink, $wlhLink );
00049 }
00050
00051 function getPageHeader() {
00052 return wfMsgExt( 'unusedtemplatestext', array( 'parse' ) );
00053 }
00054
00055 }
00056
00057 function wfSpecialUnusedtemplates() {
00058 list( $limit, $offset ) = wfCheckLimits();
00059 $utp = new UnusedtemplatesPage();
00060 $utp->doQuery( $offset, $limit );
00061 }