Scheduled task execution task in drupal cron

I have a module called parser2 that parses from html pages. Everything works fine except for the cron graph. It just does not add my task to cron tasks, and in the logs I see that there are 0 scheduled tasks, each time cron starts. The next question is, if I manually run cron several times, after I get the white screen of death, and the only thing that helps me is remove its parser2 table from the database and from the system.table, and then run update.php, Here code that should do all this work, but I can't figure out where the error is here.

function parser_cron_queue_info() { $info = array(); $info['get_parser_weather'] = array( 'worker callback' => 'parser_weather', 'time' => 10, ); $query = db_select('parser_jobs', 'pn') ->fields('pn', array('id','time_run_in_crone')) ->condition('run_in_crone', 1) ->execute(); foreach ($query as $job){ $info['get_parser_weather_'.$job->id] = array( 'worker callback' => 'parser_weather', 'time' => $job->time_run_in_crone, }; } return $info; } function parser_cron() { $query = db_select('parser_jobs', 'pn') ->fields('pn', array('id','time_run_in_crone')) ->condition('run_in_crone', 1) ->execute(); foreach ($query as $job){ $queue = DrupalQueue::get('get_parser_weather_'.$job->id); $queue->createItem($job->id); } } function parser_weather($job_id){ $job = parser_job_load($job_id); _parser_url_delete_all(); _parser_url_add($job->start_url); while (_parser_url_get_not_parsed()) { parser_parse2($job); }; } 
+4
source share
1 answer

Try to get the cron command that the code generates, and then run it on the command line to make sure it is correct, and double-check whether the user has your script permission to add a new task.

+1
source

All Articles