added a unlink before each rename for windows systems

This commit is contained in:
Ralf Becker 2003-07-21 16:09:33 +00:00
parent acaae4b3e6
commit 3fcb565374
3 changed files with 34 additions and 5 deletions

View File

@ -563,7 +563,12 @@
if (is_writable(PHPGW_SERVER_ROOT."/$app/setup")) 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") while ($header[strlen($header)-1] == "\t")
{ {
@ -629,7 +634,12 @@
if (is_writable(PHPGW_SERVER_ROOT."/$app/setup")) 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); $fnew = eregi_replace("(.*\\$"."setup_info\\['$app'\\]\\['version'\\][ \\t]*=[ \\t]*')[^']*('.*)","\\1$new"."\\2",$fcontent);
@ -728,7 +738,12 @@
$update = fread($f,filesize($file_update)); $update = fread($f,filesize($file_update));
$update = str_replace('?>','',$update); $update = str_replace('?>','',$update);
fclose($f); 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 else
{ {

View File

@ -535,6 +535,10 @@
$file .= '.xet'; $file .= '.xet';
if (file_exists($file)) if (file_exists($file))
{ {
if (file_exists($old_file))
{
unlink($old_file);
}
rename($file,$old_file); rename($file,$old_file);
} }

View File

@ -609,7 +609,12 @@
$file = "$dir/etemplates.inc.php"; $file = "$dir/etemplates.inc.php";
if (file_exists($file)) 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'))) if (!($f = fopen($file,'w')))
@ -777,7 +782,12 @@
$file = "$dir/phpgw_$lang.lang"; $file = "$dir/phpgw_$lang.lang";
if (file_exists($file)) 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->write_file($app,$langarr,$lang);
$solangfile->loaddb($app,$lang); $solangfile->loaddb($app,$lang);