You are here

imagemagick.install in ImageMagick 8

Same filename and directory in other branches
  1. 8.3 imagemagick.install
  2. 8.2 imagemagick.install
  3. 7 imagemagick.install

ImageMagick installation scripts.

File

imagemagick.install
View source
<?php

/**
 * @file
 * ImageMagick installation scripts.
 */

/**
 * Implements hook_requirements().
 */
function imagemagick_requirements($phase) {
  $requirements = [];
  if ($phase === 'install' && stripos(ini_get('disable_functions'), 'proc_open') !== FALSE) {
    $reported_info = [];

    // proc_open() is disabled.
    $severity = REQUIREMENT_ERROR;
    $reported_info[] = t("The <a href=':proc_open_url'>proc_open()</a> PHP function is disabled. It must be enabled for the toolkit to be installed. Edit the <a href=':disable_functions_url'>disable_functions</a> entry in your php.ini file, or consult your hosting provider.", [
      ':proc_open_url' => 'http://php.net/manual/en/function.proc-open.php',
      ':disable_functions_url' => 'http://php.net/manual/en/ini.core.php#ini.disable-functions',
    ]);
    $requirements = [
      'imagemagick' => [
        'title' => t('ImageMagick'),
        'description' => [
          '#markup' => implode('<br />', $reported_info),
        ],
        'severity' => $severity,
      ],
    ];
  }
  return $requirements;
}

/**
 * @addtogroup updates-8.x-1.0-alpha
 * @{
 */

/**
 * Adds the 'locale' config setting.
 */
function imagemagick_update_8001() {
  $config_factory = \Drupal::configFactory();
  $setting = $config_factory
    ->getEditable('imagemagick.settings')
    ->set('locale', 'en_US.UTF-8')
    ->save(TRUE);
}

/**
 * Adds the 'log_warnings' config setting.
 */
function imagemagick_update_8002() {
  $config_factory = \Drupal::configFactory();
  $setting = $config_factory
    ->getEditable('imagemagick.settings')
    ->set('log_warnings', TRUE)
    ->save(TRUE);
}

/**
 * @} End of "addtogroup updates-8.x-1.0-alpha".
 */

Functions

Namesort descending Description
imagemagick_requirements Implements hook_requirements().
imagemagick_update_8001 Adds the 'locale' config setting.
imagemagick_update_8002 Adds the 'log_warnings' config setting.