You are here

public function AdvaggCommands::cron in Advanced CSS/JS Aggregation 8.3

Same name and namespace in other branches
  1. 8.4 src/Commands/AdvaggCommands.php \Drupal\advagg\Commands\AdvaggCommands::cron()

Run the advagg cron hook.

@command advagg-cron @usage Standard example drush advagg-cron @aliases advagg-c

File

src/Commands/AdvaggCommands.php, line 61

Class

AdvaggCommands
Advagg commands for Drush 9+.

Namespace

Drupal\advagg\Commands

Code

public function cron() {

  // Run AdvAgg cron job.
  $output = advagg_cron(TRUE);
  if (!empty($output['css']) || !empty($output['js'])) {
    $this
      ->logger()
      ->notice(dt('All stale aggregates have been deleted. %css_count CSS files and %js_count JS files have been removed.', [
      '%css_count' => count($output['css']),
      '%js_count' => count($output['js']),
    ]));
  }
  else {
    $this
      ->logger()
      ->notice(dt('No stale aggregates found. Nothing was deleted.'));
  }
}