parent
117f747df1
commit
081e26813c
4 changed files with 65 additions and 7 deletions
|
@ -106,6 +106,7 @@ $sDirName = appendSlash(dirname($sScript));
|
|||
$sBaseUrl = appendSlash(substr($sDirName, 0, -1 * strlen(BAIKAL_CONTEXT_BASEURI)));
|
||||
$aParts = explode("/", $_SERVER["SERVER_PROTOCOL"]);
|
||||
$sProtocol = strtolower(array_shift($aParts));
|
||||
define("BAIKAL_BASEURI", $sBaseUrl);
|
||||
define("BAIKAL_URI", $sProtocol . "://" . rmEndSlash($_SERVER["HTTP_HOST"]) . $sBaseUrl);
|
||||
unset($sScript); unset($sDirName); unset($sBaseUrl); unset($sProtocol); unset($aParts);
|
||||
|
||||
|
@ -136,11 +137,8 @@ if(
|
|||
if(!defined("BAIKAL_ADMIN_PASSWORDHASH")) {
|
||||
installTool();
|
||||
}
|
||||
|
||||
# Check that DB exists
|
||||
if(!file_exists(BAIKAL_SQLITE_FILE)) {
|
||||
die("DB file does not exist.<br />To create it, please copy '<b>Core/Resources/baikal.empty.sqlite</b>' to '<b>Specific/db/baikal.sqlite</b>'.<br /><span style='color: red; font-weight: bold'>Please note the change in the file name while doing so</span> (from 'baikal.empty.sqlite' to 'baikal.sqlite').");
|
||||
}
|
||||
|
||||
\Baikal\Core\Tools::assertEnvironmentIsOk();
|
||||
|
||||
# Database
|
||||
$pdo = new PDO('sqlite:' . BAIKAL_SQLITE_FILE);
|
||||
|
|
|
@ -31,6 +31,54 @@ class Tools {
|
|||
return $GLOBALS["pdo"];
|
||||
}
|
||||
|
||||
public static function assertEnvironmentIsOk() {
|
||||
|
||||
# Asserting DB file exists
|
||||
if(!file_exists(BAIKAL_SQLITE_FILE)) {
|
||||
throw new \Exception("DB file does not exist. To create it, please copy 'Core/Resources/baikal.empty.sqlite' to 'Specific/db/baikal.sqlite'.");
|
||||
}
|
||||
|
||||
# Asserting DB file is readable
|
||||
if(!is_readable(BAIKAL_SQLITE_FILE)) {
|
||||
throw new \Exception("DB file is not readable. Please give read permissions to httpd user on file 'Specific/db/baikal.sqlite'.");
|
||||
}
|
||||
|
||||
# Asserting DB file is writable
|
||||
if(!is_writable(BAIKAL_SQLITE_FILE)) {
|
||||
throw new \Exception("DB file is not writable. Please give write permissions to httpd user on file 'Specific/db/baikal.sqlite'.");
|
||||
}
|
||||
|
||||
# Asserting config file exists
|
||||
if(!file_exists(BAIKAL_PATH_SPECIFIC . "config.php")) {
|
||||
throw new \Exception("Specific/config.php does not exist. Please use the Install tool to create it.");
|
||||
}
|
||||
|
||||
# Asserting config file is readable
|
||||
if(!is_readable(BAIKAL_PATH_SPECIFIC . "config.php")) {
|
||||
throw new \Exception("Specific/config.php is not readable. Please give read permissions to httpd user on file 'Specific/config.php'.");
|
||||
}
|
||||
|
||||
# Asserting config file is writable
|
||||
if(!is_writable(BAIKAL_PATH_SPECIFIC . "config.php")) {
|
||||
throw new \Exception("Specific/config.php is not writable. Please give write permissions to httpd user on file 'Specific/config.php'.");
|
||||
}
|
||||
|
||||
# Asserting system config file exists
|
||||
if(!file_exists(BAIKAL_PATH_SPECIFIC . "config.system.php")) {
|
||||
throw new \Exception("Specific/config.system.php does not exist. Please use the Install tool to create it.");
|
||||
}
|
||||
|
||||
# Asserting system config file is readable
|
||||
if(!is_readable(BAIKAL_PATH_SPECIFIC . "config.system.php")) {
|
||||
throw new \Exception("Specific/config.system.php is not readable. Please give read permissions to httpd user on file 'Specific/config.system.php'.");
|
||||
}
|
||||
|
||||
# Asserting system config file is writable
|
||||
if(!is_writable(BAIKAL_PATH_SPECIFIC . "config.system.php")) {
|
||||
throw new \Exception("Specific/config.system.php is not writable. Please give write permissions to httpd user on file 'Specific/config.system.php'.");
|
||||
}
|
||||
}
|
||||
|
||||
public static function getUsers() {
|
||||
|
||||
$aUsers = array();
|
||||
|
|
|
@ -36,10 +36,10 @@ class System extends \Baikal\Model\Config {
|
|||
"type" => "string",
|
||||
),
|
||||
"BAIKAL_CARD_BASEURI" => array(
|
||||
"type" => "string",
|
||||
"type" => "litteral",
|
||||
),
|
||||
"BAIKAL_CAL_BASEURI" => array(
|
||||
"type" => "string",
|
||||
"type" => "litteral",
|
||||
),
|
||||
"BAIKAL_SQLITE_FILE" => array(
|
||||
"type" => "litteral",
|
||||
|
|
12
html/.htaccess
Normal file
12
html/.htaccess
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Disabling URL rewrite and cache management
|
||||
# that could cause problems with DAV requests
|
||||
# Useful only for Apache servers, with AllowOverride All
|
||||
# (ie, .htaccess files enabled)
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine Off
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_expires.c>
|
||||
ExpiresActive Off
|
||||
</IfModule>
|
Loading…
Reference in a new issue