'Fetch all items to be indexed, and add them to the queue.', 'bootstrap' => 'DRUSH_BOOTSTRAP_DRUPAL_FULL', 'callback' => 'search_api_cron', 'aliases' => array('sapifi'), ); $items['queue-run-concurrent'] = array( 'description' => 'Run a specific queue by name', 'arguments' => array( 'queue_name' => 'The name of the queue to run, as defined in either hook_queue_info or hook_cron_queue_info.', 'concurrency level' => 'The amount of background processes to spin-off' ), 'required-arguments' => TRUE, 'aliases' => array('sapifiq'), ); $items['build-file-list-scan'] = array( 'description' => 'Crée les fichier csv qui serviront poiur les imports des notices dans eaudoc', // 'arguments' => array( // 'file' => 'The name of csv file toi treat.', // ), ); $items['update-notice-with-scan'] = array( 'description' => 'Mets a jour les notices avec les fichiers scann�s', 'arguments' => array( 'file' => 'The absolute path of csv file toi treat : /var/www/html/.../___.csv', ), ); return $items; } /** * Command callback for drush queue-run-concurrent. * * Queue runner that is compatible with queues declared using both * hook_queue_info() and hook_cron_queue_info(). * * @param $queue_name * Arbitrary string. The name of the queue to work with. * @param $concurrency_level * Amount of background */ function drush_eaudoc_queue_run_concurrent($queue_name, $concurrency_level) { // Get all queues. $queues = drush_queue_list(); print_r($queues); if (isset($queues[$queue_name])) { print $queue_name; $queue = DrupalQueue::get($queue_name); for ($i = 0; $queue->numberOfItems() > $i; $i++) { $invocations[] = array('command' => 'queue-run ' . $queue_name, 'site' => '@self'); } $common_options = array( 'concurrency' => $concurrency_level, ); drush_backend_invoke_concurrent($invocations, array(), $common_options); } } /** * Callback for the drush-demo-command command */ function drush_eaudoc_build_file_list_scan() { include_once(drupal_get_path('module', 'eaudoc') . '/eaudoc.map_scan_2019.inc'); echo __FUNCTION__ . "\n"; $result = eaudoc_build_file_list_scan_2019(); echo $result . "\n"; echo "FIN\n"; } /** * Callback for the drush-demo-command command */ function drush_eaudoc_update_notice_with_scan($file) { include_once(drupal_get_path('module', 'eaudoc') . '/eaudoc.map_scan_2019.inc'); // echo DRUPAL_ROOT . "\n"; echo __FUNCTION__ . "\n"; echo $file . "\n"; // return; //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."); } // return; $result = eaudoc_map_scan_2019_in_eaudoc($file); echo "result = $result\n"; }