use in-memory files for the datase scheme during installation

This commit is contained in:
Robin Appelman 2012-02-28 11:39:39 +01:00
parent 3e0bb3e7c4
commit de37bafa5c
1 changed files with 6 additions and 6 deletions

View File

@ -316,8 +316,8 @@ class OC_DB {
// read file
$content = file_get_contents( $file );
// Make changes and save them to a temporary file
$file2 = tempnam( get_temp_dir(), 'oc_db_scheme_' );
// Make changes and save them to an in-memory file
$file2 = 'static://db_scheme';
if($file2 == ''){
die('could not create tempfile in get_temp_dir() - aborting');
}
@ -331,7 +331,7 @@ class OC_DB {
// Try to create tables
$definition = self::$schema->parseDatabaseDefinitionFile( $file2 );
// Delete our temporary file
//clean up memory
unlink( $file2 );
// Die in case something went wrong
@ -371,8 +371,8 @@ class OC_DB {
return false;
}
// Make changes and save them to a temporary file
$file2 = tempnam( get_temp_dir(), 'oc_db_scheme_' );
// Make changes and save them to an in-memory file
$file2 = 'static://db_scheme';
$content = str_replace( '*dbname*', $previousSchema['name'], $content );
$content = str_replace( '*dbprefix*', $CONFIG_DBTABLEPREFIX, $content );
if( $CONFIG_DBTYPE == 'pgsql' ){ //mysql support it too but sqlite doesn't
@ -381,7 +381,7 @@ class OC_DB {
file_put_contents( $file2, $content );
$op = self::$schema->updateDatabase($file2, $previousSchema, array(), false);
// Delete our temporary file
//clean up memory
unlink( $file2 );
if (PEAR::isError($op)) {