Same name and namespace in other branches
  1. 5.0.x advagg.drush.inc \drush_advagg_cron() 1 commentaire
  2. 6.0.x advagg.drush.inc \drush_advagg_cron() 1 commentaire
  3. 8.x-2.x advagg.drush.inc \drush_advagg_cron() 1 commentaire
  4. 8.x-3.x advagg.drush.inc \drush_advagg_cron() 1 commentaire
  5. 8.x-4.x advagg.drush.inc \drush_advagg_cron() 1 commentaire

Callback function for drush advagg-cron.

Callback is called by using drush_hook_command() where hook is the name of the module (advagg) and command is the name of the Drush command with all "-" characters converted to "_" characters.

Fichier

./advagg.drush.inc, line 142

Code

function drush_advagg_cron() {
    // Run AdvAgg cron job.
    $output = advagg_cron(TRUE);
    // Output results from running advagg_delete_stale_aggregates().
    list($css_files, $js_files) = $output[0];
    if (count($css_files) > 0 || count($js_files) > 0) {
        drush_log(dt('All stale aggregates have been deleted. @css_count CSS files and @js_count JS files have been removed.', array(
            '@css_count' => count($css_files),
            '@js_count' => count($js_files),
        )), 'ok');
    }
    else {
        drush_log(dt('No stale aggregates found. Nothing was deleted.'), 'ok');
    }
    // Output results from running advagg_delete_orphaned_aggregates().
    if (empty($output[1][0]) && empty($output[1][1])) {
        drush_log(dt('All files have an associated db record; nothing was deleted.'), 'ok');
    }
    else {
        drush_log(dt('Some files had no associated db record and could be safely deleted from the file system. @raw', array(
            '@raw' => print_r($output[1], TRUE),
        )), 'ok');
    }
    // Output results from running advagg_remove_missing_files_from_db().
    if (empty($output[2])) {
        drupal_set_message(dt('All source files where found, no database entries where pruned.'), 'ok');
    }
    else {
        // format_plural() not always available.
        drupal_set_message(dt('Some source files are missing and as a result some unused aggregates were found. A total of @count database entries were removed.', array(
            '@count' => count($output[2]),
        )), 'ok');
    }
    // Output results from running advagg_remove_old_unused_aggregates().
    if (empty($output[3])) {
        drupal_set_message(dt('No old and unused aggregates found. Nothing was deleted.'), 'ok');
    }
    else {
        // format_plural() not always available.
        drupal_set_message(dt('Some old and unused aggregates were found. A total of @count database entries were removed.', array(
            '@count' => $output[3],
        )), 'ok');
    }
    // Output results from running advagg_cleanup_semaphore_table().
    if (empty($output[4])) {
        drupal_set_message(dt('No old semaphore locks found.'), 'ok');
    }
    else {
        // format_plural() not always available.
        drupal_set_message(dt('A total of @count old semaphore entries were removed.', array(
            '@count' => count($output[4]),
        )), 'ok');
    }
    // Output results from running advagg_remove_temp_files().
    if (empty($output[5])) {
        drupal_set_message(dt('No leftover temporary files found. Nothing was deleted.'), 'ok');
    }
    else {
        // format_plural() not always available.
        drupal_set_message(dt('Some oleftover temporary files were found. A total of @count temporary files were removed.', array(
            '@count' => $output[5],
        )), 'ok');
    }
    // Output results from running advagg_refresh_all_locale_files().
    if (empty($output[6])) {
        drupal_set_message(dt('Locale did not translate anything in any JavaScript files.'), 'ok');
    }
    else {
        drupal_set_message(dt('Locale did translate some JavaScript files. Resulting locale js files: @files', array(
            '@files' => print_r($output[6], TRUE),
        )), 'ok');
    }
}