summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2014-12-29 20:16:28 +0545
committerPhil Davis <phil.davis@inf.org>2014-12-29 20:16:28 +0545
commitaff83787a3c7b24a342b3d7ce720887b30072865 (patch)
tree911f37aa3cee4d6c26110a6b1f3d51d9575702d9
parent994a064416579453452054e1fee17268bbb74ab2 (diff)
downloadpfsense-aff83787a3c7b24a342b3d7ce720887b30072865.zip
pfsense-aff83787a3c7b24a342b3d7ce720887b30072865.tar.gz
Simplify cron array comparison
This works fine - I had not thought about how arrays are compared. Using "==" checks that the key/value pairs match in both arrays, regardless of the order the arrays happen to be in, which is what we want here. Using "===" would insist that the key/value pairs are also in the same order in the array and that the types and everything match identically, which we do not require.
-rw-r--r--etc/inc/services.inc8
1 files changed, 1 insertions, 7 deletions
diff --git a/etc/inc/services.inc b/etc/inc/services.inc
index aaa90bd..194b4f3 100644
--- a/etc/inc/services.inc
+++ b/etc/inc/services.inc
@@ -2392,13 +2392,7 @@ function install_cron_job($command, $active=false, $minute="0", $hour="*", $mont
$config['cron']['item'][] = $cron_item;
write_config(sprintf(gettext("Installed cron job for %s"), $command));
} else {
- if (($config['cron']['item'][$x]['minute'] == $cron_item['minute']) &&
- ($config['cron']['item'][$x]['hour'] == $cron_item['hour']) &&
- ($config['cron']['item'][$x]['mday'] == $cron_item['mday']) &&
- ($config['cron']['item'][$x]['month'] == $cron_item['month']) &&
- ($config['cron']['item'][$x]['wday'] == $cron_item['wday']) &&
- ($config['cron']['item'][$x]['who'] == $cron_item['who']) &&
- ($config['cron']['item'][$x]['command'] == $cron_item['command'])) {
+ if ($config['cron']['item'][$x] == $cron_item) {
$cron_changed = false;
log_error(sprintf(gettext("Checked cron job for %s, no change needed"), $command));
} else {
OpenPOWER on IntegriCloud