Get the files that belong inside of this aggregate.

Paramètres

string $type: String: css or js.

string $aggregate_filenames_hash: Hash of the groupings of files.

string $aggregate_contents_hash: Hash of the files contents.

Return value

array List of files in the order they should be included.

3 calls to advagg_get_files_from_hashes()
advagg_admin_get_file_info dans ./advagg.admin.inc
Get detailed info about the given filename.
advagg_install_get_first_advagg_file dans ./advagg.install
Given a advagg path this will return the first aggregate it can find.
advagg_missing_create_file dans ./advagg.missing.inc
Given a filename create that file.

Fichier

./advagg.missing.inc, line 712

Code

function advagg_get_files_from_hashes($type, $aggregate_filenames_hash, $aggregate_contents_hash) {
    // Create main query for the advagg_aggregates_versions table.
    $query = db_select('advagg_aggregates_versions', 'aav')->condition('aav.aggregate_filenames_hash', $aggregate_filenames_hash)
        ->condition('aav.aggregate_contents_hash', $aggregate_contents_hash);
    // Create join query for the advagg_aggregates table.
    $subquery_aggregates = $query->join('advagg_aggregates', 'aa', 'aa.aggregate_filenames_hash =
    aav.aggregate_filenames_hash AND aa.aggregate_filenames_hash = :aggregate_filenames_hash', array(
        ':aggregate_filenames_hash' => $aggregate_filenames_hash,
    ));
    // Create join query for the advagg_files table.
    $query->join('advagg_files', 'af', 'af.filename_hash = aa.filename_hash AND
    af.filetype = :type AND af.filesize > 0', array(
        ':type' => $type,
    ));
    // Select fields and ordering of the query; add in query comment as well.
    $query = $query->fields('af', array(
        'filename',
    ))
        ->fields($subquery_aggregates, array(
        'settings',
    ))
        ->orderBy('porder', 'ASC');
    $query->comment('Query called from ' . __FUNCTION__ . '()');
    $results = $query->execute();
    // Add in files that are included in this aggregate.
    $files = array();
    foreach ($results as $value) {
        $files[$value->filename] = unserialize($value->settings);
    }
    // Try again with weak file verification.
    if (empty($files) && variable_get('advagg_weak_file_verification', ADVAGG_WEAK_FILE_VERIFICATION)) {
        if (variable_get('advagg_debug', ADVAGG_DEBUG) >= 2) {
            watchdog('advagg-debug', 'Filehash @filename of type @type has an aggregate_contents_hash variable; the 2rd hash is incorrect.', array(
                '@filename' => $aggregate_filenames_hash,
                '@type' => $type,
            ), WATCHDOG_DEBUG);
        }
        // Create main query for the advagg_aggregates_versions table.
        $query = db_select('advagg_aggregates_versions', 'aav')->condition('aav.aggregate_filenames_hash', $aggregate_filenames_hash);
        // Create join query for the advagg_aggregates table.
        $subquery_aggregates = $query->join('advagg_aggregates', 'aa', 'aa.aggregate_filenames_hash =
      aav.aggregate_filenames_hash AND aa.aggregate_filenames_hash = :aggregate_filenames_hash', array(
            ':aggregate_filenames_hash' => $aggregate_filenames_hash,
        ));
        // Create join query for the advagg_files table.
        $query->join('advagg_files', 'af', 'af.filename_hash = aa.filename_hash AND
      af.filetype = :type', array(
            ':type' => $type,
        ));
        // Select fields and ordering of the query; add in query comment as well.
        $query = $query->fields('af', array(
            'filename',
        ))
            ->fields($subquery_aggregates, array(
            'settings',
        ))
            ->orderBy('porder', 'ASC');
        $query->comment('Query called from ' . __FUNCTION__ . '()');
        $results = $query->execute();
        // Add in files that are included in this aggregate.
        $files = array();
        foreach ($results as $value) {
            $files[$value->filename] = unserialize($value->settings);
        }
    }
    return $files;
}