Given a advagg type this will return the most recent aggregate from the db.

Paramètres

string $type: String: css or js.

Return value

string Returns advagg filename or an empty string on failure.

2 calls to advagg_generate_advagg_filename_from_db()
advagg_get_relative_path dans ./advagg.module
Given a uri, get the relative_path.
advagg_install_get_first_advagg_file dans ./advagg.install
Given a advagg path this will return the first aggregate it can find.

Fichier

./advagg.module, line 6415

Code

function advagg_generate_advagg_filename_from_db($type) {
    // Get the most recently accessed file from the database.
    $query = db_select('advagg_aggregates_versions', 'aav');
    $query->join('advagg_aggregates', 'aa', 'aa.aggregate_filenames_hash =
    aav.aggregate_filenames_hash');
    $query->join('advagg_files', 'af', 'af.filename_hash = aa.filename_hash AND
    af.filetype = :type', array(
        ':type' => $type,
    ));
    $query = $query->fields('aav', array(
        'aggregate_filenames_hash',
        'aggregate_contents_hash',
    ))
        ->orderBy('atime', 'DESC')
        ->range(0, 1);
    $results = $query->execute();
    if (empty($results)) {
        return '';
    }
    $hooks_hash = advagg_get_current_hooks_hash();
    foreach ($results as $row) {
        return $type . ADVAGG_SPACE . $row->aggregate_filenames_hash . ADVAGG_SPACE . $row->aggregate_contents_hash . ADVAGG_SPACE . $hooks_hash . '.' . $type;
    }
}