You are here

function configuration_install in Configuration Management 7.2

Same name and namespace in other branches
  1. 7 configuration.install \configuration_install()

Implements hook_install().

File

./configuration.install, line 53
Install, update and uninstall functions for the configuration module.

Code

function configuration_install() {
  $directory = variable_get('configuration_config_path', conf_path() . '/files/config');
  if (!is_dir($directory) && !drupal_mkdir($directory, NULL, TRUE)) {

    // If the directory does not exists and cannot be created.
    drupal_set_message(st('The directory %directory does not exist and could not be created.', array(
      '%directory' => $directory,
    )), 'error');
    watchdog('file system', 'The directory %directory does not exist and could not be created.', array(
      '%directory' => $directory,
    ), WATCHDOG_ERROR);
  }
  if (is_dir($directory) && !is_writable($directory) && !drupal_chmod($directory)) {

    // If the directory is not writable and cannot be made so.
    drupal_set_message(st('The directory %directory exists but is not writable and could not be made writable.', array(
      '%directory' => $directory,
    )), 'error');
    watchdog('file system', 'The directory %directory exists but is not writable and could not be made writable.', array(
      '%directory' => $directory,
    ), WATCHDOG_ERROR);
  }
  elseif (is_dir($directory)) {
    file_create_htaccess($directory);
  }
}