'Import formations from cnfme website', ); return $items; } /** * Callback for the drush-demo-command command */ function drush_oieau_multisite_import_formations() { include_once(drupal_get_path('module', 'oieau_multisite') . '/inc/formations_cnfme.inc'); drush_print(__FUNCTION__); // oieau_import_get_taxonomy_hierarchy_format(4); // var_export($GLOBALS['user']); //for import and taxonomy, user must be 1 if ($GLOBALS['user']->uid != 1 ) { throw new Exception("This command must be run on admin. use --user=1."); } // drush_print('ok'); $data = formations_cnfme_getdata(); $batch = array( 'operations' => array( array('formations_cnfme_import_batch', array($data)), ), 'finished' => 'formations_cnfme_import_batch_finish', 'title' => t('Processing import formation Batch'), 'init_message' => t('Import formation is starting.'), 'progress_message' => t('Processed @current out of @total.'), 'error_message' => t('Import formation has encountered an error.'), 'file' => drupal_get_path('module', 'oieau_multisite') . '/inc/formations_cnfme.inc', ); // // return 'po'; batch_set($batch); // $batch =& batch_get(); $batch['progressive'] = FALSE; drush_backend_batch_process(); // echo 'ok ca marche' . "\n"; }