Project:Elysia Cron
Version:6.x-1.2
Component:Code
Category:bug report
Priority:normal
Assigned:gotheric
Status:closed (fixed)

Issue Summary

When defining a cron job via hook_cronapi as follows :

function mymodule_cronapi($op, $job = NULL) {
  switch ($op) {
    case 'list' :
      return array(
        'mymodule_index' => 'Some index routine'
      );
      break;
    case 'rule' :
      switch ($job) {
        case 'mymodule_index' : return '15 1 * * *';
      }
      break;
    case 'execute' :
      switch ($job) {
        case 'mymodule_index' :
          mymodule_index_function();
          break;
      }
      break;
  }
}

and then try to run the routine via "admin/build/cron/status" i am getting sucessful job execution, but in logs there is a message "could not find a function".

After doing some research, i've found that

function elysia_cron_execute_page($job = false) {
  global $cron_completed, $cron_executing_job;
 
  if (!$job) {
    drupal_set_message(t('No job specified'), 'error');
    drupal_goto('admin/build/cron');
  }
...
}

needs to have elysia_cron_initialize(); call, as follows:

function elysia_cron_execute_page($job = false) {
  global $cron_completed, $cron_executing_job;
  elysia_cron_initialize();
  if (!$job) {
    drupal_set_message(t('No job specified'), 'error');
    drupal_goto('admin/build/cron');
  }
...
}

After this everything started to work perfectly.

Comments

#1

Assigned to:Anonymous» gotheric
Status:active» needs work

Hmm, interesting... i'll commit the fix soon!
Thanks for the report.

P.S. Just for information, you can use a more compact form of the declaration (avoiding the "case 'execute'"):

function mymodule_cronapi($op, $job = NULL) {
  switch ($op) {
    case 'list' :
      return array(
        'mymodule_index_function' => 'Some index routine'
      );
      break;
    case 'rule' :
      switch ($job) {
        case 'mymodule_index_function' : return '15 1 * * *';
      }
      break;
  }
}

function mymodule_index_function() {
...
}

#2

Yep, i know. That was just the case when the bug comes up.

#3

Status:needs work» fixed

Commited patch (and other fixes).

#4

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#5

Status:closed (fixed)» fixed

I see your last module version release was in 2009. Looks like this patch was put in after the latest official copy of 1.2. Are you planning on putting out the updated version?

This is the exact fix I need for our site to test and make sure this module is set up correctly.

#6

I'm working on new relases right now (for D5, D6 & D7).

I've just relased a new NIGHLY release... i think you should wait some weeks for a new stable release.

#7

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.