Read the atime value for the given aggregate.

Paramètres

string $aggregate_filenames_hash: Hash of the groupings of files.

string $aggregate_contents_hash: Hash of the files contents.

string $uri: URI pointing to the aggregate file.

Return value

mixed File atime or FALSE if not found.

2 calls to advagg_get_atime()
advagg_admin_get_file_info dans ./advagg.admin.inc
Get detailed info about the given filename.
advagg_delete_files_if_stale dans ./advagg.cache.inc
Given an array of files remove that file if atime is grater than 30 days.

Fichier

./advagg.missing.inc, line 1512

Code

function advagg_get_atime($aggregate_filenames_hash, $aggregate_contents_hash, $uri) {
    // Try to use the cache to avoid hitting the database with a select query.
    $cache_id = 'advagg:db:' . $aggregate_filenames_hash . ADVAGG_SPACE . $aggregate_contents_hash;
    $cache = cache_get($cache_id, 'cache_advagg_info');
    if ($cache) {
        // If the atime in the cache is less than 12 hours old, use that.
        if (!empty($cache->data['atime']) && $cache->data['atime'] > REQUEST_TIME - 12 * 60 * 60) {
            return $cache->data['atime'];
        }
    }
    // Try to get the atime from the DB.
    $atime = db_select('advagg_aggregates_versions', 'aav')->fields('aav', array(
        'atime',
    ))
        ->condition('aav.aggregate_filenames_hash', $aggregate_filenames_hash)
        ->condition('aav.aggregate_contents_hash', $aggregate_contents_hash)
        ->execute()
        ->fetchField();
    if (!empty($atime)) {
        return $atime;
    }
    // Return the atime from disk as a last resort.
    if (file_exists($uri)) {
        return fileatime($uri);
    }
    // No atime was found, return FALSE.
    return FALSE;
}