26bf48cb4d577292de9b7da7f66aa223dbd62582
4 * implements Special:Unusedtemplates
5 * @author Rob Church <robchur@gmail.com>
6 * @copyright © 2006 Rob Church
7 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
8 * @addtogroup SpecialPage
10 class UnusedtemplatesPage
extends QueryPage
{
12 function getName() { return( 'Unusedtemplates' ); }
13 function isExpensive() { return true; }
14 function isSyndicated() { return false; }
15 function sortDescending() { return false; }
18 $dbr = wfGetDB( DB_SLAVE
);
19 list( $page, $templatelinks) = $dbr->tableNamesN( 'page', 'templatelinks' );
20 $sql = "SELECT 'Unusedtemplates' AS type, page_title AS title,
21 page_namespace AS namespace, 0 AS value
23 LEFT JOIN $templatelinks
24 ON page_namespace = tl_namespace AND page_title = tl_title
25 WHERE page_namespace = 10 AND tl_from IS NULL";
29 function formatResult( $skin, $result ) {
30 $title = Title
::makeTitle( NS_TEMPLATE
, $result->title
);
31 $pageLink = $skin->makeKnownLinkObj( $title, '', 'redirect=no' );
32 $wlhLink = $skin->makeKnownLinkObj(
33 SpecialPage
::getTitleFor( 'Whatlinkshere' ),
34 wfMsgHtml( 'unusedtemplateswlh' ),
35 'target=' . $title->getPrefixedUrl() );
36 return wfSpecialList( $pageLink, $wlhLink );
39 function getPageHeader() {
40 return wfMsgExt( 'unusedtemplatestext', array( 'parse' ) );
45 function wfSpecialUnusedtemplates() {
46 list( $limit, $offset ) = wfCheckLimits();
47 $utp = new UnusedtemplatesPage();
48 $utp->doQuery( $offset, $limit );