Same name in other branches
- 5.0.x advagg.module \advagg_cron()
- 6.0.x advagg.module \advagg_cron()
- 7.x-1.x advagg.module \advagg_cron()
- 7.x-2.x advagg.module \advagg_cron()
- 8.x-3.x advagg.module \advagg_cron()
- 8.x-4.x advagg.module \advagg_cron()
Implements hook_cron().
This will be ran once a day at most.
Parameters
bool $bypass_time_check: Set to TRUE to skip the 24 hour check.
1 call to advagg_cron()
- drush_advagg_cron in ./
advagg.drush.inc - Callback function for drush advagg-cron.
File
-
./
advagg.module, line 98
Code
function advagg_cron($bypass_time_check = FALSE) {
$state = \Drupal::state();
// Execute once a day (24 hours).
if (!$bypass_time_check && $state->get('advagg.cron_timestamp', REQUEST_TIME) > REQUEST_TIME - \Drupal::config('advagg.settings')->get('cron_frequency')) {
return [];
}
$state->set('advagg.cron_timestamp', REQUEST_TIME);
$return = [];
$return['stale'] = [
'js' => \Drupal::service('asset.js.collection_optimizer')->deleteStale(),
'css' => \Drupal::service('asset.css.collection_optimizer')->deleteStale(),
];
return $return;
}