root/branches/dsss-smi/fix.php

Revision 635, 0.7 kB (checked in by Gregor, 1 year ago)

fix.php: Convenience file for fixing broken installs.

Line 
1 <?PHP
2 if (file_exists("pws.php")) {
3     die("To fix, move pws.php to pws.php.orig and move sources/ to sources.orig/");
4 }
5
6 // write pws.php
7 $pws = fopen("pws.php", "w");
8 if ($pws === false) die("Can't write to pws.php!");
9
10 fwrite($pws, file_get_contents("pws.php.orig"));
11 fclose($pws);
12 chmod("pws.php", 0600);
13
14 // make the sources dir
15 mkdir("sources");
16 chmod("sources", 0755);
17
18 // then copy in the original sources
19 $handle = opendir("sources.orig");
20 if ($handle === false) {
21     die("Failed to open sources.orig");
22 }
23 while (($f = readdir($handle)) !== false) {
24     if (substr($f, 0, 1) == ".") continue;
25     copy("sources.orig/" . $f, "sources/" . $f);
26 }
27 closedir($handle);
28
29 print "Done.";
30 ?>
Note: See TracBrowser for help on using the browser.