1

I'm running some really long batch process. So in case user navigates away from the batch progress page, I'd like to be able to give him a link that leads back to that page. How can I get the batch ID needed for the batch processing page?

Knowing that batch processing url is something like http://example.com/batch?op=start&id=183 so in theory I could look for the $_GET['id'] inside my batch process function and store that in a session variable but it seems really ugly. Yet I didn't find any way to get the id of the batch that I just started.

It would be really nice if batch_set() would return batch id or would just add it to the batch definition array.

3

After batch_set(). Use

$batch =& batch_get();

This contains the information you need.

But I'm not sure you will be able to resume.

  • It's no problem to resume when I navigate to /batch?op=start&id=ID but unfortunately in my case batch_get() returns array without batch ID. If you look at batch_set you'll see that batch id is not being set inside that function. The batch ID is set inside batch_process which is called later and NOT explicitly by my code. – SiliconMind Feb 16 '15 at 20:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.