LoggerFactory: Only check for Psr\Log\LoggerInterface once
[lhc/web/wiklou.git] / includes / GlobalFunctions.php
index a3b1e55..cda3154 100644 (file)
@@ -1355,24 +1355,14 @@ function wfReadOnlyReason() {
                return $readOnly;
        }
 
-       static $autoReadOnly = null;
-       if ( $autoReadOnly === null ) {
+       static $lbReadOnly = null;
+       if ( $lbReadOnly === null ) {
                // Callers use this method to be aware that data presented to a user
                // may be very stale and thus allowing submissions can be problematic.
-               try {
-                       if ( wfGetLB()->getLaggedSlaveMode() ) {
-                               $autoReadOnly = 'The database has been automatically locked ' .
-                                       'while the slave database servers catch up to the master';
-                       } else {
-                               $autoReadOnly = false;
-                       }
-               } catch ( DBConnectionError $e ) {
-                       $autoReadOnly = 'The database has been automatically locked ' .
-                               'until the slave database servers become available';
-               }
+               $lbReadOnly = wfGetLB()->getReadOnlyReason();
        }
 
-       return $autoReadOnly;
+       return $lbReadOnly;
 }
 
 /**
@@ -3559,7 +3549,7 @@ function wfGetPrecompiledData( $name ) {
  */
 function wfMemcKey( /*...*/ ) {
        return call_user_func_array(
-               array( ObjectCache::getMainClusterInstance(), 'makeKey' ),
+               array( ObjectCache::getLocalClusterInstance(), 'makeKey' ),
                func_get_args()
        );
 }
@@ -3578,7 +3568,7 @@ function wfForeignMemcKey( $db, $prefix /*...*/ ) {
        $args = array_slice( func_get_args(), 2 );
        $keyspace = $prefix ? "$db-$prefix" : $db;
        return call_user_func_array(
-               array( ObjectCache::getMainClusterInstance(), 'makeKeyInternal' ),
+               array( ObjectCache::getLocalClusterInstance(), 'makeKeyInternal' ),
                array( $keyspace, $args )
        );
 }
@@ -3596,7 +3586,7 @@ function wfForeignMemcKey( $db, $prefix /*...*/ ) {
  */
 function wfGlobalCacheKey( /*...*/ ) {
        return call_user_func_array(
-               array( ObjectCache::getMainClusterInstance(), 'makeGlobalKey' ),
+               array( ObjectCache::getLocalClusterInstance(), 'makeGlobalKey' ),
                func_get_args()
        );
 }