home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (image_captcha.install)

This example Drupal source code file (image_captcha.install) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

array, captcha, function, gd, gddoc, if, image_captcha_error_no_gdlib, image_captcha_uninstall, install, library, not, phase, php, requirements

The image_captcha.install Drupal example source code

// $Id: image_captcha.install,v 1.12 2010/11/16 23:22:12 soxofaan Exp $

 * @file
 * Installation/uninstallation related functions for the image_captcha module.

 * Implements hook_requirements().
function image_captcha_requirements($phase) {
  $requirements = array();
  $t = get_t();
  if ($phase == 'install') {
    // _image_captcha_check_setup() is defined in image_captcha.module.
    module_load_include('module', 'image_captcha');
    // Check if the GD library is available and raise an error when not.
    if (_image_captcha_check_setup(FALSE) & IMAGE_CAPTCHA_ERROR_NO_GDLIB) {
      $requirements['image_captcha_requires_gd'] = array(
        'title' => $t('Image CAPTCHA requires GD library'),
        'description' =>
          $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.',
            array('!gddoc' => 'http://www.php.net/manual/en/book.image.php',)
        'severity' => REQUIREMENT_ERROR,
  return $requirements;

 * On uninstall: remove module variables and clear variable cache
function image_captcha_uninstall() {
    ->condition('name', db_like('image_captcha_') . '%', 'LIKE')
  cache_clear_all('variables', 'cache');

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal image_captcha.install source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.