You are here

configuration.install in Configuration Management 7.2

Same filename and directory in other branches
  1. 6 configuration.install
  2. 7 configuration.install

Install, update and uninstall functions for the configuration module.

File

configuration.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the configuration module.
 */

/**
 * Implements hook_schema().
 */
function configuration_schema() {
  $schema['configuration_tracked'] = array(
    'description' => 'Default active store for the configuration system.',
    'fields' => array(
      'component' => array(
        'description' => 'The component that this configuration belongs).',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
      'identifier' => array(
        'description' => 'The identifier for the configuration entry, such as module.example (the name of the file, minus the file extension and the component).',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'hash' => array(
        'description' => 'A sha1 hash that respresent the configuration. Used to track differences between the ActiveStore, DataStore and tracked area.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'file' => array(
        'description' => 'The name of the file that storage the configuration in the config directory.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'component',
      'identifier',
    ),
  );
  return $schema;
}

/**
 * Implements hook_install().
 */
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);
  }
}

Functions

Namesort descending Description
configuration_install Implements hook_install().
configuration_schema Implements hook_schema().