From 8cf1d8949eb1785aa51efd5f64b52b223981b751 Mon Sep 17 00:00:00 2001 From: patrickslee Date: Sun, 26 Mar 2006 21:47:49 +0000 Subject: [PATCH] Stripped out an unnecessary line in pg_dump output which causes error. Also deletes the last temp file while duplicating database to save space --- admin/utfdbmigrate.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/admin/utfdbmigrate.php b/admin/utfdbmigrate.php index 24aeea5528d..0102504e629 100755 --- a/admin/utfdbmigrate.php +++ b/admin/utfdbmigrate.php @@ -206,6 +206,7 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here if (isset($host[1])) $cmd .= " -p {$host[1]}"; } $cmds[] = $cmd; + $cmds[] = 'grep -v "COMMENT ON SCHEMA"'; $cmds[] = 'iconv -f UTF-8 -t UTF-8 -c'; $cmd = "PGPASSWORD={$_SESSION['newpostgresdb']->dbpass} PGDATABASE={$_SESSION['newpostgresdb']->dbname} psql -q -U {$_SESSION['newpostgresdb']->dbuser} -v ON_ERROR_STOP=1$cluster"; if ($_SESSION['newpostgresdb']->dbhost) { @@ -217,10 +218,11 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here foreach ($cmds as $key => $cmd) { $files[] = tempnam($CFG->dataroot, 'utf8_'); exec($cmd . ($key?" < {$files[$key-1]}":'') . " 2>&1 > {$files[$key]}", $output, $return_var); + if ($key) { + unlink($files[$key-1]); + } if ($return_var) { // we are dead! - foreach ($files as $file) { - unlink($file); - } + unlink($files[$key]); echo '
'; print_simple_box_start('center','50%'); print_string('dbmigrationdupfailed','admin',htmlspecialchars(implode("\n", $output))); @@ -229,9 +231,7 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here exit; } } - foreach ($files as $file) { - unlink($file); - } + unlink(array_pop($files)); } $migrationconfig = new object;