Merge "Revert "rdbms: make LoadBalancer::reallyOpenConnection() handle setting DBO_TRX""
[lhc/web/wiklou.git] / includes / objectcache / ObjectCache.php
index 21948ef..ad0f67e 100644 (file)
@@ -119,7 +119,7 @@ class ObjectCache {
         * @return BagOStuff
         * @throws InvalidArgumentException
         */
-       public static function newFromId( $id ) {
+       private static function newFromId( $id ) {
                global $wgObjectCaches;
 
                if ( !isset( $wgObjectCaches[$id] ) ) {
@@ -146,7 +146,7 @@ class ObjectCache {
         *
         * @return string
         */
-       public static function getDefaultKeyspace() {
+       private static function getDefaultKeyspace() {
                global $wgCachePrefix;
 
                $keyspace = $wgCachePrefix;
@@ -178,7 +178,8 @@ class ObjectCache {
                } elseif ( isset( $params['class'] ) ) {
                        $class = $params['class'];
                        // Automatically set the 'async' update handler
-                       $params['asyncHandler'] = $params['asyncHandler'] ?? 'DeferredUpdates::addCallableUpdate';
+                       $params['asyncHandler'] = $params['asyncHandler']
+                               ?? [ DeferredUpdates::class, 'addCallableUpdate' ];
                        // Enable reportDupes by default
                        $params['reportDupes'] = $params['reportDupes'] ?? true;
                        // Do b/c logic for SqlBagOStuff
@@ -296,7 +297,7 @@ class ObjectCache {
         * @return WANObjectCache
         * @throws UnexpectedValueException
         */
-       public static function newWANCacheFromId( $id ) {
+       private static function newWANCacheFromId( $id ) {
                global $wgWANObjectCaches, $wgObjectCaches;
 
                if ( !isset( $wgWANObjectCaches[$id] ) ) {
@@ -323,7 +324,7 @@ class ObjectCache {
         * @throws UnexpectedValueException
         */
        public static function newWANCacheFromParams( array $params ) {
-               global $wgCommandLineMode;
+               global $wgCommandLineMode, $wgSecretKey;
 
                $services = MediaWikiServices::getInstance();
                $params['cache'] = self::newFromParams( $params['store'] );
@@ -334,6 +335,7 @@ class ObjectCache {
                        // Let pre-emptive refreshes happen post-send on HTTP requests
                        $params['asyncHandler'] = [ DeferredUpdates::class, 'addCallableUpdate' ];
                }
+               $params['secret'] = $params['secret'] ?? $wgSecretKey;
                $class = $params['class'];
 
                return new $class( $params );