Same name and namespace in other branches
  1. 7.x-1.x includes/admin.inc \advagg_admin_flush_cache_button() 1 commentaire

Perform a smart flush.

Sujets associés

2 calls to advagg_admin_flush_cache_button()
advagg_admin_flush_cache dans ./advagg.module
Cache clear callback for admin_menu/flush-cache/advagg.
advagg_admin_reset_mtime dans ./advagg.admin.inc
Clear out all advagg cache bins and increment the counter.
1 string reference to 'advagg_admin_flush_cache_button'
advagg_admin_operations_form dans ./advagg.admin.inc
Form builder; Do advagg operations.

Fichier

./advagg.admin.inc, line 1581

Code

function advagg_admin_flush_cache_button() {
    // Clear the libraries cache.
    if (function_exists('libraries_flush_caches')) {
        $cache_tables = libraries_flush_caches();
        foreach ($cache_tables as $table) {
            cache_clear_all('*', $table, TRUE);
        }
    }
    // Run the command.
    module_load_include('inc', 'advagg', 'advagg.cache');
    $flushed = advagg_push_new_changes();
    if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) >= 0) {
        // Display a simple message if not in Development mode.
        drupal_set_message(t('Advagg Cache Cleared'));
    }
    else {
        list($css_path) = advagg_get_root_files_dir();
        $parts_uri = $css_path[1] . '/parts';
        // Report back the results.
        foreach ($flushed as $filename => $data) {
            if (strpos($filename, $parts_uri) === 0) {
                // Do not report on css files manged in the parts directory.
                unset($flushed[$filename]);
                continue;
            }
            $ext = pathinfo($filename, PATHINFO_EXTENSION);
            drupal_set_message(t('The file %filename has changed. %db_usage aggregates are using this file. %db_count db cache entries and all %type full cache entries have been flushed from the cache bins. Trigger: <code>@changes</code>', array(
                '%filename' => $filename,
                '%db_usage' => $data[0],
                '%db_count' => $data[1],
                '@changes' => print_r($data[2], TRUE),
                '%type' => $ext,
            )));
        }
        if (empty($flushed)) {
            drupal_set_message(t('No changes found. Nothing was cleared.'));
            return;
        }
    }
}