Index: branches/REL1_18/phase3/includes/db/LoadBalancer.php |
— | — | @@ -241,7 +241,8 @@ |
242 | 242 | $i = $this->getRandomNonLagged( $currentLoads, $wiki ); |
243 | 243 | if ( $i === false && count( $currentLoads ) != 0 ) { |
244 | 244 | # All slaves lagged. Switch to read-only mode |
245 | | - $wgReadOnly = wfMessage( 'readonly_lag' )->useDatabase( false )->plain(); |
| 245 | + $wgReadOnly = 'The database has been automatically locked ' . |
| 246 | + 'while the slave database servers catch up to the master'; |
246 | 247 | $i = $this->pickRandom( $currentLoads ); |
247 | 248 | $laggedSlaveMode = true; |
248 | 249 | } |
— | — | @@ -678,7 +679,14 @@ |
679 | 680 | |
680 | 681 | # Create object |
681 | 682 | wfDebug( "Connecting to $host $dbname...\n" ); |
682 | | - $db = DatabaseBase::factory( $server['type'], $server ); |
| 683 | + try { |
| 684 | + $db = DatabaseBase::factory( $server['type'], $server ); |
| 685 | + } catch ( DBConnectionError $e ) { |
| 686 | + // FIXME: This is probably the ugliest thing I have ever done to |
| 687 | + // PHP. I'm half-expecting it to segfault, just out of disgust. -- TS |
| 688 | + $db = $e->db; |
| 689 | + } |
| 690 | + |
683 | 691 | if ( $db->isOpen() ) { |
684 | 692 | wfDebug( "Connected to $host $dbname.\n" ); |
685 | 693 | } else { |