ZP-1094 Remove the use of spl_autoload for backend inclusion. Released under...

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