You are here

function shrinktheweb_cacheFileExpired in ShrinkTheWeb 7

Same name and namespace in other branches
  1. 8 shrinktheweb.api.inc \shrinktheweb_cacheFileExpired()
  2. 6 shrinktheweb.api.inc \shrinktheweb_cacheFileExpired()

Determine if specified file has expired from the cache

1 call to shrinktheweb_cacheFileExpired()
shrinktheweb_getCachedThumbnail in ./shrinktheweb.api.inc
Get a thumbnail, caching it first if possible

File

./shrinktheweb.api.inc, line 574

Code

function shrinktheweb_cacheFileExpired($sFile) {

  // Use setting to check age of files.
  $iCacheDays = CACHE_DAYS + 0;

  // dont update image once it is cached
  if ($iCacheDays == 0 && file_exists($sFile)) {
    return false;

    // check age of file and if file exists return false, otherwise recache the file
  }
  else {
    $iCutoff = time() - 3600 * 24 * $iCacheDays;
    return !file_exists($sFile) || filemtime($sFile) <= $iCutoff;
  }
}