Esempio n. 1
0
 /**
  * Returns the Backend for this request
  * the backend has to be an IBackend implementation
  *
  * @access public
  * @return object     IBackend implementation
  */
 public static function GetBackend()
 {
     // if the backend is not yet loaded, load backend drivers and instantiate it
     if (!isset(ZPush::$backend)) {
         // Initialize our backend
         $ourBackend = @constant('BACKEND_PROVIDER');
         // if no backend provider is defined, try to include automatically
         if ($ourBackend == false || $ourBackend == "") {
             $loaded = false;
             foreach (self::$autoloadBackendPreference as $autoloadBackend) {
                 ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZPush::GetBackend(): trying autoload backend '%s'", $autoloadBackend));
                 $loaded = self::IncludeBackend($autoloadBackend);
                 if ($loaded) {
                     $ourBackend = $autoloadBackend;
                     break;
                 }
             }
             if (!$ourBackend || !$loaded) {
                 throw new FatalMisconfigurationException("No Backend provider can not be loaded. Check your installation and configuration!");
             }
         } else {
             self::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));
         }
     }
     return ZPush::$backend;
 }
Esempio n. 2
0
 /**
  * Returns the Backend for this request
  * the backend has to be an IBackend implementation
  *
  * @access public
  * @return object     IBackend implementation
  */
 public static function GetBackend()
 {
     // if the backend is not yet loaded, load backend drivers and instantiate it
     if (!isset(ZPush::$backend)) {
         // Initialize our backend
         $ourBackend = @constant('BACKEND_PROVIDER');
         self::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));
         }
     }
     return ZPush::$backend;
 }