5 * @subpackage Special pages
7 * @author Rob Church <robchur@gmail.com>
8 * @copyright © 2006 Rob Church
9 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
14 * @subpackage SpecialPage
17 class UnusedtemplatesPage
extends QueryPage
{
19 function getName() { return( 'Unusedtemplates' ); }
20 function isExpensive() { return true; }
21 function isSyndicated() { return false; }
22 function sortDescending() { return false; }
25 $dbr =& wfGetDB( DB_SLAVE
);
26 extract( $dbr->tableNames( 'page', 'templatelinks' ) );
27 $sql = "SELECT 'Unusedtemplates' AS type, page_title AS title,
28 page_namespace AS namespace, 0 AS value
30 LEFT JOIN $templatelinks
31 ON page_namespace = tl_namespace AND page_title = tl_title
32 WHERE page_namespace = 10 AND tl_from IS NULL";
36 function formatResult( $skin, $result ) {
37 $title = Title
::makeTitle( NS_TEMPLATE
, $result->title
);
38 $pageLink = $skin->makeKnownLinkObj( $title, '', 'redirect=no' );
39 $wlhLink = $skin->makeKnownLinkObj(
40 Title
::makeTitle( NS_SPECIAL
, 'Whatlinkshere' ),
41 wfMsgHtml( 'unusedtemplateswlh' ),
42 'target=' . $title->getPrefixedUrl() );
43 return wfSpecialList( $pageLink, $wlhLink );
46 function getPageHeader() {
48 return $wgOut->parse( wfMsg( 'unusedtemplatestext' ) );
53 function wfSpecialUnusedtemplates() {
54 list( $limit, $offset ) = wfCheckLimits();
55 $utp = new UnusedtemplatesPage();
56 $utp->doQuery( $offset, $limit );