forked from Islandora/islandora_ocr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
islandora_ocr.install
49 lines (43 loc) · 1.33 KB
/
islandora_ocr.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
<?php
/**
* @file
* Install hooks for this module.
*/
/**
* Implements hook_uninstall().
*/
function islandora_ocr_uninstall() {
$variables = array(
'islandora_ocr_tesseract',
'islandora_ocr_tesseract_enabled_languages',
);
array_walk($variables, 'variable_del');
islandora_ocr_cleanup_derivatives();
}
/**
* Implements hook_disable().
*/
function islandora_ocr_disable() {
islandora_ocr_cleanup_derivatives();
}
/**
* Implements hook_enable().
*/
function islandora_ocr_enable() {
drupal_set_message(t('Note: Enabling the Islandora OCR module only enables support for OCR. It does NOT automatically add OCR functionality to modules whose OCR settings are disabled by default. Please check the OCR settings in the administration pages for any OCR-compatible Solution Packs.'), 'warning');
}
/**
* Cleans up variables used in derivative generation.
*/
function islandora_ocr_cleanup_derivatives() {
if (module_exists('islandora_book')) {
$book = variable_get('islandora_book_ingest_derivatives');
$book['ocr'] = FALSE;
variable_set('islandora_book_ingest_derivatives', $book);
}
if (module_exists('islandora_newspaper')) {
$newspaper = variable_get('islandora_newspaper_ingest_derivatives');
$newspaper['ocr'] = FALSE;
variable_set('islandora_newspaper_ingest_derivatives', $newspaper);
}
}