1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Installation/uninstallation related functions for the image_captcha module.
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
/**
|
9 |
|
|
* Implements hook_requirements().
|
10 |
|
|
*/
|
11 |
|
|
function image_captcha_requirements($phase) {
|
12 |
|
|
$requirements = array();
|
13 |
|
|
$t = get_t();
|
14 |
|
|
if ($phase == 'install') {
|
15 |
|
|
// _image_captcha_check_setup() is defined in image_captcha.module.
|
16 |
|
|
module_load_include('module', 'image_captcha');
|
17 |
|
|
// Check if the GD library is available and raise an error when not.
|
18 |
|
|
if (_image_captcha_check_setup(FALSE) & IMAGE_CAPTCHA_ERROR_NO_GDLIB) {
|
19 |
|
|
$requirements['image_captcha_requires_gd'] = array(
|
20 |
|
|
'title' => $t('Image CAPTCHA requires GD library'),
|
21 |
ac1bc5de
|
Assos Assos
|
'description' => $t(
|
22 |
|
|
'The Image CAPTCHA module can not be installed because your PHP setup does not provide the <a href="!gddoc">GD library</a>, which is required to generate images.',
|
23 |
|
|
array('!gddoc' => 'http://www.php.net/manual/en/book.image.php')
|
24 |
|
|
),
|
25 |
85ad3d82
|
Assos Assos
|
'severity' => REQUIREMENT_ERROR,
|
26 |
|
|
);
|
27 |
|
|
}
|
28 |
|
|
}
|
29 |
|
|
return $requirements;
|
30 |
|
|
}
|
31 |
|
|
|
32 |
|
|
/**
|
33 |
ac1bc5de
|
Assos Assos
|
* On uninstall: remove module variables and clear variable cache.
|
34 |
85ad3d82
|
Assos Assos
|
*/
|
35 |
|
|
function image_captcha_uninstall() {
|
36 |
|
|
db_delete('variable')
|
37 |
|
|
->condition('name', db_like('image_captcha_') . '%', 'LIKE')
|
38 |
|
|
->execute();
|
39 |
|
|
cache_clear_all('variables', 'cache');
|
40 |
|
|
} |