-
Notifications
You must be signed in to change notification settings - Fork 3
/
islandora_cwrc_writer.install
73 lines (69 loc) · 2.39 KB
/
islandora_cwrc_writer.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
64
65
66
67
68
69
70
71
72
73
<?php
/**
* @file
* Install hooks for this module.
*/
/**
* Implements hook_requirements().
*/
function islandora_cwrc_writer_requirements($phase) {
$t = get_t();
$requirements = array(
'cwrc' => array('title' => $t('CWRC-Writer Library')),
);
$library = array(
'library path' => cwrc_libraries_get_path('CWRC-Writer'),
);
$options = array(
'file' => 'src/editor_dev.htm',
'pattern' => '/CWRC-Writer v([0-9.]+)/',
'lines' => 200,
);
if (file_exists($library['library path'])) {
$requirements['cwrc']['severity'] = REQUIREMENT_OK;
$requirements['cwrc']['value'] = libraries_get_version($library, $options);
}
else {
$requirements['cwrc']['severity'] = REQUIREMENT_ERROR;
$requirements['cwrc']['value'] = $t('Not found');
$requirements['cwrc']['description'] = $t('The <a href="@cwrc">CWRC-Writer Library</a> is missing. <a href="@download">Download</a> and extract it into the <code>@directory</code> directory. Rename the extracted folder to <code>@library-folder</code>.', array(
'@cwrc' => 'https://github.com/cwrc/CWRC-Writer',
'@download' => 'https://github.com/cwrc/CWRC-Writer/archive/development.zip',
'@directory' => 'sites/all/libraries',
'@library-folder' => 'CWRC-Writer')
);
}
return $requirements;
}
/**
* Implements hook_install().
*
* @see islandora_cwrc_writer_islandora_required_objects()
*/
function islandora_cwrc_writer_install() {
module_load_include('inc', 'islandora', 'includes/solution_packs');
// Install required object(s).
islandora_install_solution_pack('islandora_cwrc_writer');
}
/**
* Implements hook_uninstall().
*/
function islandora_cwrc_writer_uninstall() {
module_load_include('inc', 'islandora', 'includes/solution_packs');
islandora_uninstall_solution_pack('islandora_cwrc_writer');
$variables = array(
'islandora_cwrc_writer_default_schema_object',
'islandora_cwrc_writer_person_entity_collection',
'islandora_cwrc_writer_organization_entity_collection',
'islandora_cwrc_writer_title_entity_collection',
'islandora_cwrc_writer_place_entity_collection',
'islandora_cwrc_writer_cwrc_api_url',
'islandora_cwrc_writer_geo_names_url',
'islandora_cwrc_writer_google_geocode_url',
'islandora_cwrc_writer_viaf_url',
'islandora_cwrc_writer_repository_base_object_url',
);
foreach ($variables as $variable) {
variable_del($variable);
}
}