From 3baa34ff0c4779458e15a53c1387688d548979a2 Mon Sep 17 00:00:00 2001 From: Adam Bramley Date: Tue, 2 Oct 2012 11:14:25 +1300 Subject: [PATCH] Issue #1706232 by osopolar: Adds admin setting for disabling internal cron watchdog messages. --- scheduler.module | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/scheduler.module b/scheduler.module index 48b22d1..d24047b 100644 --- a/scheduler.module +++ b/scheduler.module @@ -151,6 +151,12 @@ function scheduler_admin() { ), '#description' => t("If the Date module's Date Popup module is enabled you may use the popup calendar for your field type."), ); + $form['scheduler_watchdog_log'] = array( + '#type' => 'checkbox', + '#title' => t('Log internal cron watchdog messages'), + '#default_value' => variable_get('scheduler_watchdog_log', 1), + '#description' => t("Uncheck this to disable the internal cron job logging messages to watchdog."), + ); if (!module_exists('date_popup')) { $form['scheduler_field_type']['#default_value'] = 'textfield'; @@ -860,7 +866,10 @@ function scheduler_theme() { } function _scheduler_run_cron() { - watchdog('scheduler', 'Internal scheduler cron run activated', array(), WATCHDOG_NOTICE); + $log = variable_get('scheduler_watchdog_log', 1); + if ($log) { + watchdog('scheduler', 'Internal scheduler cron run activated', array(), WATCHDOG_NOTICE); + } scheduler_cron(); if (ob_get_level() > 0) { $handlers = ob_list_handlers(); @@ -868,7 +877,9 @@ function _scheduler_run_cron() { ob_clean(); } } - watchdog('scheduler', 'Internal scheduler cron run completed', array(), WATCHDOG_NOTICE, l('settings', 'admin/settings/scheduler')); + if ($log) { + watchdog('scheduler', 'Internal scheduler cron run completed', array(), WATCHDOG_NOTICE, l('settings', 'admin/settings/scheduler')); + } // This message is only seen when the lightweight cron is tested interactively. drupal_set_message(t("Scheduler's lightweight cron completed. See !log for details.", array('!log' => l('admin/reports/dblog', 'admin/reports/dblog')))); -- 1.7.0.4