4 * @addtogroup Special pages
6 * @author Rob Church <robchur@gmail.com>
7 * @copyright © 2006 Rob Church
8 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
12 * @addtogroup SpecialPage
15 class UnusedtemplatesPage
extends QueryPage
{
17 function getName() { return( 'Unusedtemplates' ); }
18 function isExpensive() { return true; }
19 function isSyndicated() { return false; }
20 function sortDescending() { return false; }
23 $dbr = wfGetDB( DB_SLAVE
);
24 list( $page, $templatelinks) = $dbr->tableNamesN( 'page', 'templatelinks' );
25 $sql = "SELECT 'Unusedtemplates' AS type, page_title AS title,
26 page_namespace AS namespace, 0 AS value
28 LEFT JOIN $templatelinks
29 ON page_namespace = tl_namespace AND page_title = tl_title
30 WHERE page_namespace = 10 AND tl_from IS NULL";
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() {
46 return $wgOut->parse( wfMsg( 'unusedtemplatestext' ) );
51 function wfSpecialUnusedtemplates() {
52 list( $limit, $offset ) = wfCheckLimits();
53 $utp = new UnusedtemplatesPage();
54 $utp->doQuery( $offset, $limit );