summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-02-06 01:18:45 +0100
committerRobin Appelman <icewind1991@gmail.com>2011-02-06 01:18:45 +0100
commit0a505fd383f0a7d45cc9442ef5fcaf9fece3ca54 (patch)
treefe3ec43ebc7581338c3fb94bede61fc46fcf0498
parent735152843170688ff901d26f6c71d959cb5ea2bf (diff)
downloadnextcloud-server-0a505fd383f0a7d45cc9442ef5fcaf9fece3ca54.tar.gz
nextcloud-server-0a505fd383f0a7d45cc9442ef5fcaf9fece3ca54.zip
only load mdb2 when we use the database
-rw-r--r--inc/lib_base.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/inc/lib_base.php b/inc/lib_base.php
index b8bbcb83d13..68194685655 100644
--- a/inc/lib_base.php
+++ b/inc/lib_base.php
@@ -1,5 +1,4 @@
<?php
-
/**
* ownCloud
*
@@ -81,8 +80,6 @@ oc_require_once('lib_log.php');
oc_require_once('lib_config.php');
oc_require_once('lib_user.php');
oc_require_once('lib_ocs.php');
-@oc_require_once('MDB2.php');
-@oc_require_once('MDB2/Schema.php');
oc_require_once('lib_connect.php');
oc_require_once('lib_remotestorage.php');
oc_require_once('lib_plugin.php');
@@ -369,6 +366,7 @@ class OC_DB {
global $CONFIG_DBTYPE;
global $DOCUMENTROOT;
global $SERVERROOT;
+ @oc_require_once('MDB2.php');
if(!self::$DBConnection){
$options = array(
'portability' => MDB2_PORTABILITY_ALL,
@@ -400,10 +398,14 @@ class OC_DB {
'database' => $CONFIG_DBNAME,
);
}
- self::$DBConnection=&MDB2::factory($dsn,$options);
+ self::$DBConnection=MDB2::factory($dsn,$options);
+
if (PEAR::isError(self::$DBConnection)) {
echo('<b>can not connect to database, using '.$CONFIG_DBTYPE.'. ('.self::$DBConnection->getUserInfo().')</center>');
- die(self::$DBConnection->getMessage());
+ $error=self::$DBConnection->getMessage();
+ error_log("$error");
+ error_log(self::$DBConnection->getUserInfo());
+ die($error);
}
self::$DBConnection->setFetchMode(MDB2_FETCHMODE_ASSOC);
}
@@ -411,6 +413,7 @@ class OC_DB {
public static function connectScheme(){
self::connect();
+ @oc_require_once('MDB2/Schema.php');
if(!self::$schema){
self::$schema=&MDB2_Schema::factory(self::$DBConnection);
}
@@ -467,7 +470,7 @@ class OC_DB {
$cmd=str_replace('`','"',$cmd);
}
$result=self::$DBConnection->queryAll($cmd);
- if (PEAR::isError($result)) {
+ if (PEAR::isError($result)){
$entry='DB Error: "'.$result->getMessage().'"<br />';
$entry.='Offending command was: '.$cmd.'<br />';
die($entry);