Fix custom database names

This commit is contained in:
Robin Appelman 2010-07-06 19:57:08 +02:00
parent 9fe7f992d9
commit 581328fbc1
2 changed files with 18 additions and 8 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<database>
<name>owncloud</name>
<name>*dbname*</name>
<create>true</create>
<overwrite>false</overwrite>
@ -9,7 +9,7 @@
<table>
<name>groups</name>
<name>*dbprefix*groups</name>
<declaration>
@ -45,7 +45,7 @@
<table>
<name>locks</name>
<name>*dbprefix*locks</name>
<declaration>
@ -173,7 +173,7 @@
<table>
<name>log</name>
<name>*dbprefix*log</name>
<declaration>
@ -224,7 +224,7 @@
<table>
<name>properties</name>
<name>*dbprefix*properties</name>
<declaration>
@ -289,7 +289,7 @@
<table>
<name>user_group</name>
<name>*dbprefix*user_group</name>
<declaration>
@ -324,7 +324,7 @@
<table>
<name>users</name>
<name>*dbprefix*users</name>
<declaration>

View File

@ -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());
}