<?php
if(!file_exists("conf.php")) {
echo ">>> NOTE:\n>>> The file conf.php must be edited specifically for this system\n";
echo ">>> The default file has been created for you.\n>>> Please edit the file to match your system\n";
copy( "conf-sample.php", "conf.php" );
exit;
}
include "conf.php";
if(!isset($path_website)){
echo ">>> ERROR:\n";
echo "The path to the website must be set. Please edit/correct conf.php\n";
exit;
}
if(!isset($path_project)){
echo ">>> ERROR:\n";
echo "The path to the projectmust be set. Please edit/correct conf.php\n";
exit;
}
if(!isset($runtime_paths)){
echo ">>> ERROR:\n";
echo "variable runtime_paths is not set. Please edit/correct conf.php. See conf-sample.php for details\n";
exit;
}
if(!file_exists( "$path_website/data" )) {
// create the data directory
mkdir( "$path_website/data" );
}
if(!file_exists( "$path_website/data/data.db" )) {
// copy over the empty database
copy( "$path_project/install/db/data.db", "$path_website/data/data.db" );
}
$str_paths = '<?php';
$str_paths .= "\n\n// DO NOT EDIT\n\n";
$str_paths .= "// This file is auto generated by install.sh\n\n";
for($i=0; $i<count($runtime_paths); $i++){
$str_paths .= '$'.$runtime_paths[$i][0] . "='{$runtime_paths[$i][1]}';\n";
}
$str_paths .= "\n?>";
file_put_contents( "$path_website/inc/paths.php", $str_paths );
?>