Version 1
[yaffs-website] / web / modules / contrib / advagg / advagg_ext_minify / advagg_ext_minify.install
1 <?php
2
3 /**
4  * @file
5  * Install, update and uninstall functions for the advagg_ext_minify module.
6  */
7
8 /**
9  * Implements hook_requirements().
10  */
11 function advagg_ext_minify_requirements($phase) {
12   $requirements = [];
13
14   if ($phase == 'runtime') {
15
16     // Check that php's shell_exec works. `ls` is pretty cross-platform.
17     // Older Windows may not have it though so try `dir` as a backup.
18     if (!@shell_exec('ls') && !@shell_exec('dir')) {
19       $requirements['advagg_ext_min_shell_exec'] = [
20         'title' => t('PHP shell_exec'),
21         'severity' => REQUIREMENT_ERROR,
22         'description' => t('PHP shell_exec is non-functional. Check php.ini for safemode or <a href="@link" target="_blank">disable_functions</a>.', [
23           '@link' => 'http://php.net/manual/en/ini.core.php#ini.disable-functions',
24         ]),
25
26       ];
27     }
28     else {
29       $requirements['advagg_ext_min_shell_exec'] = [
30         'title' => t('PHP shell_exec'),
31         'severity' => REQUIREMENT_OK,
32         'description' => t('Enabled'),
33       ];
34     }
35   }
36   return $requirements;
37 }