コード例 #1
0
ファイル: pwurple_class.php プロジェクト: Br3nda/pwurple
 /**
  * Check filemtimes to see if the cache should be updated
  *
  * @access private
  *
  */
 function _cacheIsValid()
 {
     // First of all check configuration. If autoupdate is set to false always
     // return true, otherwise check
     if (WURFL_CACHE_AUTOUPDATE === false) {
         return true;
     }
     // WURFL hasn't been loaded into memory, I'll do it now
     $pwurple_stat = filemtime(WURFL_FILE);
     if (defined('WURFL_PATCH_FILE') && file_exists(WURFL_PATCH_FILE)) {
         $patch_stat = filemtime(WURFL_PATCH_FILE);
         if ($patch_stat > $pwurple_stat) {
             // if the patch file is newer than the WURFL I set pwurple_stat to that time
             $pwurple_stat = $patch_stat;
         }
     }
     $cache_stat = stat_cache();
     if ($pwurple_stat <= $cache_stat) {
         return true;
     } else {
         $this->_toLog('_cacheIsValid', 'cache file is outdated', LOG_INFO);
         return false;
     }
 }
コード例 #2
0
        if (!@error_log($_textToLog . "\n", 3, WURFL_LOG_FILE)) {
            error_log("Unable to log to " . WURFL_LOG_FILE . " log_message:{$_textToLog}");
            // logging in the webserver's log file
        }
    } else {
        error_log($_textToLog);
        // logging in the webserver's log file
    }
}
if (!file_exists(WURFL_FILE)) {
    wurfl_log('main', WURFL_FILE . " does not exist");
    die(WURFL_FILE . " does not exist");
}
if (WURFL_AUTOLOAD === true) {
    $wurfl_stat = filemtime(WURFL_FILE);
    $cache_stat = stat_cache();
    if (defined('WURFL_PATCH_FILE') && file_exists(WURFL_PATCH_FILE)) {
        $patch_stat = filemtime(WURFL_PATCH_FILE);
    } else {
        $patch_stat = $wurfl_stat;
    }
    if (WURFL_USE_CACHE && $wurfl_stat <= $cache_stat && $patch_stat <= $cache_stat) {
        // cache file is updated
        //echo "wurfl date = ".$wurfl_stat."<br>\n";
        //echo "patch date = ".$patch_stat."<br>\n";
        //echo "cache date = ".$cache_stat."<br>\n";
        list($cache_stat, $wurfl, $wurfl_agents) = load_cache();
        // echo "cache loaded";
    } else {
        list($cache_stat, $wurfl, $wurfl_agents) = parse();
    }