From 581328fbc1a9c56654ddd49c407b5b6cc28fbc50 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 6 Jul 2010 19:57:08 +0200 Subject: [PATCH] Fix custom database names --- db_structure.xml | 14 +++++++------- inc/lib_base.php | 12 +++++++++++- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/db_structure.xml b/db_structure.xml index f5d0f24505..7efb722bd7 100755 --- a/db_structure.xml +++ b/db_structure.xml @@ -1,7 +1,7 @@ - owncloud + *dbname* true false @@ -9,7 +9,7 @@ - groups + *dbprefix*groups @@ -45,7 +45,7 @@
- locks + *dbprefix*locks @@ -173,7 +173,7 @@
- log + *dbprefix*log @@ -224,7 +224,7 @@
- properties + *dbprefix*properties @@ -289,7 +289,7 @@
- user_group + *dbprefix*user_group @@ -324,7 +324,7 @@
- users + *dbprefix*users diff --git a/inc/lib_base.php b/inc/lib_base.php index 67dbcb2eac..5c9906d361 100755 --- a/inc/lib_base.php +++ b/inc/lib_base.php @@ -530,7 +530,17 @@ class OC_DB { static function createDBFromStructure($file){ OC_DB::connect(); - $definition=@self::$schema->parseDatabaseDefinitionFile($file); + global $CONFIG_DBNAME; + global $CONFIG_DBTABLEPREFIX; + $content=file_get_contents($file); + $file2=tempnam(sys_get_temp_dir(),'oc_db_scheme_'); + echo $content; + $content=str_replace('*dbname*',$CONFIG_DBNAME,$content); + $content=str_replace('*dbprefix*',$CONFIG_DBTABLEPREFIX,$content); + echo $content; + file_put_contents($file2,$content); + $definition=@self::$schema->parseDatabaseDefinitionFile($file2); + unlink($file2); if($definition instanceof MDB2_Schema_Error){ die($definition->getMessage() . ': ' . $definition->getUserInfo()); }