aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoktornotor <notordoktor@gmail.com>2015-09-05 14:26:57 +0200
committerdoktornotor <notordoktor@gmail.com>2015-09-05 14:26:57 +0200
commit1a88ac37159c046c7ca5c396ff3121577916b68f (patch)
treeba11835a9e00d5362735ebc491b36ea2f7b01f7b
parent46d4da44f8da4cca4eee0e91382c8d2157d8afb1 (diff)
downloadpfsense-packages-1a88ac37159c046c7ca5c396ff3121577916b68f.tar.gz
pfsense-packages-1a88ac37159c046c7ca5c396ff3121577916b68f.tar.bz2
pfsense-packages-1a88ac37159c046c7ca5c396ff3121577916b68f.zip
squidGuard - use install_cron_job() instead of reimplementing it
-rw-r--r--config/squidGuard/squidguard_configurator.inc62
1 files changed, 4 insertions, 58 deletions
diff --git a/config/squidGuard/squidguard_configurator.inc b/config/squidGuard/squidguard_configurator.inc
index 99907451..50835610 100644
--- a/config/squidGuard/squidguard_configurator.inc
+++ b/config/squidGuard/squidguard_configurator.inc
@@ -1968,65 +1968,11 @@ function squidguard_cron_install()
global $squidguard_config;
$on_off = $squidguard_config[F_LOGROTATION] == 'on';
-
- $opt = "";
+ $cron_cmd = "/usr/bin/nice -n20 " . SQUIDGUARD_SCR_LOGROTATE;
if ($on_off) {
- $opt = array("0", "0", "*", "*", "*", "root", "/usr/bin/nice -n20 " . SQUIDGUARD_SCR_LOGROTATE);
- }
- squidguard_setup_cron("squidGuard_logrotate", $opt, $on_off);
-}
-
-# ------------------------------------------------------------------------------
-# squidguard_setup_cron
-# ------------------------------------------------------------------------------
-# $options: [0]='minute', [1]='hour', [2]='mday', [3]='month', [4]='wday', [5]='who', [6]='command'
-# ------------------------------------------------------------------------------
-function squidguard_setup_cron($task_key, $options, $on_off)
-{
- global $config;
- $cron_item = array();
-
- # $on_off = TRUE/FALSE - install/deinstall cron task:
- # prepare new cron item
- if (is_array($options)) {
- $cron_item['minute'] = $options[0];
- $cron_item['hour'] = $options[1];
- $cron_item['mday'] = $options[2];
- $cron_item['month'] = $options[3];
- $cron_item['wday'] = $options[4];
- $cron_item['who'] = ($options[5]) ? $options[5] : 'nobody';
- $cron_item['command'] = $options[6];
- }
-
- # unset old cron task with $task_key
- if (!empty($task_key)) {
- $flag_cron_upd = false;
- # delete old cron task if exists
- if (is_array($config['cron']['item'])) {
- foreach($config['cron']['item'] as $key => $val) {
- if (strpos($config['cron']['item'][$key]['command'], $task_key) !== false) {
- unset($config['cron']['item'][$key]);
- $flag_cron_upd = true;
- break;
- }
- }
- }
-
- # set new cron task
- if (($on_off === true) and !empty($cron_item)) {
- $config['cron']['item'][] = $cron_item;
- $flag_cron_upd = true;
- }
-
- # write config and configure cron only if cron task modified
- if ($flag_cron_upd === true) {
- write_config("Installed cron task '$task_key' for 'squidGuard' package");
- configure_cron();
- }
- }
- else {
- # ! error $name !
- return;
+ install_cron_job("{$cron_cmd}", true, "0", "0", "*", "*", "*", "root");
+ } else {
+ install_cron_job("{$cron_cmd}", false);
}
}