I am attempting to create a batch to import customers. I used this (http://pastebin.com/duTbxpgd) for instance, however in some way it is not working. I see Drupal Development Service progress bar advancing and It is exhibiting Drupal Development Service proper variety of rows I am processing. However what I am attempting to do in Drupal Development Service operation perform is not executed.
Here is my code:
perform form_submit($kind, &$form_state) { batch_import_users(); } perform batch_import_users() { db_set_active('mysqldb'); $end result = db_query("SELECT * FROM {customers}"); db_set_active('default'); $batch = array( 'title' => t('Importing customers ...'), 'operations' => array(), 'init_message' => t('Commencing'), 'progress_message' => t('Processed @present out of @whole.'), 'error_message' => t('An error occurred throughout processing'), 'completed' => 'batch_import_users_finished', 'progressive' => FALSE, 'file' => 'customers.inc', ); foreach ($end result as $row) { $batch['operations'][] = array('batch_create_user', array($row)); } batch_set($batch); batch_process(); } perform batch_create_user($row, &$context) { // Right here I am simply attempting to get some output so I do know Drupal Development Service operation known as, I am not truly importing Drupal Development Service customers but. drupal_set_message($row->uid . ' : ' . $row->login); dd($row->uid . ' : ' . $row->login); $context['results']['processed']++; $context['message'] = $row->login; } perform batch_import_users_finished($success, $outcomes, $operations) { if ($success) { drupal_set_message('Importing customers has completed.'); } else { drupal_set_message('Some error.'); } }
Am I lacking one thing or doing one thing fallacious? Any assist may be very a lot appreciated.