From 47d17e68715ba188824f3de71ad790cbaa2fd5fa Mon Sep 17 00:00:00 2001 From: alexandergull Date: Fri, 22 Mar 2024 13:47:17 +0500 Subject: [PATCH] Fix. Update cron on save settings. --- uniforce/inc/admin.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/uniforce/inc/admin.php b/uniforce/inc/admin.php index 96f4059..9a9803e 100644 --- a/uniforce/inc/admin.php +++ b/uniforce/inc/admin.php @@ -551,6 +551,15 @@ function usp_do_save_settings() { // Recognizing new key $new_key_is_set = $usp->settings->key !== $settings['key']; + + if( $settings['scanner_auto_start'] != $usp->settings->scanner_auto_start ) { + if ($settings['scanner_auto_start'] == 1) { + Cron::updateTask( 'scanner_launch', 'usp_scanner__launch', 86400, time() + 86400 ); + } else { + Cron::removeTask( 'scanner_launch'); + } + } + // Set values foreach ( $settings as $setting => $value) { $usp->settings->$setting = $value;