Insert/Update data in advagg tables.

Tables: advagg_files, advagg_aggregates, advagg_aggregates_versions.

Paramètres

array $files: List of files in the aggregate as well as the aggregate name.

string $type: String; css or js.

int $root: Is this a root aggregate.

Return value

bool Return TRUE if anything was written to the database.

1 call to advagg_insert_update_db()
advagg_build_aggregate_plans dans ./advagg.inc
Replacement for drupal_build_css_cache() and drupal_build_js_cache().

Fichier

./advagg.inc, line 25

Code

function advagg_insert_update_db(array $files, $type, $root) {
    // Record if a database write was done.
    $write_done = FALSE;
    // Loop through all files.
    foreach ($files as $values) {
        // Insert files into the advagg_files table if it doesn't exist.
        // Update if needed.
        if (advagg_insert_update_files($values['files'], $type)) {
            $write_done = TRUE;
        }
        // Insert aggregate into the advagg_aggregates table if it doesn't exist.
        if (advagg_insert_aggregate($values['files'], $values['aggregate_filenames_hash'])) {
            $write_done = TRUE;
        }
        // Insert aggregate version information into advagg_aggregates_versions.
        if (advagg_insert_aggregate_version($values['aggregate_filenames_hash'], $values['aggregate_contents_hash'], $root)) {
            $write_done = TRUE;
        }
    }
    return $write_done;
}