fix error if server configs are renamed already

This commit is contained in:
Steffen Müller 2023-03-12 11:40:27 +01:00
parent 5374602896
commit 9ef3938e10

View File

@ -7,17 +7,26 @@
// This is needed because some hosts do not either unzip hidden files
// or neither GitHub puts that file inside the zips.
/********************************************************************/
$apacheExampleName = "ApacheHtaccess";
$apacheProductionName = ".htaccess";
$iisExampleName = "IISWebConfig";
$iisProductionName = "web.config";
if(stripos($_SERVER['SERVER_SOFTWARE'],'apache')!== false){
$f = fopen(".htaccess", "a+");
$f2 = fopen("ApacheHtaccess","r");
fwrite($f, fread($f2, filesize("ApacheHtaccess")));
fclose($f);
fclose($f2);
if(!file_exists($apacheProductionName)) {
$f = fopen($apacheProductionName, "a+");
$f2 = fopen($apacheExampleName,"r");
fwrite($f, fread($f2, filesize($apacheExampleName)));
fclose($f);
fclose($f2);
}
// skipping renaming file if it already exists
} else {
$f = fopen("web.config", "a+");
$f2 = fopen("IISWebConfig","r");
fwrite($f, fread($f2, filesize("IISWebConfig")));
fclose($f);
fclose($f2);
if(!file_exists($iisProductionName)) {
$f = fopen($iisProductionName, "a+");
$f2 = fopen($iisExampleName,"r");
fwrite($f, fread($f2, filesize($iisExampleName)));
fclose($f);
fclose($f2);
}
}
?>