Hi,
This module is great, thank you for all your hard work on it.
I am having one issue, though; I have created a background process job that I want to run on cron. yet I keep getting an error (in watchdog) of access denied:
bgp-start/background_batch%253A246/9f69fcdb40036f19dacad22b7382b371
I am getting none of the messages from the batch permission background_process_service_access… just a simple access denied. Is there something I am doing wrong? There must be.
Code below. Any and all pointers appreciated. Thank you!
I declare the batch in my hook_cron function, using background_batch_process_batch:
function mymodule_cron()
$function = 'mymodule_nightly_batch';
$bunch_of_nids = db_query('get a bunch of nids');
$batch = $function($bunch_of_nids);
batch_set($batch);
background_batch_process_batch('callback-that-anons-have-access-to');
}
the batch function works as follows:
function mymodule_nightly_batch($bunch_of_nids) {
$num_operations = sizeof($bunch_of_nids);
$operations = array();
for ($i = 0; $i<$num_operations; $i++) {
$operations[] = array('mymodule_nightly_batch_op', array($bunch_of_nids[$i], $i) );
}
$batch = array(
'title' => t('doing work' ),
'operations' => $operations,
'progressive' => FALSE,
);
return $batch;
}
and the op is something like this:
function mymodule_nightly_batch_op($nid, $operation_details, &$context) {
$node = node_load($nid);
mymodule_do_something_with($node) ;
$context['results'][] = $node;
watchdog('nightly_batch', 'run on ' . $node->title);
}
Comments
Comment #1
gielfeldt CreditAttribution: gielfeldt commentedThe "progressive" flag in the Drupal batch API is broken afair.
Also, i don't think it will redirect afterwards in non-progressive mode, but that's probably irrelevant.
First, try replacing:
with:
Beyond that, I can image 5 reasons where you would get an access denied on the sub-request.
Since you're not getting any of the watchdog messages defined in the access handler, I guess #1 and #2 can be eliminated.
Comment #2
gielfeldt CreditAttribution: gielfeldt commentedDid you find out what was wrong?
Comment #3
acb CreditAttribution: acb commentedHi, and thanks for this (sorry for dropping the ball here). I have pasted the errors I am getting in the other thread here: https://drupal.org/node/2233843.
happy to put in what debugging suggestions you would have.