Merge "GlobalFunctions: Avoid unnecessary fully-namespaced MediaWikiServices"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 23 May 2017 05:28:03 +0000 (05:28 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 23 May 2017 05:28:04 +0000 (05:28 +0000)
RELEASE-NOTES-1.30
includes/GlobalFunctions.php
includes/api/ApiHelp.php

index 4e25532..42ae368 100644 (file)
@@ -76,6 +76,8 @@ changes to languages because of Phabricator reports.
 * The ExtractThumbParameters hook (deprecated in 1.21) was removed.
 * The OutputPage::addParserOutputNoText and ::getHeadLinks methods (both
   deprecated in 1.24) were removed.
+* wfMemcKey() and wfGlobalCacheKey() were deprecated. ObjectCache::makeKey() and
+  ObjectCache::makeGlobalKey() should be used instead.
 
 == Compatibility ==
 MediaWiki 1.30 requires PHP 5.5.9 or later. There is experimental support for
index e1ae88f..9c70639 100644 (file)
@@ -2960,6 +2960,8 @@ function wfGetPrecompiledData( $name ) {
 }
 
 /**
+ * @deprecated since 1.30 Call makeKey on a ObjectCache instance
+ *
  * Make a cache key for the local wiki.
  *
  * @param string $args,...
@@ -2992,6 +2994,8 @@ function wfForeignMemcKey( $db, $prefix /*...*/ ) {
 }
 
 /**
+ * @deprecated since 1.30 Call makeGlobalKey on a ObjectCache instance
+ *
  * Make a cache key with database-agnostic prefix.
  *
  * Doesn't have a wiki-specific namespace. Uses a generic 'global' prefix
index df9ca98..7cd6d58 100644 (file)
@@ -25,6 +25,7 @@
  */
 
 use HtmlFormatter\HtmlFormatter;
+use MediaWiki\MediaWikiServices;
 
 /**
  * Class to output help for an API module
@@ -108,7 +109,7 @@ class ApiHelp extends ApiBase {
                }
                $out->setPageTitle( $context->msg( 'api-help-title' ) );
 
-               $cache = ObjectCache::getMainWANInstance();
+               $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
                $cacheKey = null;
                if ( count( $modules ) == 1 && $modules[0] instanceof ApiMain &&
                        $options['recursivesubmodules'] && $context->getLanguage() === $wgContLang
@@ -116,7 +117,7 @@ class ApiHelp extends ApiBase {
                        $cacheHelpTimeout = $context->getConfig()->get( 'APICacheHelpTimeout' );
                        if ( $cacheHelpTimeout > 0 ) {
                                // Get help text from cache if present
-                               $cacheKey = wfMemcKey( 'apihelp', $modules[0]->getModulePath(),
+                               $cacheKey = $cache->makeKey( 'apihelp', $modules[0]->getModulePath(),
                                        (int)!empty( $options['toc'] ),
                                        str_replace( ' ', '_', SpecialVersion::getVersion( 'nodb' ) ) );
                                $cached = $cache->get( $cacheKey );