|
7 | 7 | // This is needed because some hosts do not either unzip hidden files
|
8 | 8 | // or neither GitHub puts that file inside the zips.
|
9 | 9 | /********************************************************************/
|
| 10 | +$apacheExampleName = "ApacheHtaccess"; |
| 11 | +$apacheProductionName = ".htaccess"; |
| 12 | +$iisExampleName = "IISWebConfig"; |
| 13 | +$iisProductionName = "web.config"; |
10 | 14 | if(stripos($_SERVER['SERVER_SOFTWARE'],'apache')!== false){
|
11 |
| -$f = fopen(".htaccess", "a+"); |
12 |
| -$f2 = fopen("ApacheHtaccess","r"); |
13 |
| -fwrite($f, fread($f2, filesize("ApacheHtaccess"))); |
14 |
| -fclose($f); |
15 |
| -fclose($f2); |
| 15 | + if(!file_exists($apacheProductionName)) { |
| 16 | + $f = fopen($apacheProductionName, "a+"); |
| 17 | + $f2 = fopen($apacheExampleName,"r"); |
| 18 | + fwrite($f, fread($f2, filesize($apacheExampleName))); |
| 19 | + fclose($f); |
| 20 | + fclose($f2); |
| 21 | + } |
| 22 | +// skipping renaming file if it already exists |
16 | 23 | } else {
|
17 |
| -$f = fopen("web.config", "a+"); |
18 |
| -$f2 = fopen("IISWebConfig","r"); |
19 |
| -fwrite($f, fread($f2, filesize("IISWebConfig"))); |
20 |
| -fclose($f); |
21 |
| -fclose($f2); |
| 24 | + if(!file_exists($iisProductionName)) { |
| 25 | + $f = fopen($iisProductionName, "a+"); |
| 26 | + $f2 = fopen($iisExampleName,"r"); |
| 27 | + fwrite($f, fread($f2, filesize($iisExampleName))); |
| 28 | + fclose($f); |
| 29 | + fclose($f2); |
| 30 | + } |
22 | 31 | }
|
23 | 32 | ?>
|
0 commit comments