Example #1
0
 public static function onDestroy()
 {
     if (!Runtime::hasLock("auth")) {
         Runtime::removeLock("session");
     } else {
         Runtime::addLockCallback("auth", [get_called_class(), "onDestroy"]);
     }
 }
Example #2
0
 public function write(string $data) : bool
 {
     $status = Cache::setRaw($this->mSessId, $data, time() + $this->mMaxLifeTime);
     /*
      * Allow cache to lift it's own locks
      */
     Runtime::removeLock("cache");
     return $status;
 }
Example #3
0
 public static function onDestroy()
 {
     if (Runtime::$SETTINGS->getString("CACHE_DRIVER") == "database") {
         if (!Runtime::hasLock("cache")) {
             Runtime::removeLock("database");
         } else {
             Runtime::addLockCallback("cache", [get_called_class(), "onDestroy"]);
         }
     }
 }
Example #4
0
 public function write(string $data) : bool
 {
     $status = false;
     if (Database::isConnected()) {
         $time = time();
         if ($this->mUpdate) {
             $status = Database::update("sessions")->field("cData", "s", $data)->field("cTime", "i", time())->cond("cSessId", "s", $this->mSessId)->execute() > 0;
         } else {
             $status = Database::insert("sessions")->field("cData", "s", $data)->field("cTime", "i", time())->field("cSessId", "s", $this->mSessId)->execute() > 0;
         }
     }
     Runtime::removeLock("database");
     return $status;
 }
Example #5
0
 public static function onDestroy()
 {
     if (!Runtime::$SETTINGS->getBoolean("FILE_IMPORT_DISABLE_AUTOINCLUDE")) {
         $controller = Router::getController();
         if ($controller !== null) {
             foreach (static::$mImportedStyle as $style) {
                 $controller->imAddImport(Path::fileLink($style), "importStyle");
             }
             foreach (static::$mImportedScript as $script) {
                 $controller->imAddImport(Path::fileLink($script), "importScript");
             }
         }
         Runtime::removeLock("router");
     }
 }