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

Drupal example source code file (image_import.install)

This example Drupal source code file (image_import.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, choose, directory, dirpath, does, either, exist, function, image, import, not, phase, php, the

The image_import.install Drupal example source code

<?php
// $Id: image_import.install,v 1.7.2.1 2010/08/03 17:43:00 sun Exp $

/**
 * Implementation of hook_requirements().
 */
function image_import_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {
    $requirements['image_import_dir'] = array('title' => t('Image import'));
    $dirpath = variable_get('image_import_path', '');
    // If the import directory has not been configured, indicate an error.
    if ($dirpath == '') {
      $requirements['image_import_dir']['value'] = t('Import directory has not been configured.');
      $requirements['image_import_dir']['description'] = t('The import directory must be <a href="@configure">configured</a> and exist in order for the Image import module to function.', array('@configure' => url('admin/settings/image/image_import')));
      $requirements['image_import_dir']['severity'] = REQUIREMENT_ERROR;
    }
    elseif (!file_check_directory($dirpath)) {
      // The import directory does not exist, indicate an error.
      $requirements['image_import_dir']['value'] = t('Import directory %dirpath does not exist or is not writable.', array('%dirpath' => $dirpath));
      $requirements['image_import_dir']['description'] = t('The import directory %dirpath either does not exist or does not grant the web container write permission. Either <a href="@choose">choose</a> a different directory or create the %dirpath directory and grant write permissions. The Image import module will not function until this is corrected.', array('%dirpath' => $dirpath, '@choose' => url('admin/settings/image/image_import')));
      $requirements['image_import_dir']['severity'] = REQUIREMENT_ERROR;
    }
    else {
      $requirements['image_import_dir']['value'] = t('Import directory %dirpath exists.', array('%dirpath' => $dirpath));
      $requirements['image_import_dir']['severity'] = REQUIREMENT_OK;
    }
  }
  return $requirements;
}

function image_import_uninstall() {
  variable_del('image_import_path');
}

function image_import_update_1() {
  variable_del('image_import_extensions');
  return array();
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal image_import.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.