Project

General

Profile

Paste
Download (1.26 KB) Statistics
| Branch: | Revision:

root / drupal7 / sites / all / modules / captcha / image_captcha / image_captcha.install @ 620f9137

1
<?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
        '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
        'severity' => REQUIREMENT_ERROR,
26
      );
27
    }
28
  }
29
  return $requirements;
30
}
31

    
32
/**
33
 * On uninstall: remove module variables and clear variable cache.
34
 */
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
}