You are here

function drush_advagg_cron in Advanced CSS/JS Aggregation 8.2

Same name and namespace in other branches
  1. 8.4 advagg.drush.inc \drush_advagg_cron()
  2. 8.3 advagg.drush.inc \drush_advagg_cron()
  3. 7.2 advagg.drush.inc \drush_advagg_cron()

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.

File

./advagg.drush.inc, line 129
Drush commands for Advanced CSS/JS Aggregation.

Code

function drush_advagg_cron() {

  // Run AdvAgg cron job.
  $output = advagg_cron(TRUE);

  // Output results from running AssetCollectionOptimizer::deleteStale().
  list($css_files, $js_files) = $output['stale'];
  if (!empty($css_files) || !empty($js_files)) {
    drush_log(dt('All stale aggregates have been deleted. %css_count CSS files and %js_count JS files have been removed.', [
      '%css_count' => count($css_files),
      '%js_count' => count($js_files),
    ]), 'ok');
  }
  else {
    drush_log(dt('No stale aggregates found. Nothing was deleted.'), 'ok');
  }
}