From: Tim Starling
Date: Sun, 12 Dec 2004 04:44:17 +0000 (+0000)
Subject: Fixed connection errors yet again, hopefully in a more robust way this time
X-Git-Tag: 1.5.0alpha1~1102
X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=6d4ce2a3bd79eed2a20d484b81dab7528104211e;p=lhc%2Fweb%2Fwiklou.git
Fixed connection errors yet again, hopefully in a more robust way this time
---
diff --git a/includes/Database.php b/includes/Database.php
index 1dc6c1ae81..70b8d7f80e 100644
--- a/includes/Database.php
+++ b/includes/Database.php
@@ -1430,7 +1430,41 @@ class ResultWrapper {
*/
function wfEmergencyAbort( &$conn, $error ) {
global $wgTitle, $wgUseFileCache, $title, $wgInputEncoding, $wgSiteNotice, $wgOutputEncoding;
+ global $wgSitename, $wgServer;
+ # I give up, Brion is right. Getting the message cache to work when there is no DB is tricky.
+ # Hard coding strings instead.
+
+ $noconnect = 'Sorry! The wiki is experiencing some technical difficulties, and cannot contact the database server.
+$1';
+ $mainpage = 'Main Page';
+ $searchdisabled = <<$wgSitename search is disabled for performance reasons. You can search via Google in the meantime.
+Note that their indexes of $wgSitename content may be out of date.
',
+EOT;
+
+ $googlesearch = "
+
+
+";
+ $cachederror = "The following is a cached copy of the requested page, and may not be up to date. ";
+
+
if( !headers_sent() ) {
header( 'HTTP/1.0 500 Internal Server Error' );
header( 'Content-type: text/html; charset='.$wgOutputEncoding );
@@ -1439,7 +1473,9 @@ function wfEmergencyAbort( &$conn, $error ) {
header( 'Pragma: nocache' );
}
$msg = $wgSiteNotice;
- if($msg == '') $msg = wfMsgNoDB( 'noconnect', $error );
+ if($msg == '') {
+ $msg = str_replace( '$1', $error, $noconnect );
+ }
$text = $msg;
if($wgUseFileCache) {
@@ -1450,18 +1486,19 @@ function wfEmergencyAbort( &$conn, $error ) {
$t = Title::newFromURL( $title );
} elseif (@/**/$_REQUEST['search']) {
$search = $_REQUEST['search'];
- echo wfMsgNoDB( 'searchdisabled' );
- echo wfMsgNoDB( 'googlesearch', htmlspecialchars( $search ), $wgInputEncoding );
+ echo $searchdisabled;
+ echo str_replace( array( '$1', '$2' ), array( htmlspecialchars( $search ),
+ $wgInputEncoding ), $googlesearch );
wfErrorExit();
} else {
- $t = Title::newFromText( wfMsgNoDBForContent( 'mainpage' ) );
+ $t = Title::newFromText( $mainpage );
}
}
$cache = new CacheManager( $t );
if( $cache->isFileCached() ) {
$msg = ''.$msg."
\n" .
- wfMsgNoDB( 'cachederror' ) . "
\n";
+ $cachederror . "\n";
$tag = '';
$text = str_replace(