Version 1
[yaffs-website] / web / modules / contrib / imagemagick / imagemagick.install
diff --git a/web/modules/contrib/imagemagick/imagemagick.install b/web/modules/contrib/imagemagick/imagemagick.install
new file mode 100644 (file)
index 0000000..12aa0c0
--- /dev/null
@@ -0,0 +1,65 @@
+<?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".
+ */