summaryrefslogtreecommitdiffstats
path: root/3dparty
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-04-28 16:54:10 +0200
committerRobin Appelman <icewind1991@gmail.com>2011-04-28 16:54:10 +0200
commit1850bddb673d4e19e4ff5dd58c99855b1c0f7a71 (patch)
tree0fe22ca943beb0733c13b87b21e91f139f5b80d2 /3dparty
parente7c91b55b78aff8292f48d82d107b3a4865ddb99 (diff)
downloadnextcloud-server-1850bddb673d4e19e4ff5dd58c99855b1c0f7a71.tar.gz
nextcloud-server-1850bddb673d4e19e4ff5dd58c99855b1c0f7a71.zip
move sqlite database into the data folder, makes it easier to set the correct permissions
Diffstat (limited to '3dparty')
-rw-r--r--3dparty/MDB2/Driver/Manager/sqlite.php5
-rw-r--r--3dparty/MDB2/Driver/sqlite.php7
2 files changed, 11 insertions, 1 deletions
diff --git a/3dparty/MDB2/Driver/Manager/sqlite.php b/3dparty/MDB2/Driver/Manager/sqlite.php
index 3a5d266280e..5258cff891d 100644
--- a/3dparty/MDB2/Driver/Manager/sqlite.php
+++ b/3dparty/MDB2/Driver/Manager/sqlite.php
@@ -71,6 +71,8 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function createDatabase($name, $options = array())
{
+ global $SERVERROOT;
+ $datadir=OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" );
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
@@ -82,7 +84,8 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
'database already exists', __FUNCTION__);
}
$php_errormsg = '';
- $handle = @sqlite_open($database_file, $db->dsn['mode'], $php_errormsg);
+ $database_file="$datadir/$database_file.db";
+ $handle = sqlite_open($database_file, $db->dsn['mode'], $php_errormsg);
if (!$handle) {
return $db->raiseError(MDB2_ERROR_CANNOT_CREATE, null, null,
(isset($php_errormsg) ? $php_errormsg : 'could not create the database file'), __FUNCTION__);
diff --git a/3dparty/MDB2/Driver/sqlite.php b/3dparty/MDB2/Driver/sqlite.php
index 061b9c67aaa..49a8cbdfbc2 100644
--- a/3dparty/MDB2/Driver/sqlite.php
+++ b/3dparty/MDB2/Driver/sqlite.php
@@ -347,6 +347,8 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
**/
function connect()
{
+ global $SERVERROOT;
+ $datadir=OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" );
$database_file = $this->_getDatabaseFile($this->database_name);
if (is_resource($this->connection)) {
//if (count(array_diff($this->connected_dsn, $this->dsn)) == 0
@@ -370,6 +372,9 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
}
if ($database_file !== ':memory:') {
+ if(!strpos($database_file,'.db')){
+ $database_file="$datadir/$database_file.db";
+ }
if (!file_exists($database_file)) {
if (!touch($database_file)) {
return $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
@@ -405,7 +410,9 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
$php_errormsg = '';
if (version_compare('5.1.0', PHP_VERSION, '>')) {
@ini_set('track_errors', true);
+ echo 1;
$connection = @$connect_function($database_file);
+ echo 2;
@ini_restore('track_errors');
} else {
$connection = @$connect_function($database_file, 0666, $php_errormsg);