You are here

function advagg_cron in Advanced CSS/JS Aggregation 7.2

Same name and namespace in other branches
  1. 8.4 advagg.module \advagg_cron()
  2. 8.2 advagg.module \advagg_cron()
  3. 8.3 advagg.module \advagg_cron()
  4. 6 advagg.module \advagg_cron()
  5. 7 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 961
Advanced CSS/JS aggregation module.

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