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
13 require_once 'QueryPage.php';
17 * @subpackage SpecialPage
20 class UnusedtemplatesPage
extends QueryPage
{
22 function getName() { return( 'Unusedtemplates' ); }
23 function isExpensive() { return( true ); }
24 function isSyndicated() { return( false ); }
25 function sortDescending() { return( false ); }
28 $dbr =& wfGetDB( DB_SLAVE
);
29 extract( $dbr->tableNames( 'page', 'templatelinks' ) );
30 $sql = "SELECT 'Unusedtemplates' AS type, page_title AS title, page_namespace AS namespace, 0 AS value FROM $page LEFT JOIN $templatelinks ON page_namespace = tl_namespace AND page_title = tl_title 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( Title
::makeTitle( NS_SPECIAL
, 'Whatlinkshere' ), wfMsgHtml( 'unusedtemplateswlh' ), 'target=' . $title->getPrefixedUrl() );
38 return( $pageLink . ' (' . $wlhLink . ')' );
41 function getPageHeader() {
42 return( wfMsgHtml( 'unusedtemplatestext' ) );
47 function wfSpecialUnusedtemplates() {
48 list( $limit, $offset ) = wfCheckLimits();
49 $utp = new UnusedtemplatesPage();
50 $utp->doQuery( $offset, $limit );