aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2012-06-19 20:23:49 -0400
committercash <cash.costello@gmail.com>2012-06-19 20:23:49 -0400
commit690f226100a2f690bd77d05a82668c9cfee7b863 (patch)
tree6150983621f492f304e4cd8dbdc3c1ba5d431aff
parentacb6ceb71afa00a66280f4d33e952df39729eca6 (diff)
downloadelgg-690f226100a2f690bd77d05a82668c9cfee7b863.tar.gz
elgg-690f226100a2f690bd77d05a82668c9cfee7b863.tar.bz2
Fixes #4382 catches lost connection to database - from Paweł
-rw-r--r--engine/lib/database.php4
-rw-r--r--languages/en.php1
2 files changed, 5 insertions, 0 deletions
diff --git a/engine/lib/database.php b/engine/lib/database.php
index cc2b99f6a..7d90b30b8 100644
--- a/engine/lib/database.php
+++ b/engine/lib/database.php
@@ -253,6 +253,10 @@ function execute_query($query, $dblink) {
throw new DatabaseException(elgg_echo('DatabaseException:InvalidQuery'));
}
+ if (!is_resource($dblink)) {
+ throw new DatabaseException(elgg_echo('DatabaseException:InvalidDBLink'));
+ }
+
$dbcalls++;
$result = mysql_query($query, $dblink);
diff --git a/languages/en.php b/languages/en.php
index e9c333041..93096df38 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -56,6 +56,7 @@ $english = array(
'DatabaseException:DBSetupIssues' => "There were a number of issues: ",
'DatabaseException:ScriptNotFound' => "Elgg couldn't find the requested database script at %s.",
'DatabaseException:InvalidQuery' => "Invalid query",
+ 'DatabaseException:InvalidDBLink' => "Connection to database was lost.",
'IOException:FailedToLoadGUID' => "Failed to load new %s from GUID:%d",
'InvalidParameterException:NonElggObject' => "Passing a non-ElggObject to an ElggObject constructor!",