From 19818237553571378ee298a16f47cec06f82bade Mon Sep 17 00:00:00 2001 From: Derick Alangi Date: Thu, 9 May 2019 17:03:57 +0100 Subject: [PATCH] Remove several methods, deprecated in 1.32 I've checked and doubled checked that these methods are no longer used anywhere in core or extensions, hence removed them. They were hard deprecated in MediaWiki 1.32. * OutputPage: ** `::showFileCopyError()` ** `::showFileRenameError()` ** `::showFileDeleteError()` ** `::showFileNotFoundError()` * ApiBase: ** `::truncateArray()` * IcuCollation: ** `::getICUVersion()` * HTMLForm: ** `::setSubmitProgressive()` * ResourceLoaderStartUpModules: ** `::getStartupModules()` ** `::getLegacyModules()` * BaseTemplate: ** `::msgHtml()` * QuickTemplate: ** `::msgHtml()` * WatchAction: ** `::getUnwatchToken()` Bug: T220656 Change-Id: Ic1a723a991f4ff63fcb5f045ddcda18d1f8c3c68 --- RELEASE-NOTES-1.34 | 14 +++++++ includes/OutputPage.php | 40 ------------------- includes/actions/WatchAction.php | 15 ------- includes/api/ApiBase.php | 18 --------- includes/collation/IcuCollation.php | 17 -------- includes/htmlform/HTMLForm.php | 15 ------- .../ResourceLoaderStartUpModule.php | 23 ----------- includes/skins/BaseTemplate.php | 12 ------ includes/skins/QuickTemplate.php | 13 ------ .../includes/actions/WatchActionTest.php | 11 ----- 10 files changed, 14 insertions(+), 164 deletions(-) diff --git a/RELEASE-NOTES-1.34 b/RELEASE-NOTES-1.34 index e5e95d24e8..e2d22b70dd 100644 --- a/RELEASE-NOTES-1.34 +++ b/RELEASE-NOTES-1.34 @@ -123,6 +123,20 @@ because of Phabricator reports. * Output::sectionEditLinksEnabled(), ParserOutput::getEditSectionTokens, ::getTOCEnabled, ::setEditSectionTokens, ::setTOCEnabled, deprecated in 1.31 have been removed. +* Four methods in OutputPage, deprecated in 1.32, have been removed. You should + use OutputPage::showFatalError or throw a FatalError instead. The methods are + ::showFileCopyError(), ::showFileRenameError(), ::showFileDeleteError(), and + ::showFileNotFoundError(). +* ApiBase::truncateArray(), deprecated in 1.32, has been removed. +* IcuCollation::getICUVersion(), deprecated in 1.32, has been removed. Use PHP's + INTL_ICU_VERSION constant directly. +* HTMLForm::setSubmitProgressive(), deprecated in 1.32, has been removed. +* ResourceLoaderStartUpModules::getStartupModules() and ::getLegacyModules(), + both deprecated in 1.32, have been removed. +* BaseTemplate::msgHtml() and QuickTemplate::msgHtml(), deprecated in 1.32, have + been removed. Use ->msg() or ->getMsg() instead. +* WatchAction::getUnwatchToken(), deprecated in 1.32, has been removed. Instead, + use WatchAction::getWatchToken() with action 'unwatch' directly. * … === Deprecations in 1.34 === diff --git a/includes/OutputPage.php b/includes/OutputPage.php index e0f25cd63a..641f0b857b 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2998,46 +2998,6 @@ class OutputPage extends ContextSource { $this->addHTML( $message ); } - /** - * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead. - */ - public function showUnexpectedValueError( $name, $val ) { - wfDeprecated( __METHOD__, '1.32' ); - $this->showFatalError( $this->msg( 'unexpected', $name, $val )->escaped() ); - } - - /** - * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead. - */ - public function showFileCopyError( $old, $new ) { - wfDeprecated( __METHOD__, '1.32' ); - $this->showFatalError( $this->msg( 'filecopyerror', $old, $new )->escaped() ); - } - - /** - * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead. - */ - public function showFileRenameError( $old, $new ) { - wfDeprecated( __METHOD__, '1.32' ); - $this->showFatalError( $this->msg( 'filerenameerror', $old, $new )->escaped() ); - } - - /** - * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead. - */ - public function showFileDeleteError( $name ) { - wfDeprecated( __METHOD__, '1.32' ); - $this->showFatalError( $this->msg( 'filedeleteerror', $name )->escaped() ); - } - - /** - * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead. - */ - public function showFileNotFoundError( $name ) { - wfDeprecated( __METHOD__, '1.32' ); - $this->showFatalError( $this->msg( 'filenotfound', $name )->escaped() ); - } - /** * Add a "return to" link pointing to a specified title * diff --git a/includes/actions/WatchAction.php b/includes/actions/WatchAction.php index aaccc0c489..0eba613a20 100644 --- a/includes/actions/WatchAction.php +++ b/includes/actions/WatchAction.php @@ -173,21 +173,6 @@ class WatchAction extends FormAction { return $user->getEditToken( $action ); } - /** - * Get token to unwatch (or watch) a page for a user - * - * @param Title $title Title object of page to unwatch - * @param User $user User for whom the action is going to be performed - * @param string $action Optionally override the action to 'watch' - * @return string Token - * @since 1.18 - * @deprecated since 1.32 Use WatchAction::getWatchToken() with action 'unwatch' directly. - */ - public static function getUnwatchToken( Title $title, User $user, $action = 'unwatch' ) { - wfDeprecated( __METHOD__, '1.32' ); - return self::getWatchToken( $title, $user, $action ); - } - public function doesWrites() { return true; } diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index bc62906ab9..8d0d31449e 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -2685,24 +2685,6 @@ abstract class ApiBase extends ContextSource { ] ]; } - /** - * Truncate an array to a certain length. - * @deprecated since 1.32, no replacement - * @param array &$arr Array to truncate - * @param int $limit Maximum length - * @return bool True if the array was truncated, false otherwise - */ - public static function truncateArray( &$arr, $limit ) { - wfDeprecated( __METHOD__, '1.32' ); - $modified = false; - while ( count( $arr ) > $limit ) { - array_pop( $arr ); - $modified = true; - } - - return $modified; - } - /**@}*/ } diff --git a/includes/collation/IcuCollation.php b/includes/collation/IcuCollation.php index 9c1c5f870a..7774a60ed9 100644 --- a/includes/collation/IcuCollation.php +++ b/includes/collation/IcuCollation.php @@ -526,23 +526,6 @@ class IcuCollation extends Collation { return false; } - /** - * Return the version of ICU library used by PHP's intl extension, - * or false when the extension is not installed of the version - * can't be determined. - * - * The constant INTL_ICU_VERSION this function refers to isn't really - * documented, but see https://bugs.php.net/bug.php?id=54561. - * - * @since 1.21 - * @deprecated since 1.32, use INTL_ICU_VERSION directly - * @return string - */ - static function getICUVersion() { - wfDeprecated( __METHOD__, '1.32' ); - return INTL_ICU_VERSION; - } - /** * Return the version of Unicode appropriate for the version of ICU library * currently in use, or false when it can't be determined. diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php index 99671c0cfc..85a2a1bdd4 100644 --- a/includes/htmlform/HTMLForm.php +++ b/includes/htmlform/HTMLForm.php @@ -1373,21 +1373,6 @@ class HTMLForm extends ContextSource { return $this; } - /** - * Identify that the submit button in the form has a progressive action - * @since 1.25 - * @deprecated since 1.32, No need to call. Submit button already - * has a progressive action form. - * - * @return HTMLForm $this for chaining calls (since 1.28) - */ - public function setSubmitProgressive() { - wfDeprecated( __METHOD__, '1.32' ); - $this->mSubmitFlags = [ 'progressive', 'primary' ]; - - return $this; - } - /** * Set the text for the submit button to a message * @since 1.19 diff --git a/includes/resourceloader/ResourceLoaderStartUpModule.php b/includes/resourceloader/ResourceLoaderStartUpModule.php index 8cbde09ff0..c834db10e2 100644 --- a/includes/resourceloader/ResourceLoaderStartUpModule.php +++ b/includes/resourceloader/ResourceLoaderStartUpModule.php @@ -321,29 +321,6 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { return true; } - /** - * Internal modules used by ResourceLoader that cannot be depended on. - * - * These module(s) should have isRaw() return true, and are not - * legal dependencies (enforced by structure/ResourcesTest). - * - * @deprecated since 1.32 No longer used. - * @return array - */ - public static function getStartupModules() { - wfDeprecated( __METHOD__, '1.32' ); - return []; - } - - /** - * @deprecated since 1.32 No longer used. - * @return array - */ - public static function getLegacyModules() { - wfDeprecated( __METHOD__, '1.32' ); - return []; - } - /** * @private For internal use by SpecialJavaScriptTest * @since 1.32 diff --git a/includes/skins/BaseTemplate.php b/includes/skins/BaseTemplate.php index 8fe35f08e3..6d108e8ec4 100644 --- a/includes/skins/BaseTemplate.php +++ b/includes/skins/BaseTemplate.php @@ -43,18 +43,6 @@ abstract class BaseTemplate extends QuickTemplate { echo $this->getMsg( $str )->escaped(); } - /** - * @param string $str - * @warning You should never use this method. I18n messages should be escaped - * @deprecated 1.32 Use ->msg() or ->getMsg() instead. - * @suppress SecurityCheck-XSS - * @return-taint exec_html - */ - function msgHtml( $str ) { - wfDeprecated( __METHOD__, '1.32' ); - echo $this->getMsg( $str )->text(); - } - /** * @deprecated since 1.33 Use ->msg() or ->getMsg() instead. */ diff --git a/includes/skins/QuickTemplate.php b/includes/skins/QuickTemplate.php index 5044301305..6bcf1c3ba9 100644 --- a/includes/skins/QuickTemplate.php +++ b/includes/skins/QuickTemplate.php @@ -125,19 +125,6 @@ abstract class QuickTemplate { echo htmlspecialchars( wfMessage( $msgKey )->text() ); } - /** - * @private - * @param string $msgKey - * @warning You should never use this method. I18n messages should be escaped - * @deprecated 1.32 Use ->msg() instead. - * @suppress SecurityCheck-XSS - * @return-taint exec_html - */ - function msgHtml( $msgKey ) { - wfDeprecated( __METHOD__, '1.32' ); - echo wfMessage( $msgKey )->text(); - } - /** * An ugly, ugly hack. * @deprecated since 1.33 Use ->msg() instead. diff --git a/tests/phpunit/includes/actions/WatchActionTest.php b/tests/phpunit/includes/actions/WatchActionTest.php index 044c30a667..cdd7576e10 100644 --- a/tests/phpunit/includes/actions/WatchActionTest.php +++ b/tests/phpunit/includes/actions/WatchActionTest.php @@ -270,17 +270,6 @@ class WatchActionTest extends MediaWikiTestCase { WatchAction::getWatchToken( $this->watchAction->getTitle(), $user ); } - /** - * @covers WatchAction::getUnwatchToken() - */ - public function testGetUnwatchToken() { - $user = $this->getMock( User::class ); - $user->expects( $this->once() )->method( 'getEditToken' ); - $this->hideDeprecated( 'WatchAction::getUnwatchToken' ); - - WatchAction::getUnWatchToken( $this->watchAction->getTitle(), $user ); - } - /** * @covers WatchAction::doWatchOrUnwatch() */ -- 2.20.1