Use lowercase for YAML configuration keys

This commit is contained in:
Cyril 2019-10-15 12:09:55 +02:00
parent 94304207f8
commit 6fc334a75d
12 changed files with 59 additions and 59 deletions

View file

@ -286,6 +286,6 @@ class User extends \Flake\Core\Model\Db {
$config = Yaml::parseFile(PROJECT_PATH_CONFIG . "config.yaml");
} catch (\Exception $e) {}
return md5($this->get("username") . ':' . $config['parameters']['BAIKAL_AUTH_REALM'] . ':' . $sPassword);
return md5($this->get("username") . ':' . $config['parameters']['baikal_auth_realm'] . ':' . $sPassword);
}
}

View file

@ -42,8 +42,8 @@ class Dashboard extends \Flake\Core\Controller {
$oView->setData("BAIKAL_VERSION", BAIKAL_VERSION);
# Services status
$oView->setData("BAIKAL_CAL_ENABLED", $config['parameters']['BAIKAL_CAL_ENABLED']);
$oView->setData("BAIKAL_CARD_ENABLED", $config['parameters']['BAIKAL_CARD_ENABLED']);
$oView->setData("BAIKAL_CAL_ENABLED", $config['parameters']['baikal_cal_enabled']);
$oView->setData("BAIKAL_CARD_ENABLED", $config['parameters']['baikal_card_enabled']);
# Statistics: Users
$iNbUsers = \Baikal\Model\User::getBaseRequester()->count();

View file

@ -41,8 +41,8 @@ class UpgradeConfirmation extends \Flake\Core\Controller {
$config = Yaml::parseFile(PROJECT_PATH_CONFIG . "config.yaml");
} catch (\Exception $e) {}
if (isset($config['parameters']['BAIKAL_CONFIGURED_VERSION']) && $config['parameters']['BAIKAL_CONFIGURED_VERSION'] === BAIKAL_VERSION) {
$sMessage = "Your system is configured to use version <strong>" . $config['parameters']['BAIKAL_CONFIGURED_VERSION'] . "</strong>.<br />There's no upgrade to be done.";
if (isset($config['parameters']['baikal_configured_version']) && $config['parameters']['baikal_configured_version'] === BAIKAL_VERSION) {
$sMessage = "Your system is configured to use version <strong>" . $config['parameters']['baikal_configured_version'] . "</strong>.<br />There's no upgrade to be done.";
} else {
$sMessage = "Upgrading Baïkal from version <strong>" . "Unknown" . "</strong> to version <strong>" . BAIKAL_VERSION . "</strong>";
}

View file

@ -71,7 +71,7 @@ class System extends \Flake\Core\Controller {
try {
$config = Yaml::parseFile(PROJECT_PATH_CONFIG . "system.yaml");
} catch (\Exception $e) {}
$bMySQL = $config['parameters']['PROJECT_DB_MYSQL'] ?? true;
$bMySQL = $config['parameters']['project_db_mysql'] ?? true;
}
if ($bMySQL === true) {

View file

@ -34,7 +34,7 @@ class Auth {
$config = Yaml::parseFile(PROJECT_PATH_CONFIG . "config.yaml");
if (isset($_SESSION["baikaladminauth"]) && $_SESSION["baikaladminauth"] === md5($config['parameters']['BAIKAL_ADMIN_PASSWORDHASH'])) {
if (isset($_SESSION["baikaladminauth"]) && $_SESSION["baikaladminauth"] === md5($config['parameters']['baikal_admin_passwordhash'])) {
return true;
}
@ -56,8 +56,8 @@ class Auth {
} catch (\Exception $e) {
}
if ($sUser === "admin" && $sPassHash === $config['parameters']['BAIKAL_ADMIN_PASSWORDHASH']) {
$_SESSION["baikaladminauth"] = md5($config['parameters']['BAIKAL_ADMIN_PASSWORDHASH']);
if ($sUser === "admin" && $sPassHash === $config['parameters']['baikal_admin_passwordhash']) {
$_SESSION["baikaladminauth"] = md5($config['parameters']['baikal_admin_passwordhash']);
return true;
}
@ -76,7 +76,7 @@ class Auth {
} catch (\Exception $e) { }
# Fallback to default value; useful when initializing App, as all constants are not set yet
$sAuthRealm = $config['parameters']['BAIKAL_AUTH_REALM'] ?? "BaikalDAV";
$sAuthRealm = $config['parameters']['baikal_auth_realm'] ?? "BaikalDAV";
return md5('admin:' . $sAuthRealm . ':' . $sPassword);
}

View file

@ -74,15 +74,15 @@ try {
$configSystem = Yaml::parseFile(PROJECT_PATH_CONFIG . "system.yaml");
} catch (\Exception $e) { $configSystem = null; }
if (!$configSystem || !isset($configSystem['parameters']["BAIKAL_CONFIGURED_VERSION"])) {
if (!$configSystem || !isset($configSystem['parameters']["baikal_configured_version"])) {
# we have to upgrade Baïkal (existing installation)
$oPage->zone("Payload")->addBlock(new \BaikalAdmin\Controller\Install\Initialize());
} elseif (!$config || !isset($config['parameters']["BAIKAL_ADMIN_PASSWORDHASH"])) {
} elseif (!$config || !isset($config['parameters']["baikal_admin_passwordhash"])) {
# we have to set an admin password
$oPage->zone("Payload")->addBlock(new \BaikalAdmin\Controller\Install\Initialize());
} else {
if ($configSystem['parameters']["BAIKAL_CONFIGURED_VERSION"] !== BAIKAL_VERSION) {
if ($configSystem['parameters']["baikal_configured_version"] !== BAIKAL_VERSION) {
# we have to upgrade Baïkal
if (\Flake\Util\Tools::GET("upgradeConfirmed")) {
$oPage->zone("Payload")->addBlock(new \BaikalAdmin\Controller\Install\VersionUpgrade());

View file

@ -220,10 +220,10 @@ class Framework extends \Flake\Core\Framework {
return true;
}
# Dont init db on install, but in normal mode and when upgrading
if (defined("BAIKAL_CONTEXT_INSTALL") && (!isset($config['parameters']['BAIKAL_CONFIGURED_VERSION']) || $config['parameters']['BAIKAL_CONFIGURED_VERSION'] === BAIKAL_VERSION)) {
if (defined("BAIKAL_CONTEXT_INSTALL") && (!isset($config['parameters']['baikal_configured_version']) || $config['parameters']['baikal_configured_version'] === BAIKAL_VERSION)) {
return true;
}
if ($config['parameters']['PROJECT_DB_MYSQL'] === true) {
if ($config['parameters']['project_db_mysql'] === true) {
self::initDbMysql($config);
} else {
self::initDbSqlite($config);
@ -232,22 +232,22 @@ class Framework extends \Flake\Core\Framework {
protected static function initDbSqlite(array $config) {
# Asserting DB filepath is set
if (!$config['parameters']['PROJECT_SQLITE_FILE']) {
if (!$config['parameters']['project_sqlite_file']) {
return false;
}
# Asserting DB file is writable
if (file_exists($config['parameters']['PROJECT_SQLITE_FILE']) && !is_writable($config['parameters']['PROJECT_SQLITE_FILE'])) {
die("<h3>DB file is not writable. Please give write permissions on file '<span style='font-family: monospace; background: yellow;'>" . $config['parameters']['PROJECT_SQLITE_FILE'] . "</span>'</h3>");
if (file_exists($config['parameters']['project_sqlite_file']) && !is_writable($config['parameters']['project_sqlite_file'])) {
die("<h3>DB file is not writable. Please give write permissions on file '<span style='font-family: monospace; background: yellow;'>" . $config['parameters']['project_sqlite_file'] . "</span>'</h3>");
}
# Asserting DB directory is writable
if (!is_writable(dirname($config['parameters']['PROJECT_SQLITE_FILE']))) {
die("<h3>The <em>FOLDER</em> containing the DB file is not writable, and it has to.<br />Please give write permissions on folder '<span style='font-family: monospace; background: yellow;'>" . dirname($config['parameters']['PROJECT_SQLITE_FILE']) . "</span>'</h3>");
if (!is_writable(dirname($config['parameters']['project_sqlite_file']))) {
die("<h3>The <em>FOLDER</em> containing the DB file is not writable, and it has to.<br />Please give write permissions on folder '<span style='font-family: monospace; background: yellow;'>" . dirname($config['parameters']['project_sqlite_file']) . "</span>'</h3>");
}
if (file_exists($config['parameters']['PROJECT_SQLITE_FILE']) && is_readable($config['parameters']['PROJECT_SQLITE_FILE']) && !isset($GLOBALS["DB"])) {
$GLOBALS["DB"] = new \Flake\Core\Database\Sqlite($config['parameters']['PROJECT_SQLITE_FILE']);
if (file_exists($config['parameters']['project_sqlite_file']) && is_readable($config['parameters']['project_sqlite_file']) && !isset($GLOBALS["DB"])) {
$GLOBALS["DB"] = new \Flake\Core\Database\Sqlite($config['parameters']['project_sqlite_file']);
return true;
}
@ -256,28 +256,28 @@ class Framework extends \Flake\Core\Framework {
protected static function initDbMysql(array $config) {
if (!$config['parameters']['PROJECT_DB_MYSQL_HOST']) {
if (!$config['parameters']['project_db_mysql_host']) {
die("<h3>The constant PROJECT_DB_MYSQL_HOST, containing the MySQL host name, is not set.<br />You should set it in config/system.yaml</h3>");
}
if (!$config['parameters']['PROJECT_DB_MYSQL_DBNAME']) {
if (!$config['parameters']['project_db_mysql_dbname']) {
die("<h3>The constant PROJECT_DB_MYSQL_DBNAME, containing the MySQL database name, is not set.<br />You should set it in config/system.yaml</h3>");
}
if (!$config['parameters']['PROJECT_DB_MYSQL_USERNAME']) {
if (!$config['parameters']['project_db_mysql_username']) {
die("<h3>The constant PROJECT_DB_MYSQL_USERNAME, containing the MySQL database username, is not set.<br />You should set it in config/system.yaml</h3>");
}
if (!$config['parameters']['PROJECT_DB_MYSQL_PASSWORD']) {
if (!$config['parameters']['project_db_mysql_password']) {
die("<h3>The constant PROJECT_DB_MYSQL_PASSWORD, containing the MySQL database password, is not set.<br />You should set it in config/system.yaml</h3>");
}
try {
$GLOBALS["DB"] = new \Flake\Core\Database\Mysql(
$config['parameters']['PROJECT_DB_MYSQL_HOST'],
$config['parameters']['PROJECT_DB_MYSQL_DBNAME'],
$config['parameters']['PROJECT_DB_MYSQL_USERNAME'],
$config['parameters']['PROJECT_DB_MYSQL_PASSWORD']
$config['parameters']['project_db_mysql_host'],
$config['parameters']['project_db_mysql_dbname'],
$config['parameters']['project_db_mysql_username'],
$config['parameters']['project_db_mysql_password']
);
# We now setup t6he connexion to use UTF8

View file

@ -1,8 +1,8 @@
parameters:
PROJECT_TIMEZONE: 'Europe/Paris'
BAIKAL_CARD_ENABLED: true
BAIKAL_CAL_ENABLED: true
BAIKAL_INVITE_FROM: 'noreply@localhost'
BAIKAL_DAV_AUTH_TYPE: 'Digest'
BAIKAL_ADMIN_PASSWORDHASH: 5fe794627e1f841f8debba065e2c807a
BAIKAL_AUTH_REALM: BaikalDAV
project_timezone: 'Europe/Paris'
baikal_card_enabled: true
baikal_cal_enabled: true
baikal_invite_from: 'noreply@localhost'
baikal_dav_auth_type: 'Digest'
baikal_admin_passwordhash: 5fe794627e1f841f8debba065e2c807a
baikal_auth_realm: BaikalDAV

View file

@ -1,9 +1,9 @@
parameters:
PROJECT_SQLITE_FILE: "absolute/path/to/Specific/db/db.sqlite"
PROJECT_DB_MYSQL: true
PROJECT_DB_MYSQL_HOST: 'localhost'
PROJECT_DB_MYSQL_DBNAME: 'baikal'
PROJECT_DB_MYSQL_USERNAME: 'baikal'
PROJECT_DB_MYSQL_PASSWORD: 'baikal'
BAIKAL_ENCRYPTION_KEY: '5d3f0fa0192e3058ea70f1bb20924add'
BAIKAL_CONFIGURED_VERSION: '0.7.0'
project_sqlite_file: "absolute/path/to/Specific/db/db.sqlite"
project_db_mysql: true
project_db_mysql_host: 'localhost'
project_db_mysql_dbname: 'baikal'
project_db_mysql_username: 'baikal'
project_db_mysql_password: 'baikal'
baikal_encryption_key: '5d3f0fa0192e3058ea70f1bb20924add'
baikal_configured_version: '0.7.0'

View file

@ -59,15 +59,15 @@ try {
die('<h1>Incomplete installation</h1><p>Ba&iuml;kal is missing its configuration file, or its configuration file is unreadable.');
}
if (!isset($config['parameters']["BAIKAL_CAL_ENABLED"]) || $config['parameters']["BAIKAL_CAL_ENABLED"] !== true) {
if (!isset($config['parameters']["baikal_cal_enabled"]) || $config['parameters']["baikal_cal_enabled"] !== true) {
throw new ErrorException("Baikal CalDAV is disabled.", 0, 255, __FILE__, __LINE__);
}
$server = new \Baikal\Core\Server(
$config['parameters']["BAIKAL_CAL_ENABLED"],
$config['parameters']["BAIKAL_CARD_ENABLED"],
$config['parameters']["BAIKAL_DAV_AUTH_TYPE"],
$config['parameters']["BAIKAL_AUTH_REALM"],
$config['parameters']["baikal_cal_enabled"],
$config['parameters']["baikal_card_enabled"],
$config['parameters']["baikal_dav_auth_type"],
$config['parameters']["baikal_auth_realm"],
$GLOBALS['DB']->getPDO(),
PROJECT_BASEURI . 'cal.php/'
);

View file

@ -60,15 +60,15 @@ try {
die('<h1>Incomplete installation</h1><p>Ba&iuml;kal is missing its configuration file, or its configuration file is unreadable.');
}
if (!isset($config['parameters']["BAIKAL_CARD_ENABLED"]) || $config['parameters']["BAIKAL_CARD_ENABLED"] !== true) {
if (!isset($config['parameters']["baikal_card_enabled"]) || $config['parameters']["baikal_card_enabled"] !== true) {
throw new ErrorException("Baikal CardDAV is disabled.", 0, 255, __FILE__, __LINE__);
}
$server = new \Baikal\Core\Server(
$config['parameters']["BAIKAL_CAL_ENABLED"],
$config['parameters']["BAIKAL_CARD_ENABLED"],
$config['parameters']["BAIKAL_DAV_AUTH_TYPE"],
$config['parameters']["BAIKAL_AUTH_REALM"],
$config['parameters']["baikal_cal_enabled"],
$config['parameters']["baikal_card_enabled"],
$config['parameters']["baikal_dav_auth_type"],
$config['parameters']["baikal_auth_realm"],
$GLOBALS['DB']->getPDO(),
PROJECT_BASEURI . 'card.php/'
);

View file

@ -59,10 +59,10 @@ try {
}
$server = new \Baikal\Core\Server(
$config['parameters']["BAIKAL_CAL_ENABLED"],
$config['parameters']["BAIKAL_CARD_ENABLED"],
$config['parameters']["BAIKAL_DAV_AUTH_TYPE"],
$config['parameters']["BAIKAL_AUTH_REALM"],
$config['parameters']["baikal_cal_enabled"],
$config['parameters']["baikal_card_enabled"],
$config['parameters']["baikal_dav_auth_type"],
$config['parameters']["baikal_auth_realm"],
$GLOBALS['DB']->getPDO(),
PROJECT_BASEURI . 'dav.php/'
);