From: Aaron Schulz Date: Fri, 24 Apr 2015 20:52:32 +0000 (-0700) Subject: Made wfReadOnlyReason catch DB connection errors X-Git-Tag: 1.31.0-rc.0~11591^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%20%22id_auteur=%24id%22%29%20.%20%22?a=commitdiff_plain;h=aef1c677f1a0b6e5dc43ab72e7c170b08368501f;p=lhc%2Fweb%2Fwiklou.git Made wfReadOnlyReason catch DB connection errors Change-Id: I4e960d9bd751b2a6f95f08861fc8ed360af4a04a --- 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'; } }