Have a module function hooking batch: $batch = array( 'operations' => array( array('mymodule_batch_task', array($var1, $var2)), ), 'finished' => 'mymodule_batch_finished', 'title' => t('batch process'), 'init_message' => t('starting.'), 'progress_message' => t('Processed @current out of @total.'), 'error_message' => t('encountered an error.'), 'file' => 'mymodule.admin.inc', ); batch_set($batch); The batch process messages appear on the screen as they should, but it seems that the operations function doesn't fire at all. I put a watchdog command before the above call, and it appears in the dblog report. I put a watchdog call at the beginning of mymodule_batch_task() and it doesn't show up, and neither does the watchdog call from the 'finished' function. Jeff -- Ayen Designs 388 Bullsboro Drive #105 · Newnan, Georgia 30263 404-271-9734 ayendesigns.com <http://ayendesigns.com> IM (Yahoo) baalwww (MSN) baalwww@yahoo.com Skype: ayendesigns Ayen Designs is a tradename of the computer services division of
I believe you need to call batch_process('node/to/redirect/to/when/finished'); Joe On Jun 9, 2010, at 3:25 PM, Jeff Greenberg wrote:
Have a module function hooking batch:
$batch = array( 'operations' => array( array('mymodule_batch_task', array($var1, $var2)), ), 'finished' => 'mymodule_batch_finished', 'title' => t('batch process'), 'init_message' => t('starting.'), 'progress_message' => t('Processed @current out of @total.'), 'error_message' => t('encountered an error.'), 'file' => 'mymodule.admin.inc', ); batch_set($batch);
The batch process messages appear on the screen as they should, but it seems that the operations function doesn't fire at all. I put a watchdog command before the above call, and it appears in the dblog report. I put a watchdog call at the beginning of mymodule_batch_task() and it doesn't show up, and neither does the watchdog call from the 'finished' function.
Jeff -- <ayenlogo.jpeg>Ayen Designs 388 Bullsboro Drive #105 · Newnan, Georgia 30263 404-271-9734 ayendesigns.com IM (Yahoo) baalwww (MSN) baalwww@yahoo.com Skype: ayendesigns
Ayen Designs is a tradename of the computer services division of <acmelogo.jpeg>
On 6/9/2010 3:36 PM, Joe Pletcher wrote:
I believe you need to call batch_process('node/to/redirect/to/when/finished');
Joe
Doing that, and, in fact, the redirect occurs, but the meat of the operations function doesn't seem to be happening, and again, the dblog report doesn't contain the watchdog statements from the beginning of the operations function and finished function. I'm assuming that what I've read regarding watchdog working in those places (as opposed to dpm, print_r, etc.) is correct ... unfortunately there's not a 'send up a flare' command :-)
The batch_example.module in Examples project<http://drupal.org/project/examples>may be helpful. -Randy On Wed, Jun 9, 2010 at 1:25 PM, Jeff Greenberg <jeff@ayendesigns.com> wrote:
Have a module function hooking batch:
$batch = array( 'operations' => array( array('mymodule_batch_task', array($var1, $var2)), ),
'finished' => 'mymodule_batch_finished', 'title' => t('batch process'), 'init_message' => t('starting.'), 'progress_message' => t('Processed @current out of @total.'), 'error_message' => t('encountered an error.'), 'file' => 'mymodule.admin.inc', ); batch_set($batch);
The batch process messages appear on the screen as they should, but it seems that the operations function doesn't fire at all. I put a watchdog command before the above call, and it appears in the dblog report. I put a watchdog call at the beginning of mymodule_batch_task() and it doesn't show up, and neither does the watchdog call from the 'finished' function.
Jeff --
Ayen Designs 388 Bullsboro Drive #105 · Newnan, Georgia 30263 404-271-9734 ayendesigns.com IM (Yahoo) baalwww (MSN) baalwww@yahoo.com Skype: ayendesigns
Ayen Designs is a tradename of the computer services division of
-- Randy Fay Drupal Module and Site Development randy@randyfay.com +1 970.462.7450
On 6/9/2010 4:17 PM, Randy Fay wrote:
The batch_example.module in Examples project <http://drupal.org/project/examples> may be helpful.
-Randy Thanks Randy, that project will be helpful in general. Unfortunately, the only difference I found was that in the example, batch_set is wrapped around the call to the function hooking batch, and in mine, the batch_set occurs in the hooking function. I changed it to be the same as the example (which has a comment in the block that sets up the batch example like mine that reads 'this doesn't seem to work') and same result...the batch status messages appear, but no processing seems to happen.
Jeff
Undocumented, AFAIK, but your processing function has to be in the main module file. On Wed, Jun 9, 2010 at 4:55 PM, Jeff Greenberg <jeff@ayendesigns.com> wrote:
On 6/9/2010 4:17 PM, Randy Fay wrote:
The batch_example.module in Examples project may be helpful.
-Randy
Thanks Randy, that project will be helpful in general. Unfortunately, the only difference I found was that in the example, batch_set is wrapped around the call to the function hooking batch, and in mine, the batch_set occurs in the hooking function. I changed it to be the same as the example (which has a comment in the block that sets up the batch example like mine that reads 'this doesn't seem to work') and same result...the batch status messages appear, but no processing seems to happen.
Jeff
-- Ken Rickard agentrickard@gmail.com http://ken.therickards.com
You can place the function in another file, but you need to use the 'file' parameter on your batch array. And there in lies a problem I see:
$batch = array( 'operations' => array( array('mymodule_batch_task', array($var1, $var2)), ), 'finished' => 'mymodule_batch_finished', 'title' => t('batch process'), 'init_message' => t('starting.'), 'progress_message' => t('Processed @current out of @total.'), 'error_message' => t('encountered an error.'), 'file' => 'mymodule.admin.inc', ); batch_set($batch);
It should be 'file' => drupal_get_path('module','mymodule').'/mymodule.admin.inc' File needs the path on batches, unlike when you use it on a menu or theme item. Jamie Holly http://www.intoxination.net http://www.hollyit.net On 6/9/2010 6:29 PM, Ken Rickard wrote:
Undocumented, AFAIK, but your processing function has to be in the main module file.
On Wed, Jun 9, 2010 at 4:55 PM, Jeff Greenberg<jeff@ayendesigns.com> wrote:
On 6/9/2010 4:17 PM, Randy Fay wrote:
The batch_example.module in Examples project may be helpful.
-Randy
Thanks Randy, that project will be helpful in general. Unfortunately, the only difference I found was that in the example, batch_set is wrapped around the call to the function hooking batch, and in mine, the batch_set occurs in the hooking function. I changed it to be the same as the example (which has a comment in the block that sets up the batch example like mine that reads 'this doesn't seem to work') and same result...the batch status messages appear, but no processing seems to happen.
Jeff
On 6/9/2010 6:33 PM, Jamie Holly wrote:
It should be 'file' => drupal_get_path('module','mymodule').'/mymodule.admin.inc'
File needs the path on batches, unlike when you use it on a menu or theme item. Yep, that was it...and it was in the docs. Lots of fun that it doesn't throw an error. Thanks!!
participants (5)
-
Jamie Holly -
Jeff Greenberg -
Joe Pletcher -
Ken Rickard -
Randy Fay