Fixed installation
This commit is contained in:
parent
71ea5fa03d
commit
afb6d86d3c
5 changed files with 17 additions and 48 deletions
|
@ -41,16 +41,14 @@ abstract class Config extends \Flake\Core\Model\NoDb {
|
||||||
try {
|
try {
|
||||||
$config = Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml");
|
$config = Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml");
|
||||||
$aConfig = $config[$sConfigFileSection];
|
$aConfig = $config[$sConfigFileSection];
|
||||||
|
foreach (array_keys($this->aData) as $sProp) {
|
||||||
|
if (array_key_exists($sProp, $aConfig)) {
|
||||||
|
$this->aData[$sProp] = $aConfig[$sProp];
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
error_log('Error reading baikal.yaml file : ' . $e->getMessage());
|
error_log('Error reading baikal.yaml file : ' . $e->getMessage());
|
||||||
$aConfig = static::getDefaultConfig();
|
// Keep default values in $aData
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
foreach (array_keys($this->aData) as $sProp) {
|
|
||||||
if (array_key_exists($sProp, $aConfig)) {
|
|
||||||
$this->aData[$sProp] = $aConfig[$sProp];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +56,7 @@ abstract class Config extends \Flake\Core\Model\NoDb {
|
||||||
if (file_exists(PROJECT_PATH_CONFIG . "baikal.yaml")) {
|
if (file_exists(PROJECT_PATH_CONFIG . "baikal.yaml")) {
|
||||||
return Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml")[$this->sConfigFileSection];
|
return Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml")[$this->sConfigFileSection];
|
||||||
} else {
|
} else {
|
||||||
return static::getDefaultConfig();
|
return $this->aData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +85,12 @@ abstract class Config extends \Flake\Core\Model\NoDb {
|
||||||
}
|
}
|
||||||
|
|
||||||
function persist() {
|
function persist() {
|
||||||
$config = Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml");
|
if (file_exists(PROJECT_PATH_CONFIG . "baikal.yaml")) {
|
||||||
|
$config = Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml");
|
||||||
|
} else {
|
||||||
|
$config = [];
|
||||||
|
|
||||||
|
}
|
||||||
$config[$this->sConfigFileSection] = $this->aData;
|
$config[$this->sConfigFileSection] = $this->aData;
|
||||||
$yaml = Yaml::dump($config);
|
$yaml = Yaml::dump($config);
|
||||||
file_put_contents(PROJECT_PATH_CONFIG . "baikal.yaml", $yaml);
|
file_put_contents(PROJECT_PATH_CONFIG . "baikal.yaml", $yaml);
|
||||||
|
@ -96,7 +99,4 @@ abstract class Config extends \Flake\Core\Model\NoDb {
|
||||||
function destroy() {
|
function destroy() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getDefaultConfig() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,8 +115,4 @@ class Database extends \Baikal\Model\Config {
|
||||||
function label() {
|
function label() {
|
||||||
return "Baïkal Database Settings";
|
return "Baïkal Database Settings";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getDefaultConfig() {
|
|
||||||
throw new \Exception("Should never reach getDefaultConfig() on \Baikal\Model\Config\Database");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,13 +64,13 @@ class Standard extends \Baikal\Model\Config {
|
||||||
"timezone" => "Europe/Paris",
|
"timezone" => "Europe/Paris",
|
||||||
"card_enabled" => true,
|
"card_enabled" => true,
|
||||||
"cal_enabled" => true,
|
"cal_enabled" => true,
|
||||||
"invite_from" => "",
|
|
||||||
"dav_auth_type" => "Digest",
|
"dav_auth_type" => "Digest",
|
||||||
"admin_passwordhash" => "",
|
"admin_passwordhash" => "",
|
||||||
"auth_realm" => "BaikalDAV"
|
"auth_realm" => "BaikalDAV"
|
||||||
];
|
];
|
||||||
|
|
||||||
function __construct() {
|
function __construct() {
|
||||||
|
$this->aData["invite_from"] = "noreply@" . $_SERVER['SERVER_NAME']; // Default value
|
||||||
parent::__construct("system");
|
parent::__construct("system");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,18 +165,4 @@ class Standard extends \Baikal\Model\Config {
|
||||||
|
|
||||||
return parent::get($sProp);
|
return parent::get($sProp);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getDefaultConfig() {
|
|
||||||
|
|
||||||
return [
|
|
||||||
"timezone" => "Europe/Paris",
|
|
||||||
"card_enabled" => true,
|
|
||||||
"cal_enabled" => true,
|
|
||||||
"invite_from" => "noreply@" . $_SERVER['SERVER_NAME'],
|
|
||||||
"dav_auth_type" => "Digest",
|
|
||||||
"admin_passwordhash" => "",
|
|
||||||
"auth_realm" => "BaikalDAV",
|
|
||||||
"configured_version" => BAIKAL_VERSION
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ class System extends \Baikal\Model\Config {
|
||||||
|
|
||||||
# Default values
|
# Default values
|
||||||
protected $aData = [
|
protected $aData = [
|
||||||
"sqlite_file" => "db/db.sqlite",
|
"sqlite_file" => PROJECT_PATH_SPECIFIC . "db/db.sqlite",
|
||||||
"mysql" => false,
|
"mysql" => false,
|
||||||
"mysql_host" => "",
|
"mysql_host" => "",
|
||||||
"mysql_dbname" => "",
|
"mysql_dbname" => "",
|
||||||
|
@ -125,17 +125,4 @@ class System extends \Baikal\Model\Config {
|
||||||
function label() {
|
function label() {
|
||||||
return "Baïkal Settings";
|
return "Baïkal Settings";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getDefaultConfig() {
|
|
||||||
|
|
||||||
return [
|
|
||||||
"sqlite_file" => "db/db.sqlite",
|
|
||||||
"mysql" => false,
|
|
||||||
"mysql_host" => "",
|
|
||||||
"mysql_dbname" => "",
|
|
||||||
"mysql_username" => "",
|
|
||||||
"mysql_password" => "",
|
|
||||||
"encryption_key" => ""
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Initialize extends \Flake\Core\Controller {
|
||||||
# Assert that /Specific is writable
|
# Assert that /Specific is writable
|
||||||
|
|
||||||
if (!file_exists(PROJECT_PATH_SPECIFIC) || !is_dir(PROJECT_PATH_SPECIFIC) || !is_writable(PROJECT_PATH_SPECIFIC) || !file_exists(PROJECT_PATH_CONFIG) || !is_dir(PROJECT_PATH_CONFIG) || !is_writable(PROJECT_PATH_CONFIG)) {
|
if (!file_exists(PROJECT_PATH_SPECIFIC) || !is_dir(PROJECT_PATH_SPECIFIC) || !is_writable(PROJECT_PATH_SPECIFIC) || !file_exists(PROJECT_PATH_CONFIG) || !is_dir(PROJECT_PATH_CONFIG) || !is_writable(PROJECT_PATH_CONFIG)) {
|
||||||
$message = "<h1>Error - Insufficient permissions on the <span style='background-color: yellow;'>Specific/</span> folder</h1><p>";
|
$message = "<h1>Error - Insufficient permissions on the configuration folders</h1><p>";
|
||||||
$message .= "<p>In order to work properly, Baïkal needs to have write permissions in the <strong>Specific/</strong> and <strong>config/</strong> folder.</p>";
|
$message .= "<p>In order to work properly, Baïkal needs to have write permissions in the <strong>Specific/</strong> and <strong>config/</strong> folder.</p>";
|
||||||
|
|
||||||
die($message);
|
die($message);
|
||||||
|
|
Loading…
Add table
Reference in a new issue