You are here

function javascript_libraries_cron in JavaScript Libraries Manager 7

Implements hook_cron().

1 call to javascript_libraries_cron()
javascript_libraries_flush_caches in ./javascript_libraries.module
Implements hook_flush_caches().

File

./javascript_libraries.module, line 154
Toggle the inclusion of Drupal system libraries. Upload and reference custom libraries as well.

Code

function javascript_libraries_cron() {

  // Force an update once per day.
  $last = variable_get('javascript_libraries_last_sync', 0);
  if (REQUEST_TIME > $last + 86400) {
    $custom = variable_get('javascript_libraries_custom_libraries', array());
    foreach ($custom as $library) {

      // Get/build local cached versions of external scripts.
      if ($library['type'] == 'external' && !empty($library['cache'])) {
        javascript_libraries_cache($library['uri'], TRUE);
      }
    }
    variable_set('javascript_libraries_last_sync', REQUEST_TIME);
  }
}