Пример #1
0
 private function getInstallStatus()
 {
     if (!$this->asInstallStatus) {
         $asStatus = AnwUtils::getFileSerializedObject(ANWIKI_INSTALL_STATUS);
         if (!is_array($asStatus)) {
             throw new AnwUnexpectedException();
         }
         $this->asInstallStatus = $asStatus;
     }
     return $this->asInstallStatus;
 }
Пример #2
0
 protected static function getCachedObject($sCacheFile, $nDelayExpiry = self::EXPIRY_UNLIMITED)
 {
     if (!file_exists($sCacheFile)) {
         self::debug("cache NOT found : " . $sCacheFile);
         throw new AnwCacheNotFoundException();
     }
     try {
         //check delay if expiry time given
         if ($nDelayExpiry != self::EXPIRY_UNLIMITED) {
             $nElapsedTime = time() - filemtime($sCacheFile);
             if ($nElapsedTime > $nDelayExpiry) {
                 //cache expired
                 self::debug("cache (" . $nDelayExpiry . "s) expired : " . $sCacheFile);
                 throw new AnwCacheNotFoundException();
             } else {
                 self::debug("cache (" . $nDelayExpiry . "s) is valid, will expire in " . ($nDelayExpiry - $nElapsedTime) . "s");
             }
         } else {
             self::debug("cache is immortal");
         }
         $oCachedObject = AnwUtils::getFileSerializedObject($sCacheFile);
         return $oCachedObject;
     } catch (AnwUnexpectedException $e) {
         throw new AnwCacheNotFoundException();
     }
 }