* (bug 14258, 14368) Fix for subpage renames in replication environments
[lhc/web/wiklou.git] / includes / SpecialUnusedtemplates.php
index 422c5a2..89acd09 100644 (file)
@@ -1,22 +1,16 @@
 <?php
+/**
+ * @file
+ * @ingroup SpecialPage
+ */
 
 /**
- * @package MediaWiki
- * @subpackage Special pages
- *
+ * implements Special:Unusedtemplates
  * @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
+ * @ingroup SpecialPage
  */
-
-/* */
-require_once 'QueryPage.php';
-
-/**
- * @package MediaWiki
- * @subpackage SpecialPage
- */
-
 class UnusedtemplatesPage extends QueryPage {
 
        function getName() { return( 'Unusedtemplates' ); }
@@ -25,14 +19,15 @@ class UnusedtemplatesPage extends QueryPage {
        function sortDescending() { return false; }
 
        function getSQL() {
-               $dbr =& wfGetDB( DB_SLAVE );
-               extract( $dbr->tableNames( 'page', 'templatelinks' ) );
+               $dbr = wfGetDB( DB_SLAVE );
+               list( $page, $templatelinks) = $dbr->tableNamesN( '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";
+                       WHERE page_namespace = 10 AND tl_from IS NULL
+                       AND page_is_redirect = 0";
                return $sql;
        }
 
@@ -40,15 +35,14 @@ class UnusedtemplatesPage extends QueryPage {
                $title = Title::makeTitle( NS_TEMPLATE, $result->title );
                $pageLink = $skin->makeKnownLinkObj( $title, '', 'redirect=no' );
                $wlhLink = $skin->makeKnownLinkObj(
-                       Title::makeTitle( NS_SPECIAL, 'Whatlinkshere' ),
+                       SpecialPage::getTitleFor( 'Whatlinkshere' ),
                        wfMsgHtml( 'unusedtemplateswlh' ),
                        'target=' . $title->getPrefixedUrl() );
                return wfSpecialList( $pageLink, $wlhLink );
        }
 
        function getPageHeader() {
-               global $wgOut;
-               return $wgOut->parse( wfMsg( 'unusedtemplatestext' ) );
+               return wfMsgExt( 'unusedtemplatestext', array( 'parse' ) );
        }
 
 }
@@ -58,5 +52,3 @@ function wfSpecialUnusedtemplates() {
        $utp = new UnusedtemplatesPage();
        $utp->doQuery( $offset, $limit );
 }
-
-?>
\ No newline at end of file