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->makeKnownLinkObj( $title, '', 'redirect=no' );
37 $wlhLink = $skin->makeKnownLinkObj(
38 SpecialPage
::getTitleFor( 'Whatlinkshere' ),
39 wfMsgHtml( 'unusedtemplateswlh' ),
40 'target=' . $title->getPrefixedUrl() );
41 return wfSpecialList( $pageLink, $wlhLink );
44 function getPageHeader() {
45 return wfMsgExt( 'unusedtemplatestext', array( 'parse' ) );
50 function wfSpecialUnusedtemplates() {
51 list( $limit, $offset ) = wfCheckLimits();
52 $utp = new UnusedtemplatesPage();
53 $utp->doQuery( $offset, $limit );