PHP code example of cleantalk / cron

1. Go to this page and download the library: Download cleantalk/cron library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cleantalk / cron example snippets




$cron = new $cron_class();
$cron_option = \Drupal::state()->get($cron->getCronOptionName());
if (empty($cron_option)) {
$cron->saveTasks($cron->getDefaultTasks());
}
$tasks_to_run = $cron->checkTasks(); // Check for current tasks. Drop tasks inner counters.

if (
! empty( $tasks_to_run ) && // There is tasks to run
! $rc_class::check() && // Do not doing CRON in remote call action
(
! defined( 'DOING_CRON' ) ||
( defined( 'DOING_CRON' ) && DOING_CRON !== true )
)
){
$cron_res = $cron->runTasks( $tasks_to_run );
// Handle the $cron_res for errors here.
}