(bug 37638) Remove calls to deprecated LogPage::logName method.
authorDereckson <dereckson@espace-win.org>
Mon, 18 Jun 2012 22:56:55 +0000 (00:56 +0200)
committerNiklas Laxström <niklas.laxstrom@gmail.com>
Wed, 15 Aug 2012 07:50:01 +0000 (07:50 +0000)
The LogPage::logName method has been deprecated in 1.19,
warnings being planned in 1.21.

This change removes any call in the MediaWiki core to this
deprecated method.

Removing extra whitespaces/tabs in includes/ProtectionForm.php.

Change-Id: I1907f17341ecb6448967a5283e3c913778dcb1a9

includes/Article.php
includes/ChangesList.php
includes/FileDeleteForm.php
includes/ProtectionForm.php
includes/logging/LogPage.php
includes/specials/SpecialMergeHistory.php
includes/specials/SpecialMovepage.php
includes/specials/SpecialRevisiondelete.php
includes/specials/SpecialUndelete.php
includes/specials/SpecialUserrights.php

index 7cd3019..237f0ce 100644 (file)
@@ -1321,12 +1321,15 @@ class Article extends Page {
                # Better double-check that it hasn't been deleted yet!
                $this->mPage->loadPageData( 'fromdbmaster' );
                if ( !$this->mPage->exists() ) {
+                       $deleteLogPage = new LogPage( 'delete' );
                        $outputPage = $this->getContext()->getOutput();
                        $outputPage->setPageTitle( wfMessage( 'cannotdelete-title', $title->getPrefixedText() ) );
                        $outputPage->wrapWikiMsg( "<div class=\"error mw-error-cannotdelete\">\n$1\n</div>",
                                        array( 'cannotdelete', wfEscapeWikiText( $title->getPrefixedText() ) )
                                );
-                       $outputPage->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) );
+                       $outputPage->addHTML(
+                               Xml::element( 'h2', null, $deleteLogPage->getName()->text() )
+                       );
                        LogEventsList::showLogExtract(
                                $outputPage,
                                'delete',
@@ -1496,7 +1499,9 @@ class Article extends Page {
                        }
 
                $outputPage->addHTML( $form );
-               $outputPage->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) );
+
+               $deleteLogPage = new LogPage( 'delete' );
+               $outputPage->addHTML( Xml::element( 'h2', null, $deleteLogPage->getName()->text() ) );
                LogEventsList::showLogExtract( $outputPage, 'delete',
                        $this->getTitle()
                );
@@ -1525,10 +1530,11 @@ class Article extends Page {
                        $outputPage->setPageTitle( wfMessage( 'cannotdelete-title', $this->getTitle()->getPrefixedText() ) );
                        if ( $error == '' ) {
                                $errors = $status->getErrorsArray();
+                               $deleteLogPage = new LogPage( 'delete' );
                                $outputPage->wrapWikiMsg( "<div class=\"error mw-error-cannotdelete\">\n$1\n</div>",
                                        $errors[0]
                                );
-                               $outputPage->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) );
+                               $outputPage->addHTML( Xml::element( 'h2', null, $deleteLogPage->getName()->text() ) );
 
                                LogEventsList::showLogExtract(
                                        $outputPage,
index 9daf3a9..51a3718 100644 (file)
@@ -1185,9 +1185,10 @@ class EnhancedChangesList extends ChangesList {
                $r .= '&#160;'.$rcObj->timestamp.'&#160;</td><td>';
                # Article or log link
                if( $logType ) {
-                       $logtitle = SpecialPage::getTitleFor( 'Log', $logType );
-                       $logname = LogPage::logName( $logType );
-                       $r .= $this->msg( 'parentheses' )->rawParams( Linker::linkKnown( $logtitle, htmlspecialchars( $logname ) ) )->escaped();
+                       $logPage = new LogPage( $logType );
+                       $logTitle = SpecialPage::getTitleFor( 'Log', $logType );
+                       $logName = $logPage->getName()->escaped();
+                       $r .= $this->msg( 'parentheses' )->rawParams( Linker::linkKnown( $logTitle, $logName ) )->escaped();
                } else {
                        $this->insertArticleLink( $r, $rcObj, $rcObj->unpatrolled, $rcObj->watched );
                }
index ecdb5ba..1f0c195 100644 (file)
@@ -291,7 +291,8 @@ class FileDeleteForm {
         */
        private function showLogEntries() {
                global $wgOut;
-               $wgOut->addHTML( '<h2>' . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" );
+               $deleteLogPage = new LogPage( 'delete' );
+               $wgOut->addHTML( '<h2>' . $deleteLogPage->getName()->escaped() . "</h2>\n" );
                LogEventsList::showLogExtract( $wgOut, 'delete', $this->title );
        }
 
index 31ed87f..caedb63 100644 (file)
@@ -74,17 +74,17 @@ class ProtectionForm {
                $this->disabledAttrib = $this->disabled
                        ? array( 'disabled' => 'disabled' )
                        : array();
-               
+
                $this->loadData();
        }
-       
+
        /**
         * Loads the current state of protection into the object.
         */
        function loadData() {
                global $wgRequest, $wgUser;
                global $wgRestrictionLevels;
-               
+
                $this->mCascade = $this->mTitle->areRestrictionsCascading();
 
                $this->mReason = $wgRequest->getText( 'mwProtect-reason' );
@@ -94,7 +94,7 @@ class ProtectionForm {
                foreach( $this->mApplicableTypes as $action ) {
                        // @todo FIXME: This form currently requires individual selections,
                        // but the db allows multiples separated by commas.
-                       
+
                        // Pull the actual restriction from the DB
                        $this->mRestrictions[$action] = implode( '', $this->mTitle->getRestrictions( $action ) );
 
@@ -151,7 +151,7 @@ class ProtectionForm {
         * Get the expiry time for a given action, by combining the relevant inputs.
         *
         * @param $action string
-        * 
+        *
         * @return string 14-char timestamp or "infinity", or false if the input was invalid
         */
        function getExpiry( $action ) {
@@ -576,14 +576,14 @@ class ProtectionForm {
                        return wfMsg( 'protect-fallback', $permission );
                }
        }
-       
+
        function buildCleanupScript() {
                global $wgRestrictionLevels, $wgGroupPermissions, $wgOut;
 
                $cascadeableLevels = array();
                foreach( $wgRestrictionLevels as $key ) {
                        if ( ( isset( $wgGroupPermissions[$key]['protect'] ) && $wgGroupPermissions[$key]['protect'] )
-                               || $key == 'protect' 
+                               || $key == 'protect'
                        ) {
                                $cascadeableLevels[] = $key;
                        }
@@ -608,7 +608,8 @@ class ProtectionForm {
         */
        function showLogExtract( &$out ) {
                # Show relevant lines from the protection log:
-               $out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'protect' ) ) );
+               $protectLogPage = new LogPage( 'protect' );
+               $out->addHTML( Xml::element( 'h2', null, $protectLogPage->getName()->text() ) );
                LogEventsList::showLogExtract( $out, 'protect', $this->mTitle );
                # Let extensions add other relevant log extracts
                wfRunHooks( 'ProtectionForm::showLogExtract', array($this->mArticle,$out) );
index cf921b0..2521ae8 100644 (file)
@@ -419,9 +419,12 @@ class LogPage {
 
                                        # Use the language name for log titles, rather than Log/X
                                        if( $name == 'Log' ) {
-                                               $titleLink = Linker::link( $title, LogPage::logName( $par ) );
-                                               $titleLink = wfMessage( 'parentheses' )->inLanguage( $lang )
-                                                       ->rawParams( $titleLink )->escaped();
+                                               $logPage = new LogPage( $par );
+                                               $titleLink = Linker::link( $title, $logPage->getName()->escaped() );
+                                               $titleLink = wfMessage( 'parentheses' )
+                                                       ->inLanguage( $lang )
+                                                       ->rawParams( $titleLink )
+                                                       ->escaped();
                                        } else {
                                                $titleLink = Linker::link( $title );
                                        }
index b5fb0dd..1f05749 100644 (file)
@@ -226,8 +226,9 @@ class SpecialMergeHistory extends SpecialPage {
                        $out->addWikiMsg( 'mergehistory-empty' );
                }
 
-               # Show relevant lines from the deletion log:
-               $out->addHTML( '<h2>' . htmlspecialchars( LogPage::logName( 'merge' ) ) . "</h2>\n" );
+               # Show relevant lines from the merge log:
+               $mergeLogPage = new LogPage( 'merge' );
+               $out->addHTML( '<h2>' . $mergeLogPage->getName()->escaped() . "</h2>\n" );
                LogEventsList::showLogExtract( $out, 'merge', $this->mTargetObj );
 
                # When we submit, go by page ID to avoid some nasty but unlikely collisions.
index 68b180a..3ece917 100644 (file)
@@ -629,8 +629,9 @@ class MovePageForm extends UnlistedSpecialPage {
        }
 
        function showLogFragment( $title ) {
+               $moveLogPage = new LogPage( 'move' );
                $out = $this->getOutput();
-               $out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'move' ) ) );
+               $out->addHTML( Xml::element( 'h2', null, $moveLogPage->getName()->text() ) );
                LogEventsList::showLogExtract( $out, 'move', $title );
        }
 
index be432ac..4e1bbc2 100644 (file)
@@ -206,12 +206,14 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
 
                $qc = $this->getLogQueryCond();
                # Show relevant lines from the deletion log
-               $output->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" );
+               $deleteLogPage = new LogPage( 'delete' );
+               $output->addHTML( "<h2>" . $deleteLogPage->getName()->escaped() . "</h2>\n" );
                LogEventsList::showLogExtract( $output, 'delete',
                        $this->targetObj, '', array( 'lim' => 25, 'conds' => $qc ) );
                # Show relevant lines from the suppression log
                if( $user->isAllowed( 'suppressionlog' ) ) {
-                       $output->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'suppress' ) ) . "</h2>\n" );
+                       $suppressLogPage = new LogPage( 'suppress' );
+                       $output->addHTML( "<h2>" . $suppressLogPage->getName()->escaped()  . "</h2>\n" );
                        LogEventsList::showLogExtract( $output, 'suppress',
                                $this->targetObj, '', array( 'lim' => 25, 'conds' => $qc ) );
                }
index 611b3b9..c6b496b 100644 (file)
@@ -1083,11 +1083,13 @@ class SpecialUndelete extends SpecialPage {
                }
 
                # Show relevant lines from the deletion log:
-               $out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) . "\n" );
+               $deleteLogPage = new LogPage( 'delete' );
+               $out->addHTML( Xml::element( 'h2', null, $deleteLogPage->getName()->text() ) . "\n" );
                LogEventsList::showLogExtract( $out, 'delete', $this->mTargetObj );
                # Show relevant lines from the suppression log:
+               $suppressLogPage = new LogPage( 'suppress' );
                if( $this->getUser()->isAllowed( 'suppressionlog' ) ) {
-                       $out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'suppress' ) ) . "\n" );
+                       $out->addHTML( Xml::element( 'h2', null, $suppressLogPage->getName()->text() ) . "\n" );
                        LogEventsList::showLogExtract( $out, 'suppress', $this->mTargetObj );
                }
 
index 8c244c4..59d983f 100644 (file)
@@ -605,7 +605,8 @@ class UserrightsPage extends SpecialPage {
         * @param $output OutputPage to use
         */
        protected function showLogFragment( $user, $output ) {
-               $output->addHTML( Xml::element( 'h2', null, LogPage::logName( 'rights' ) . "\n" ) );
+               $rightsLogPage = new LogPage( 'rights' );
+               $output->addHTML( Xml::element( 'h2', null, $rightsLogPage->getName()->text() ) );
                LogEventsList::showLogExtract( $output, 'rights', $user->getUserPage() );
        }
 }