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

Implements hook_cron().

This will be ran once a day at most.

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

File

./advagg.module, line 962

Code

function advagg_cron($bypass_time_check = FALSE) {
    // @param bool $bypass_time_check
    // Set to TRUE to skip the 24 hour check.
    //
    // Execute once a day (24 hours).
    if (!$bypass_time_check && variable_get('advagg_cron_timestamp', 0) > REQUEST_TIME - variable_get('advagg_cron_frequency', ADVAGG_CRON_FREQUENCY)) {
        return array();
    }
    variable_set('advagg_cron_timestamp', REQUEST_TIME);
    // Flush the cache_advagg_info cache bin.
    cache_clear_all(NULL, 'cache_advagg_info');
    $return = array();
    // Clear out all stale advagg aggregated files.
    module_load_include('inc', 'advagg', 'advagg.cache');
    $return[] = advagg_delete_stale_aggregates();
    // Delete all empty aggregated files.
    $return[] = advagg_delete_empty_aggregates();
    // Delete orphaned aggregates.
    $return[] = advagg_delete_orphaned_aggregates();
    // Remove aggregates that include missing files.
    $return[] = advagg_remove_missing_files_from_db();
    // Remove unused aggregates.
    $return[] = advagg_remove_old_unused_aggregates();
    // Remove expired locks from the semaphore database table.
    $return[] = advagg_cleanup_semaphore_table();
    // Remove old temp files.
    $return[] = advagg_remove_temp_files();
    // Refresh all locale files.
    $return[] = advagg_refresh_all_locale_files();
    // Update libraries data.
    advagg_get_remote_libraries_versions(TRUE);
    return $return;
}