From: Timo Tijhof Date: Tue, 8 Oct 2019 21:17:22 +0000 (+0100) Subject: objectcache: Deprecate ObjectCache::getWANInstance X-Git-Tag: 1.34.0-rc.0~9 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=c1ac4b2546f506e19c03b1ebd0143ba42d97ebb2 objectcache: Deprecate ObjectCache::getWANInstance This is not used anywhere. Once removed we can remove a bunch more protected/private methods in this class that are all only here still due to this one public method. It was obsolete when the creation of WANObjectCache was moved to ServiceWiring. In theory multiple instances can be created but in the future that should be done by either constructing the WANObjectCache directly where needed, or by implementing it as a custom service. Also deprecate ObjectCache::newWANCacheFromParams. This should have been `@internal`, but oh well. Deprecate as well since only needed by getWANInstance(). No longer used internally either as of I118b6f01e4940. Change-Id: Icc500e76c860c35ff40fdee47142c63091829dfe (cherry picked from commit b10b56dc6923062314f136945da255a24e52a585) --- diff --git a/RELEASE-NOTES-1.34 b/RELEASE-NOTES-1.34 index 89db7de944..4ab44c93ff 100644 --- a/RELEASE-NOTES-1.34 +++ b/RELEASE-NOTES-1.34 @@ -569,6 +569,10 @@ because of Phabricator reports. * IDatabase::bufferResults() has been deprecated. Use query batching instead. * MessageCache::singleton() is deprecated. Use MediaWikiServices::getMessageCache(). +* ObjectCache::getWANInstance() is deprecated. Use + MediaWikiServices::getMainWANObjectCache() instead. +* ObjectCache::newWANCacheFromParams() is deprecated. Use + MediaWikiServices::getMainWANObjectCache() instead. * Constructing MovePage directly is deprecated. Use MovePageFactory. * TempFSFile::factory() has been deprecated. Use TempFSFileFactory instead. * wfIsBadImage() is deprecated. Use the BadFileLookup service instead. diff --git a/includes/objectcache/ObjectCache.php b/includes/objectcache/ObjectCache.php index e49feae881..73f399386c 100644 --- a/includes/objectcache/ObjectCache.php +++ b/includes/objectcache/ObjectCache.php @@ -91,8 +91,10 @@ class ObjectCache { * @since 1.26 * @param string $id A key in $wgWANObjectCaches. * @return WANObjectCache + * @deprecated since 1.34 Use MediaWikiServices::getMainWANObjectCache instead */ public static function getWANInstance( $id ) { + wfDeprecated( __METHOD__, '1.34' ); if ( !isset( self::$wanInstances[$id] ) ) { self::$wanInstances[$id] = self::newWANCacheFromId( $id ); } @@ -308,8 +310,11 @@ class ObjectCache { * @return WANObjectCache * @throws UnexpectedValueException * @suppress PhanTypeMismatchReturn + * @deprecated since 1.34 Use MediaWikiServices::getMainWANObjectCache + * instead or use WANObjectCache::__construct directly */ public static function newWANCacheFromParams( array $params ) { + wfDeprecated( __METHOD__, '1.34' ); global $wgCommandLineMode, $wgSecretKey; $services = MediaWikiServices::getInstance();