Given a filename hash get back all aggregates that include it.

Paramètres

string $filename_hash: Hash of the filename.

bool $cid_only: Set to TRUE to only have cache ids returned.

Return value

array Array of aggregates that use this file.

3 calls to advagg_get_aggregates_using_file()
advagg_admin_clear_file_aggregates dans ./advagg.admin.inc
Remove the aggregates that contain the given filename.
advagg_push_new_changes dans ./advagg.cache.inc
Flush the correct caches so CSS/JS changes go live.
advagg_remove_missing_files_from_db dans ./advagg.cache.inc
Scan for missing files and remove the associated entries in the database.

Fichier

./advagg.cache.inc, line 186

Code

function advagg_get_aggregates_using_file($filename_hash, $cid_only = FALSE) {
    // Create main query for the advagg_aggregates table.
    $query = db_select('advagg_aggregates', 'aa')->condition('aa.filename_hash', $filename_hash);
    // Create join query for the advagg_aggregates_versions table.
    $query->join('advagg_aggregates_versions', 'aav', 'aa.aggregate_filenames_hash = aav.aggregate_filenames_hash AND aav.atime > 0');
    $query = $query->fields('aav', array(
        'aggregate_filenames_hash',
        'aggregate_contents_hash',
    ));
    $query->comment('Query called from ' . __FUNCTION__ . '()');
    $results = $query->execute();
    // Put results into $aggregates array.
    $aggregates = array();
    foreach ($results as $row) {
        $row = (array) $row;
        $cid = 'advagg:db:' . $row['aggregate_filenames_hash'] . ADVAGG_SPACE . $row['aggregate_contents_hash'];
        if ($cid_only) {
            $aggregates[] = $cid;
        }
        else {
            $row['cid'] = $cid;
            $aggregates[] = $row;
        }
    }
    return $aggregates;
}