The itsec_cron_test task is also a single event task which receives the scheduled execution time as an argument.
If the result of the most recent itsec cron test event is negative the plugin changes the internal settings ‘use_cron’ to false and ‘cron_status’ to 0.
Default Cron No Cron
-------- ----- --------
use_cron true true false
cron_status -1 1 0
(Where cron_status -1 is undetermined, 1 is available and 0 is unavailable).
And this is exactly what I see happening. So why ?
It turns out that in the itsec_cron_test callback the following code is executed:
// Disable cron if the user hasn't set the use cron constant to true.
if ( ( ! defined( 'ITSEC_USE_CRON' ) || ! ITSEC_USE_CRON ) && ITSEC_Lib::use_cron() ) {
ITSEC_Modules::set_setting( 'global', 'use_cron', false );
}
ITSEC_Modules::set_setting( 'global', 'cron_status', 0 );
Notice the comment which says that cron should be disabled when the user has NOT set the ITSEC_USE_CRON constant to true.
The condition that follows says: disable cron when the ITSEC_USE_CRON constant is not defined OR when it is set to false.
Earlier we saw in the changelog that cron is now the default scheduling mechanism.
(Which to me implicates that not defining the ITSEC_USE_CRON constant is equal to ITSEC_USE_CRON = true).
Also the default value of the internal ‘use_cron’ setting is true …
But the condition in the itsec_cron_test callback says disable cron when the ITSEC_USE_CRON constant is not defined. Clearly there is a contradiction here.
So to fix this issue (or prevent it from happening) simply add the line below to your wp-config.php file:
define('ITSEC_USE_CRON', true);
Even though it is the default (preferred) scheduling system, if you want the iTSec
plugin to KEEP using cron you HAVE to add the line above to your wp-config.php file.
Also keep in mind, after adding the above line to the wp-config.php file, it may take a day for the next itsec_cron_test task to kickoff and correct the situation.
Please note the above recommendation is for the 6.9.2 release only.
If anything changes in a new release I’ll try and update this topic.