Merge "Document namespaces member as nullable"
[lhc/web/wiklou.git] / includes / GlobalFunctions.php
index 0287798..23a8bbb 100644 (file)
@@ -1346,9 +1346,14 @@ function wfReadOnlyReason() {
                }
                // Callers use this method to be aware that data presented to a user
                // may be very stale and thus allowing submissions can be problematic.
-               if ( $wgReadOnly === false && wfGetLB()->getLaggedSlaveMode() ) {
+               try {
+                       if ( $wgReadOnly === false && wfGetLB()->getLaggedSlaveMode() ) {
+                               $wgReadOnly = 'The database has been automatically locked ' .
+                                       'while the slave database servers catch up to the master';
+                       }
+               } catch ( DBConnectionError $e ) {
                        $wgReadOnly = 'The database has been automatically locked ' .
-                               'while the slave database servers catch up to the master';
+                               'until the slave database servers become available';
                }
        }
 
@@ -3750,6 +3755,7 @@ function wfWaitForSlaves(
        }
 
        // Figure out which clusters need to be checked
+       /** @var LoadBalancer[] $lbs */
        $lbs = array();
        if ( $cluster === '*' ) {
                wfGetLBFactory()->forEachLB( function ( LoadBalancer $lb ) use ( &$lbs ) {