-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathislandora_xquery.drush.inc
53 lines (47 loc) · 1.44 KB
/
islandora_xquery.drush.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* @file
* Drush helpers for Islandora XQuery.
*/
/**
* Implements hook_drush_command().
*/
function islandora_xquery_drush_command() {
$commands = array();
$commands['islandora_xquery_batch_process_command'] = array(
'description' => dt('Process an Islandora XQuery batch set.'),
'options' => array(
'batch_id' => array(
'description' => dt('The batch set ID to process.'),
'required' => TRUE,
),
),
'aliases' => array('ixbp'),
);
return $commands;
}
/**
* Command callback for processing XQuery batches.
*/
function drush_islandora_xquery_batch_process_command() {
module_load_include('inc', 'islandora_xquery', 'includes/apply');
// @XXX: Standard logged-in-user paranoia.
drupal_static_reset('islandora_get_tuque_connection');
$connection = islandora_get_tuque_connection();
$batch_id = drush_get_option('batch_id');
$batch = array(
'title' => t('Applying XQuery'),
'finished' => 'islandora_xquery_apply_query_batch_finished',
'progress_message' => t('Time elapsed: @elapsed <br/>Estimated time remaining @estimate.'),
'error_message' => t('An error has occurred.'),
'file' => drupal_get_path('module', 'islandora_xquery') . '/includes/apply.inc',
'operations' => array(
array(
'islandora_xquery_apply_query_batch_operation',
array($batch_id, 'is_backend' => TRUE),
),
),
);
batch_set($batch);
drush_backend_batch_process();
}