-
Notifications
You must be signed in to change notification settings - Fork 0
/
boston_college.drush.inc
193 lines (182 loc) · 6.39 KB
/
boston_college.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<?php
/**
* @file
* Drush hooks for the module.
*/
/**
* Implements hook_drush_command().
*/
function boston_college_drush_command() {
return array(
'boston_college_ingest_preprocess' => array(
'description' => t('Prepare a directory for ingest.'),
'drupal dependencies' => array('boston_college'),
'options' => array(
'target' => array(
'description' => t('The directory to prepare.'),
'required' => TRUE,
),
),
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_LOGIN,
'examples' => array('drush -v boston_college_ingest_preprocess --target=/home/user/site_data'),
),
'boston_college_update_handles' => array(
'description' => t('Update existing Handles to point at new Islandora object URLs. Subsquent runs of this command should only go back and update Handles that do not return a success code from the initial run.'),
'drupal dependencies' => array(
'islandora',
'islandora_handle',
'boston_college',
),
'options' => array(
'base' => array(
'description' => t('The base URL to be used when constructing handles (in http:// form).'),
'required' => TRUE,
),
),
'examples' => array(
'drush -u 1 boston_college_update_handles' => t('Updating existing Handles.'),
),
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_LOGIN,
),
'boston_college_update_dc' => array(
'description' => t('Update existing the Dublin Core of existing objects to use a consistent XSL for transforming.'),
'drupal depdencies' => array(
'islandora',
'xml_form_builder',
'boston_college',
),
'examples' => array(
'drush -u 1 boston_college_update_dc' => t('Update existing Dublin Core.'),
),
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_LOGIN,
),
'boston_college_update_dc_identifier' => array(
'description' => t('Update the missing dc:identifiers on objects.'),
'drupal depdencies' => array(
'islandora',
'boston_college',
),
'examples' => array(
'drush -u 1 boston_college_update_dc_identifier' => t('Update existing dc:identifiers.'),
),
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_LOGIN,
),
'boston_college_update_dc_identifier_again' => array(
'description' => t('Update the missing dc:identifiers on objects.'),
'drupal depdencies' => array(
'islandora',
'boston_college',
),
'examples' => array(
'drush -u 1 boston_college_update_dc_identifier_again' => t('Update existing dc:identifiers.'),
),
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_LOGIN,
),
);
}
/**
* Run the directory processing.
*/
function drush_boston_college_ingest_preprocess() {
$preprocessor = new BostonCollegeBatchPreprocessor(
islandora_get_tuque_connection(),
array(
'type' => 'directory',
'target' => drush_get_option('target'),
'parent' => variable_get('islandora_repository_pid', 'islandora:root'),
'parent_relationship_uri' => FEDORA_RELS_EXT_URI,
'parent_relationship_pred' => 'isMemberOfCollection',
'namespace' => 'bc-ir',
)
);
$preprocessed = islandora_batch_handle_preprocessor($preprocessor);
}
/**
* Update Handles to point at new URLs.
*/
function drush_boston_college_update_handles() {
$base_url = drush_get_option('base');
batch_set(boston_college_update_handles_create_batch($base_url));
drush_backend_batch_process();
}
/**
* Constructs a batch used to update things via Drush.
*/
function boston_college_update_handles_create_batch($base_url) {
return array(
'operations' => array(
array('boston_college_update_handles_batch_operation', array($base_url)),
),
'title' => t('Updating Handles for objects...'),
'init_message' => t('Preparing to update Handles.'),
'progress_message' => t('Time elapsed: @elapsed <br/>Estimated time remaining @estimate.'),
'error_message' => t('An error has occurred.'),
'file' => drupal_get_path('module', 'boston_college') . '/includes/handle.batch.inc',
);
}
/**
* Update Dublin Core on objects.
*/
function drush_boston_college_update_dc() {
batch_set(boston_college_update_dc_batch());
drush_backend_batch_process();
}
/**
* Constructs a batch to update Dublin Core via batch.
*/
function boston_college_update_dc_batch() {
return array(
'operations' => array(
array('boston_college_update_dc_batch_operation', array()),
),
'title' => t('Updating Dublin Core for objects...'),
'init_message' => t('Preparing to update Dublin Core.'),
'progress_message' => t('Time elapsed: @elapsed <br/>Estimated time remaining @estimate.'),
'error_message' => t('An error has occurred.'),
'file' => drupal_get_path('module', 'boston_college') . '/includes/dc.batch.inc',
);
}
/**
* Update dc:identifiers on objects.
*/
function drush_boston_college_update_dc_identifier() {
batch_set(boston_college_update_dc_identifier_batch());
drush_backend_batch_process();
}
/**
* Constructs a batch to update dc:identifiers.
*/
function boston_college_update_dc_identifier_batch() {
return array(
'operations' => array(
array('boston_college_update_dc_identifier_batch_operation', array()),
),
'title' => t('Updating dc:identifiers for objects...'),
'init_message' => t('Preparing to update Dublin Core.'),
'progress_message' => t('Time elapsed: @elapsed <br/>Estimated time remaining @estimate.'),
'error_message' => t('An error has occurred.'),
'file' => drupal_get_path('module', 'boston_college') . '/includes/identifier.batch.inc',
);
}
/**
* Update dc:identifiers on objects again.
*/
function drush_boston_college_update_dc_identifier_again() {
batch_set(boston_college_update_dc_identifier_again_batch());
drush_backend_batch_process();
}
/**
* Constructs a batch to update dc:identifiers.
*/
function boston_college_update_dc_identifier_again_batch() {
return array(
'operations' => array(
array('boston_college_update_dc_identifier_again_batch_operation', array()),
),
'title' => t('Updating dc:identifiers for objects again...'),
'init_message' => t('Preparing to update Dublin Core.'),
'progress_message' => t('Time elapsed: @elapsed <br/>Estimated time remaining @estimate.'),
'error_message' => t('An error has occurred.'),
'file' => drupal_get_path('module', 'boston_college') . '/includes/identifier.batch.inc',
);
}