You are here

function shrinktheweb_cacheFileExpired in ShrinkTheWeb 8

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

Determine if specified file has expired from the cache.

Parameters

$sFile:

Return value

bool

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

File

./shrinktheweb.api.inc, line 788

Code

function shrinktheweb_cacheFileExpired($sFile) {

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

  // Don't 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 cache file again.
  }
  else {
    $iCutoff = time() - 3600 * 24 * $iCacheDays;
    return !file_exists($sFile) || filemtime($sFile) <= $iCutoff;
  }
}