Newer
Older
backup-commander / install / install.php
  1. <?php
  2.  
  3. if(!file_exists("conf.php")) {
  4. echo ">>> NOTE:\n>>> The file conf.php must be edited specifically for this system\n";
  5. echo ">>> The default file has been created for you.\n>>> Please edit the file to match your system\n";
  6. copy( "conf-sample.php", "conf.php" );
  7. exit;
  8. }
  9.  
  10. include "conf.php";
  11.  
  12. if(!isset($path_website)){
  13. echo ">>> ERROR:\n";
  14. echo "The path to the website must be set. Please edit/correct conf.php\n";
  15. exit;
  16. }
  17.  
  18. if(!isset($path_project)){
  19. echo ">>> ERROR:\n";
  20. echo "The path to the projectmust be set. Please edit/correct conf.php\n";
  21. exit;
  22. }
  23.  
  24. if(!isset($runtime_paths)){
  25. echo ">>> ERROR:\n";
  26. echo "variable runtime_paths is not set. Please edit/correct conf.php. See conf-sample.php for details\n";
  27. exit;
  28. }
  29.  
  30.  
  31. if(!file_exists( "$path_website/data" )) {
  32. // create the data directory
  33. mkdir( "$path_website/data" );
  34. }
  35.  
  36. if(!file_exists( "$path_website/data/data.db" )) {
  37. // copy over the empty database
  38. copy( "$path_project/install/db/data.db", "$path_website/data/data.db" );
  39. }
  40.  
  41. $str_paths = '<?php';
  42. $str_paths .= "\n\n// DO NOT EDIT\n\n";
  43. $str_paths .= "// This file is auto generated by install.sh\n\n";
  44.  
  45. for($i=0; $i<count($runtime_paths); $i++){
  46. $str_paths .= '$'.$runtime_paths[$i][0] . "='{$runtime_paths[$i][1]}';\n";
  47. }
  48. $str_paths .= "\n?>";
  49. file_put_contents( "$path_website/inc/paths.php", $str_paths );
  50.  
  51.  
  52. ?>