Commit cf3ad6fb authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #36 in ZP/z-push from feature/ZP-678-allow-to-autoload-backends to develop

* commit '86eea041':
  ZP-678 Allow to autoload backends. Released under the Affero GNU General Public License (AGPL) version 3. Do not try to include backend, if it can be or is already autoloaded. Allows to place backends outside z-push package.
parents 113e7645 86eea041
...@@ -485,7 +485,7 @@ class ZPush { ...@@ -485,7 +485,7 @@ class ZPush {
$loaded = false; $loaded = false;
foreach (self::$autoloadBackendPreference as $autoloadBackend) { foreach (self::$autoloadBackendPreference as $autoloadBackend) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZPush::GetBackend(): trying autoload backend '%s'", $autoloadBackend)); ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZPush::GetBackend(): trying autoload backend '%s'", $autoloadBackend));
$loaded = self::IncludeBackend($autoloadBackend); $loaded = class_exists($autoloadBackend) || self::IncludeBackend($autoloadBackend);
if ($loaded) { if ($loaded) {
$ourBackend = $autoloadBackend; $ourBackend = $autoloadBackend;
break; break;
...@@ -494,7 +494,7 @@ class ZPush { ...@@ -494,7 +494,7 @@ class ZPush {
if (!$ourBackend || !$loaded) if (!$ourBackend || !$loaded)
throw new FatalMisconfigurationException("No Backend provider can not be loaded. Check your installation and configuration!"); throw new FatalMisconfigurationException("No Backend provider can not be loaded. Check your installation and configuration!");
} }
else elseif (!class_exists($ourBackend))
self::IncludeBackend($ourBackend); self::IncludeBackend($ourBackend);
if (class_exists($ourBackend)) if (class_exists($ourBackend))
......
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