aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/database.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/engine/lib/database.php b/engine/lib/database.php
index 74cf13216..cd08d9d48 100644
--- a/engine/lib/database.php
+++ b/engine/lib/database.php
@@ -137,7 +137,7 @@
function init_db($event, $object_type, $object = null) {
register_shutdown_function('db_delayedexecution_shutdown_hook');
register_shutdown_function('db_profiling_shutdown_hook');
- setup_db_connections();
+ //setup_db_connections(); // [Marcus Povey 20090213: Db connection moved to first db connection attempt]
return true;
}
@@ -151,12 +151,17 @@
global $dblink;
+
if (isset($dblink[$dblinktype])) {
return $dblink[$dblinktype];
- } else {
+ } else if (isset($dblink['readwrite'])) {
return $dblink['readwrite'];
}
-
+ else
+ {
+ setup_db_connections();
+ return get_db_link($dblinktype);
+ }
}
/**
@@ -180,8 +185,8 @@
*/
function execute_query($query, $dblink)
{
- global $CONFIG, $dbcalls, $DB_PROFILE, $DB_QUERY_CACHE;
-
+ global $CONFIG, $dbcalls, $DB_PROFILE, $DB_QUERY_CACHE;
+
$dbcalls++;
//if ((isset($CONFIG->debug)) && ($CONFIG->debug==true))