forked from Islandora/islandora_solution_pack_audio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathislandora_audio_sp.install
63 lines (51 loc) · 1.89 KB
/
islandora_audio_sp.install
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
<?php
/**
* @file
* Islandora audio solution pack install
*/
/**
* Islandora audio solution pack requirements
* @global type $base_url
* @param type $phase
* @return string
*/
function islandora_audio_sp_requirements($phase) {
global $base_url;
$requirements = array();
$requirements['fedora-lame']['title'] = t("Lame in \$PATH");
$result = exec('which lame');
if (!$result) {
$requirements['fedora-lame']['value'] = t('Not in $PATH');
$requirements['fedora-lame']['description'] = t('Islandora will not be able to process audio. Click <a href="http://lame.sourceforge.net/download.php">here</a> for installation instructions');
$requirements['fedora-lame']['severity'] = REQUIREMENT_WARNING;
}
else {
$requirements['fedora-lame']['value'] = t("Available");
$requirements['fedora-lame']['severity'] = REQUIREMENT_OK;
}
return $requirements;
}
function islandora_audio_sp_enable() {
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
if (!fedora_available()) {
drupal_set_message(t('Fedora instance is not currently available. Installation must be verified and completed on the Islandora Configuration page.'));
}
else {
$solution_pack_info = islandora_audio_sp_required_fedora_objects();
$batch = array(
'title' => t('Installing Audio Solutionpack objects'),
'file' => drupal_get_path('module', 'fedora_repository') . '/fedora_repository.module',
'operations' => array(),
);
foreach ($solution_pack_info['islandora_audio_sp']['objects'] as $object) {
// Add this object to the batch job queue.
$item = new Fedora_Item($object['pid']);
if (!$item->exists()) {
$batch['operations'][] = array('fedora_repository_batch_reingest_object', array($object));
}
}
batch_set($batch);
batch_process();
}
}