From b0b28f0eaef2e5babf75bf29da356a130a1ee2e1 Mon Sep 17 00:00:00 2001 From: Adam Bramley Date: Wed, 21 Aug 2013 09:02:11 +1200 Subject: [PATCH] Issue #1706232 by acbramley: Adds ability to disable lightweight cron watchdog activation messages. --- scheduler.install | 1 + scheduler.module | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/scheduler.install b/scheduler.install index 6462e60..69fc757 100644 --- a/scheduler.install +++ b/scheduler.install @@ -51,6 +51,7 @@ function scheduler_uninstall() { 'scheduler_date_format', 'scheduler_field_type', 'scheduler_extra_info', + 'scheduler_lightweight_log', ); $types = node_type_get_types(); diff --git a/scheduler.module b/scheduler.module index 6ad0013..1357a9e 100644 --- a/scheduler.module +++ b/scheduler.module @@ -906,7 +906,10 @@ function scheduler_theme() { } function _scheduler_run_cron() { - watchdog('scheduler', 'Lightweight cron run activated', array(), WATCHDOG_NOTICE); + $log = variable_get('scheduler_lightweight_log', 1); + if ($log) { + watchdog('scheduler', 'Lightweight cron run activated', array(), WATCHDOG_NOTICE); + } scheduler_cron(); if (ob_get_level() > 0) { $handlers = ob_list_handlers(); @@ -914,7 +917,9 @@ function _scheduler_run_cron() { ob_clean(); } } - watchdog('scheduler', 'Lightweight cron run completed', array(), WATCHDOG_NOTICE, l('settings', 'admin/config/content/scheduler')); + if ($log) { + watchdog('scheduler', 'Lightweight cron run completed', array(), WATCHDOG_NOTICE, l('settings', 'admin/config/content/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')))); @@ -936,7 +941,18 @@ function _scheduler_lightweight_cron() { '#submit' => array('_scheduler_run_cron'), '#suffix' => "\n", ); - return $form; + $form['scheduler_cron_settings'] = array( + '#type' => 'fieldset', + '#title' => t('Lightweight cron settings'), + ); + $form['scheduler_cron_settings']['scheduler_lightweight_log'] = array( + '#type' => 'checkbox', + '#title' => t('Log every activation and completion message.'), + '#default_value' => variable_get('scheduler_lightweight_log', 1), + '#description' => t("When this option is checked, Scheduler will write an entry to the dblog every time the lightweight cron process is started and completed. This is useful during set up and testing, but can result in a large number of log entries. Any actions performed during the lightweight cron run will always be logged regardless of this setting."), + ); + + return system_settings_form($form); } /** -- 1.7.9.5