array( 'WantedCategoriesPage', 'Wantedcategories' ),
array( 'WantedPagesPage', 'Wantedpages' ),
array( 'UnwatchedPagesPage', 'Unwatchedpages' ),
+ array( 'UnusedtemplatesPage', 'Unusedtemplates' ),
);
wfRunHooks( 'wgQueryPages', array( &$wgQueryPages ) );
'Unwatchedpages' => new SpecialPage( 'Unwatchedpages', 'unwatchedpages' ),
'Listredirects' => new SpecialPage( 'Listredirects' ),
'Revisiondelete' => new SpecialPage( 'Revisiondelete', 'deleterevision' ),
+ 'Unusedtemplates' => new SpecialPage( 'Unusedtemplates' ),
);
if( !$wgDisableCounters ) {
--- /dev/null
+<?php
+
+/**
+ * @package MediaWiki
+ * @subpackage Special pages
+ *
+ * @author Rob Church <robchur@gmail.com>
+ * @copyright © 2006 Rob Church
+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
+ */
+
+/* */
+require_once 'QueryPage.php';
+
+/**
+ * @package MediaWiki
+ * @subpackage SpecialPage
+ */
+
+class UnusedtemplatesPage extends QueryPage {
+
+ function getName() { return( 'Unusedtemplates' ); }
+ function isExpensive() { return( true ); }
+ function isSyndicated() { return( false ); }
+ function sortDescending() { return( false ); }
+
+ function getSQL() {
+ $dbr =& wfGetDB( DB_SLAVE );
+ extract( $dbr->tableNames( 'page', 'templatelinks' ) );
+ $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";
+ return( $sql );
+ }
+
+ function formatResult( $skin, $result ) {
+ $title = Title::makeTitle( NS_TEMPLATE, $result->title );
+ $pageLink = $skin->makeKnownLinkObj( $title, '', 'redirect=no' );
+ $wlhLink = $skin->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, 'Whatlinkshere' ), wfMsgHtml( 'unusedtemplateswlh' ), 'target=' . $title->getPrefixedUrl() );
+ return( $pageLink . ' (' . $wlhLink . ')' );
+ }
+
+ function getPageHeader() {
+ return( wfMsgHtml( 'unusedtemplatestext' ) );
+ }
+
+}
+
+function wfSpecialUnusedtemplates() {
+ list( $limit, $offset ) = wfCheckLimits();
+ $utp = new UnusedtemplatesPage();
+ $utp->doQuery( $offset, $limit );
+}
+
+?>
\ No newline at end of file
# List redirects
'listredirects' => 'List redirects',
+# Unused templates
+'unusedtemplates' => 'Unused templates',
+'unusedtemplatestext' => 'This page lists all pages in the template namespace which are not included in another page. Remember to check for other links to the templates before deleting them.',
+'unusedtemplateswlh' => 'other links',
+
# Statistics
#
'statistics' => 'Statistics',