You are here

function ultimate_cron_enable in Ultimate Cron 7.2

Same name and namespace in other branches
  1. 8 ultimate_cron.install \ultimate_cron_enable()
  2. 6 ultimate_cron.install \ultimate_cron_enable()
  3. 7 ultimate_cron.install \ultimate_cron_enable()

Implements hook_enable().

File

./ultimate_cron.install, line 232
Installation file for Ultimate Cron.

Code

function ultimate_cron_enable() {

  // If Drupal's poormanscron settings are manually disabled, we want to disable
  // Ultimate Cron's poormanscron implementation when we enable the module.
  $cron_safe_threshold = db_query("SELECT value FROM {variable} WHERE name = 'cron_safe_threshold'")
    ->fetchField();
  $cron_safe_threshold = $cron_safe_threshold ? unserialize($cron_safe_threshold) : 0;
  if ($cron_safe_threshold === 0) {
    $poorman_settings = array(
      'launcher' => '',
      'early_page_flush' => 1,
      'user_agent' => 'Ultimate Cron',
    );
    variable_set('ultimate_cron_plugin_settings_poorman_settings', $poorman_settings);
  }

  // Disable built-in poor mans cron.
  variable_set('cron_safe_threshold', 0);
}