From aef1c677f1a0b6e5dc43ab72e7c170b08368501f Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 24 Apr 2015 13:52:32 -0700 Subject: [PATCH] Made wfReadOnlyReason catch DB connection errors Change-Id: I4e960d9bd751b2a6f95f08861fc8ed360af4a04a --- includes/GlobalFunctions.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 0287798959..cefa37537a 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -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'; } } -- 2.20.1