Commit 499f9e20 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #204 in ZP/z-push from...

Merge pull request #204 in ZP/z-push from bugfix/ZP-882-loading-policies.ini-doesn-t-work to develop

* commit 'a25e6e44':
  ZP-882 Make sure $policyfile is always set. parse_ini_file() returns an empty array if the file is not found.
  ZP-882 Load policies.ini with the REAL_BASE_PATH.
parents 3f18f12b a25e6e44
......@@ -153,7 +153,8 @@
define('LOOSE_PROVISIONING', false);
// The file containing the policies' settings.
define('PROVISIONING_POLICYFILE', BASE_PATH . 'policies.ini');
// Set a full path or relative to the z-push main directory
define('PROVISIONING_POLICYFILE', 'policies.ini');
// Default conflict preference
// Some devices allow to set if the server or PIM (mobile)
......
......@@ -288,9 +288,15 @@ class ZPush {
// check if Provisioning is enabled and the default policies are available
if (PROVISIONING) {
ZPush::$policies = parse_ini_file(PROVISIONING_POLICYFILE, true);
if (file_exists(REAL_BASE_PATH . PROVISIONING_POLICYFILE)) {
$policyfile = REAL_BASE_PATH . PROVISIONING_POLICYFILE;
}
else {
$policyfile = PROVISIONING_POLICYFILE;
}
ZPush::$policies = parse_ini_file($policyfile, true);
if (!isset(ZPush::$policies['default'])) {
throw new FatalMisconfigurationException(sprintf("Your policies' configuration file doesn't contain the required [default] section. Please check the %s file.", constant('PROVISIONING_POLICYFILE')));
throw new FatalMisconfigurationException(sprintf("Your policies' configuration file doesn't contain the required [default] section. Please check the '%s' file.", $policyfile));
}
}
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment