From 8d68833208359be7877e7cb7a794e9f0ff3c0010 Mon Sep 17 00:00:00 2001 From: Dereckson Date: Tue, 19 Jun 2012 00:56:55 +0200 Subject: [PATCH] (bug 37638) Remove calls to deprecated LogPage::logName method. 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 | 12 +++++++++--- includes/ChangesList.php | 7 ++++--- includes/FileDeleteForm.php | 3 ++- includes/ProtectionForm.php | 17 +++++++++-------- includes/logging/LogPage.php | 9 ++++++--- includes/specials/SpecialMergeHistory.php | 5 +++-- includes/specials/SpecialMovepage.php | 3 ++- includes/specials/SpecialRevisiondelete.php | 6 ++++-- includes/specials/SpecialUndelete.php | 6 ++++-- includes/specials/SpecialUserrights.php | 3 ++- 10 files changed, 45 insertions(+), 26 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 7cd3019967..237f0ce296 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -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( "
\n$1\n
", 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( "
\n$1\n
", $errors[0] ); - $outputPage->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) ); + $outputPage->addHTML( Xml::element( 'h2', null, $deleteLogPage->getName()->text() ) ); LogEventsList::showLogExtract( $outputPage, diff --git a/includes/ChangesList.php b/includes/ChangesList.php index 9daf3a9daf..51a371862a 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -1185,9 +1185,10 @@ class EnhancedChangesList extends ChangesList { $r .= ' '.$rcObj->timestamp.' '; # 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 ); } diff --git a/includes/FileDeleteForm.php b/includes/FileDeleteForm.php index ecdb5ba960..1f0c195764 100644 --- a/includes/FileDeleteForm.php +++ b/includes/FileDeleteForm.php @@ -291,7 +291,8 @@ class FileDeleteForm { */ private function showLogEntries() { global $wgOut; - $wgOut->addHTML( '

' . htmlspecialchars( LogPage::logName( 'delete' ) ) . "

\n" ); + $deleteLogPage = new LogPage( 'delete' ); + $wgOut->addHTML( '

' . $deleteLogPage->getName()->escaped() . "

\n" ); LogEventsList::showLogExtract( $wgOut, 'delete', $this->title ); } diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index 31ed87f6be..caedb63d33 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -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) ); diff --git a/includes/logging/LogPage.php b/includes/logging/LogPage.php index cf921b0fc8..2521ae871d 100644 --- a/includes/logging/LogPage.php +++ b/includes/logging/LogPage.php @@ -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 ); } diff --git a/includes/specials/SpecialMergeHistory.php b/includes/specials/SpecialMergeHistory.php index b5fb0dddf6..1f057499d9 100644 --- a/includes/specials/SpecialMergeHistory.php +++ b/includes/specials/SpecialMergeHistory.php @@ -226,8 +226,9 @@ class SpecialMergeHistory extends SpecialPage { $out->addWikiMsg( 'mergehistory-empty' ); } - # Show relevant lines from the deletion log: - $out->addHTML( '

' . htmlspecialchars( LogPage::logName( 'merge' ) ) . "

\n" ); + # Show relevant lines from the merge log: + $mergeLogPage = new LogPage( 'merge' ); + $out->addHTML( '

' . $mergeLogPage->getName()->escaped() . "

\n" ); LogEventsList::showLogExtract( $out, 'merge', $this->mTargetObj ); # When we submit, go by page ID to avoid some nasty but unlikely collisions. diff --git a/includes/specials/SpecialMovepage.php b/includes/specials/SpecialMovepage.php index 68b180a5d3..3ece917b81 100644 --- a/includes/specials/SpecialMovepage.php +++ b/includes/specials/SpecialMovepage.php @@ -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 ); } diff --git a/includes/specials/SpecialRevisiondelete.php b/includes/specials/SpecialRevisiondelete.php index be432acf7c..4e1bbc2d4f 100644 --- a/includes/specials/SpecialRevisiondelete.php +++ b/includes/specials/SpecialRevisiondelete.php @@ -206,12 +206,14 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { $qc = $this->getLogQueryCond(); # Show relevant lines from the deletion log - $output->addHTML( "

" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "

\n" ); + $deleteLogPage = new LogPage( 'delete' ); + $output->addHTML( "

" . $deleteLogPage->getName()->escaped() . "

\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( "

" . htmlspecialchars( LogPage::logName( 'suppress' ) ) . "

\n" ); + $suppressLogPage = new LogPage( 'suppress' ); + $output->addHTML( "

" . $suppressLogPage->getName()->escaped() . "

\n" ); LogEventsList::showLogExtract( $output, 'suppress', $this->targetObj, '', array( 'lim' => 25, 'conds' => $qc ) ); } diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index 611b3b9212..c6b496b0ef 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -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 ); } diff --git a/includes/specials/SpecialUserrights.php b/includes/specials/SpecialUserrights.php index 8c244c4236..59d983ff6e 100644 --- a/includes/specials/SpecialUserrights.php +++ b/includes/specials/SpecialUserrights.php @@ -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() ); } } -- 2.20.1