Commit 4bb44ac9 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #416 in ZP/z-push from bugfix/ZP-1094-remove-the-use-of-spl-autoload to develop

* commit '06b09cbc':
  ZP-1094 Remove the use of spl_autoload for backend inclusion. Released under the Affero GNU General Public License (AGPL) version 3.
parents 09abc22a 06b09cbc
...@@ -564,7 +564,6 @@ class ZPush { ...@@ -564,7 +564,6 @@ class ZPush {
static public function GetBackend() { static public function GetBackend() {
// if the backend is not yet loaded, load backend drivers and instantiate it // if the backend is not yet loaded, load backend drivers and instantiate it
if (!isset(ZPush::$backend)) { if (!isset(ZPush::$backend)) {
$isIbar = false;
// Initialize our backend // Initialize our backend
$ourBackend = @constant('BACKEND_PROVIDER'); $ourBackend = @constant('BACKEND_PROVIDER');
...@@ -582,20 +581,13 @@ class ZPush { ...@@ -582,20 +581,13 @@ class ZPush {
throw new FatalMisconfigurationException("No Backend provider can be found. Check your installation and/or configuration!"); throw new FatalMisconfigurationException("No Backend provider can be found. Check your installation and/or configuration!");
} }
elseif (!class_exists($ourBackend)) { elseif (!class_exists($ourBackend)) {
spl_autoload_register('\ZPush::IncludeBackend'); \ZPush::IncludeBackend($ourBackend);
$isIbar = true;
ZLog::Write(LOGLEVEL_DEBUG, "ZPush::GetBackend(): autoload register ZPush::IncludeBackend");
} }
if (class_exists($ourBackend)) if (class_exists($ourBackend))
ZPush::$backend = new $ourBackend(); ZPush::$backend = new $ourBackend();
else else
throw new FatalMisconfigurationException(sprintf("Backend provider '%s' can not be loaded. Check configuration!", $ourBackend)); throw new FatalMisconfigurationException(sprintf("Backend provider '%s' can not be loaded. Check configuration!", $ourBackend));
if ($isIbar) {
spl_autoload_unregister('\ZPush::IncludeBackend');
ZLog::Write(LOGLEVEL_DEBUG, "ZPush::GetBackend(): autoload unregister ZPush::IncludeBackend");
}
} }
return ZPush::$backend; return ZPush::$backend;
} }
......
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