diff --git a/etemplate/inc/class.db_tools.inc.php b/etemplate/inc/class.db_tools.inc.php index ee22d06a26..387796c4f7 100644 --- a/etemplate/inc/class.db_tools.inc.php +++ b/etemplate/inc/class.db_tools.inc.php @@ -563,7 +563,12 @@ if (is_writable(PHPGW_SERVER_ROOT."/$app/setup")) { - rename($file,PHPGW_SERVER_ROOT."/$app/setup/tables_current.old.inc.php"); + $old_file = PHPGW_SERVER_ROOT . "/$app/setup/tables_current.old.inc.php"; + if (file_exists($old_file)) + { + unlink($old_file); + } + rename($file,$old_file); } while ($header[strlen($header)-1] == "\t") { @@ -629,7 +634,12 @@ if (is_writable(PHPGW_SERVER_ROOT."/$app/setup")) { - rename($file,PHPGW_SERVER_ROOT."/$app/setup/setup.old.inc.php"); + $old_file = PHPGW_SERVER_ROOT . "/$app/setup/setup.old.inc.php"; + if (file_exists($old_file)) + { + unlink($old_file); + } + rename($file,$old_file); } $fnew = eregi_replace("(.*\\$"."setup_info\\['$app'\\]\\['version'\\][ \\t]*=[ \\t]*')[^']*('.*)","\\1$new"."\\2",$fcontent); @@ -728,7 +738,12 @@ $update = fread($f,filesize($file_update)); $update = str_replace('?>','',$update); fclose($f); - rename($file_update,PHPGW_SERVER_ROOT."/$app/setup/tables_update.old.inc.php"); + $old_file = PHPGW_SERVER_ROOT . "/$app/setup/tables_update.old.inc.php"; + if (file_exists($old_file)) + { + unlink($old_file); + } + rename($file_update,$old_file); } else { diff --git a/etemplate/inc/class.editor.inc.php b/etemplate/inc/class.editor.inc.php index 9eddbce379..6f823ed150 100644 --- a/etemplate/inc/class.editor.inc.php +++ b/etemplate/inc/class.editor.inc.php @@ -535,6 +535,10 @@ $file .= '.xet'; if (file_exists($file)) { + if (file_exists($old_file)) + { + unlink($old_file); + } rename($file,$old_file); } diff --git a/etemplate/inc/class.soetemplate.inc.php b/etemplate/inc/class.soetemplate.inc.php index e5b38ffbdd..424cf8077a 100644 --- a/etemplate/inc/class.soetemplate.inc.php +++ b/etemplate/inc/class.soetemplate.inc.php @@ -609,7 +609,12 @@ $file = "$dir/etemplates.inc.php"; if (file_exists($file)) { - rename($file,"$dir/etemplates.old.inc.php"); + $old_file = "$dir/etemplates.old.inc.php"; + if (file_exists($old_file)) + { + unlink($old_file); + } + rename($file,$old_file); } if (!($f = fopen($file,'w'))) @@ -777,7 +782,12 @@ $file = "$dir/phpgw_$lang.lang"; if (file_exists($file)) { - rename($file,"$dir/phpgw_$lang.old.lang"); + $old_file = "$dir/phpgw_$lang.old.lang"; + if (file_exists($old_file)) + { + unlink($old_file); + } + rename($file,$old_file); } $solangfile->write_file($app,$langarr,$lang); $solangfile->loaddb($app,$lang);