Commit a249ef2d authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-882 Load policies.ini with the REAL_BASE_PATH.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 220672cb
...@@ -153,7 +153,8 @@ ...@@ -153,7 +153,8 @@
define('LOOSE_PROVISIONING', false); define('LOOSE_PROVISIONING', false);
// The file containing the policies' settings. // 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 // Default conflict preference
// Some devices allow to set if the server or PIM (mobile) // Some devices allow to set if the server or PIM (mobile)
......
...@@ -288,9 +288,15 @@ class ZPush { ...@@ -288,9 +288,15 @@ class ZPush {
// check if Provisioning is enabled and the default policies are available // check if Provisioning is enabled and the default policies are available
if (PROVISIONING) { if (PROVISIONING) {
ZPush::$policies = parse_ini_file(PROVISIONING_POLICYFILE, true); if (file_exists(PROVISIONING_POLICYFILE)) {
$policyfile = PROVISIONING_POLICYFILE;
}
else if (file_exists(REAL_BASE_PATH . PROVISIONING_POLICYFILE)) {
$policyfile = REAL_BASE_PATH . PROVISIONING_POLICYFILE;
}
ZPush::$policies = parse_ini_file($policyfile, true);
if (!isset(ZPush::$policies['default'])) { 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; 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