Same name and namespace in other branches
  1. 5.0.x advagg.module \advagg_cron() 1 commentaire
  2. 6.0.x advagg.module \advagg_cron() 1 commentaire
  3. 7.x-1.x advagg.module \advagg_cron() 1 commentaire
  4. 7.x-2.x advagg.module \advagg_cron() 1 commentaire
  5. 8.x-3.x advagg.module \advagg_cron() 1 commentaire
  6. 8.x-4.x advagg.module \advagg_cron() 1 commentaire

Implements hook_cron().

This will be ran once a day at most.

Paramètres

bool $bypass_time_check: Set to TRUE to skip the 24 hour check.

1 call to advagg_cron()
drush_advagg_cron dans ./advagg.drush.inc
Callback function for drush advagg-cron.

Fichier

./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;
}