8 * implements Special:Unusedtemplates
9 * @author Rob Church <robchur@gmail.com>
10 * @copyright © 2006 Rob Church
11 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
12 * @ingroup SpecialPage
14 class UnusedtemplatesPage
extends QueryPage
{
16 function getName() { return( 'Unusedtemplates' ); }
17 function isExpensive() { return true; }
18 function isSyndicated() { return false; }
19 function sortDescending() { return false; }
22 $dbr = wfGetDB( DB_SLAVE
);
23 list( $page, $templatelinks) = $dbr->tableNamesN( 'page', 'templatelinks' );
24 $sql = "SELECT 'Unusedtemplates' AS type, page_title AS title,
25 page_namespace AS namespace, 0 AS value
27 LEFT JOIN $templatelinks
28 ON page_namespace = tl_namespace AND page_title = tl_title
29 WHERE page_namespace = 10 AND tl_from IS NULL
30 AND page_is_redirect = 0";
34 function formatResult( $skin, $result ) {
35 $title = Title
::makeTitle( NS_TEMPLATE
, $result->title
);
36 $pageLink = $skin->linkKnown(
40 array( 'redirect' => 'no' )
42 $wlhLink = $skin->linkKnown(
43 SpecialPage
::getTitleFor( 'Whatlinkshere' ),
44 wfMsgHtml( 'unusedtemplateswlh' ),
46 array( 'target' => $title->getPrefixedText() )
48 return wfSpecialList( $pageLink, $wlhLink );
51 function getPageHeader() {
52 return wfMsgExt( 'unusedtemplatestext', array( 'parse' ) );
57 function wfSpecialUnusedtemplates() {
58 list( $limit, $offset ) = wfCheckLimits();
59 $utp = new UnusedtemplatesPage();
60 $utp->doQuery( $offset, $limit );