You are here

function disqus_migrate_cron in Disqus 6

Implementation of hook_cron

File

./disqus_migrate.module, line 74

Code

function disqus_migrate_cron() {
  if (variable_get('disqus_migrate_sync_enabled', 0) == 0) {
    return;
  }
  $last_run = variable_get('disqus_migrate_last_sync', 0);
  $interval = variable_get('disqus_migrate_sync_interval', 0);

  // How much time elapsed since the last run?
  $time_elapsed = time() - $last_run;

  // Not enough?
  if ($time_elapsed < $interval) {
    return;

    // Don't run the interval
  }

  // Run sync
  module_load_include('inc', 'disqus_migrate', 'include/disqus_migrate.import');
  $last_synced_time = _disqus_migrate_last_synced_time();
  _disqus_migrate_import($last_synced_time + 1);

  // Update our last sync time
  variable_set('disqus_migrate_last_sync', time());
}