source: sipes/modules_contrib/captcha/image_captcha/image_captcha.install @ 92213c1

stableversion-3.0
Last change on this file since 92213c1 was 177a560, checked in by José Gregorio Puentes <jpuentes@…>, 8 años ago

se agrego el directorio de modulos contribuidos de drupal

  • Propiedad mode establecida a 100755
File size: 2.2 KB
Línea 
1<?php
2
3/*
4 * @file
5 * Installation/uninstallation related functions for the image_captcha module.
6 */
7
8/**
9 * Implementation of hook_requirements().
10 */
11function 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    // We use a trick based on __FILE__ instead of a call to
17    // module_load_include(), because the latter is not available when
18    // this module is installed as part of an installation profile.
19    include_once(dirname(__FILE__) .'/image_captcha.module');
20    // Check if the GD library is available and raise an error when not.
21    if (_image_captcha_check_setup(FALSE) & IMAGE_CAPTCHA_ERROR_NO_GDLIB) {
22      $requirements['image_captcha_requires_gd'] = array(
23        'title' => $t('Image CAPTCHA requires GD library'),
24        'description' =>
25          $t('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.',
26            array('!gddoc' => 'http://www.php.net/manual/en/book.image.php',)
27          ),
28        'severity' => REQUIREMENT_ERROR,
29      );
30    }
31  }
32  return $requirements;
33}
34
35/**
36 * On uninstall: remove module variables and clear variable cache
37 */
38function image_captcha_uninstall() {
39  db_query("DELETE FROM {variable} WHERE name LIKE 'image_captcha_%'");
40  cache_clear_all('variables', 'cache');
41}
42
43/**
44 * Implementation of hook_update_N()
45 */
46function image_captcha_update_6201() {
47  // Fixing a typo in a variable.
48  $old = 'image_captcha_bilinair_interpolation';
49  $new = 'image_captcha_bilinear_interpolation';
50  variable_set($new, variable_get($old, FALSE));
51  variable_del($old);
52  $items = array();
53  return $items;
54}
55
56/**
57 * Implementation of hook_update_N().
58 *
59 * Translate single font variable to multiple font variable.
60 */
61function image_captcha_update_6203() {
62  // Old single font variable.
63  $font = variable_get('image_captcha_font', NULL);
64  // If there was a valid value,
65  // save it as an array to the new multiple fonts variable.
66  if ($font != NULL) {
67    variable_set('image_captcha_fonts', array($font));
68  }
69  return array();
70}
71
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.