comparison core/modules/config/config.install @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 /**
4 * @file
5 * Install, update and uninstall functions for the config module.
6 */
7
8 /**
9 * Implements hook_requirements().
10 */
11 function config_requirements($phase) {
12 $requirements = [];
13 try {
14 $directory = config_get_config_directory(CONFIG_SYNC_DIRECTORY);
15 }
16 catch (\Exception $e) {
17 // system_requirements() guarantees that the CONFIG_SYNC_DIRECTORY exists
18 // as the config.storage.staging service relies on it.
19 $directory = FALSE;
20 }
21 // Ensure the configuration sync directory is writable. This is only a warning
22 // because only configuration import from a tarball requires the folder to be
23 // web writable.
24 if ($phase !== 'install' && !is_writable($directory)) {
25 $requirements['config directory ' . CONFIG_SYNC_DIRECTORY] = [
26 'title' => t('Configuration directory: %type', ['%type' => CONFIG_SYNC_DIRECTORY]),
27 'description' => t('The directory %directory is not writable.', ['%directory' => $directory]),
28 'severity' => REQUIREMENT_WARNING,
29 ];
30 }
31 return $requirements;
32 }