You are here

function ultimate_cron_launch_poorman in Ultimate Cron 7

Same name and namespace in other branches
  1. 8 ultimate_cron.module \ultimate_cron_launch_poorman()
  2. 6 ultimate_cron.module \ultimate_cron_launch_poorman()

Launch the poormans cron background process.

1 call to ultimate_cron_launch_poorman()
ultimate_cron_trigger_poorman in ./ultimate_cron.module
Launch poorman cron if it's time to do so.

File

./ultimate_cron.module, line 567
@todo Add filter on overview page. @todo Add log view (with graph). @todo Make proper markup for overview page. @todo Refactor drush stuff, too many intimate relations with Background Process @todo Refactor Cron % offset stuff. Too mixed up and…

Code

function ultimate_cron_launch_poorman() {
  $handle = 'ultimate_cron_poorman';
  if ($process = background_process_get_process($handle)) {
    if ($process->start + 120 < time()) {

      // Must have timed out or something ... remove it!
      if (background_process_remove_process($handle, $process->start)) {
        $process = NULL;
      }
    }
  }
  if (!$process) {
    $process = new BackgroundProcess($handle);

    // Because anyone can launch poormans cron, run it as anonymous
    $process->uid = 0;
    $process->service_host = 'ultimate_cron_poorman';
    $result = $process
      ->start('_ultimate_cron_poorman');
  }
}