Skip to content

Commit

Permalink
Fix. Update cron on save settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandergull committed Mar 22, 2024
1 parent b662cfd commit 47d17e6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions uniforce/inc/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 47d17e6

Please sign in to comment.