annotate core/modules/config/config.install @ 9:1fc0ff908d1f

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