View source
<?php
function configuration_schema() {
$schema['config_export'] = array(
'description' => 'The table that holds the status of what is being tracked in configuration management.',
'fields' => array(
'cid' => array(
'description' => 'The primary identifier for a configuration.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'name' => array(
'type' => 'varchar',
'length' => '128',
'default' => '',
'not null' => TRUE,
'description' => 'The unique name of the configuration item. This is the primary field configurations are loaded from.',
),
'owner' => array(
'type' => 'varchar',
'length' => '32',
'default' => '',
'not null' => TRUE,
'description' => 'The module name that owns the configuration item.',
),
'status' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0x0,
'size' => 'tiny',
'description' => 'The exportable status of a configuration.',
),
'hash' => array(
'type' => 'char',
'not null' => TRUE,
'default' => '',
'length' => '32',
'description' => 'The last hash status of a configuration.',
),
'parent' => array(
'type' => 'varchar',
'length' => '256',
'default' => '',
'description' => 'Holds the name of parent configs',
),
'dependencies' => array(
'type' => 'text',
'size' => 'normal',
'description' => 'Holds a serialized array of module dependencies',
),
),
'primary key' => array(
'cid',
),
'indexes' => array(
'plugin' => array(
'owner',
),
),
);
$schema['cache_configuration'] = drupal_get_schema_unprocessed('system', 'cache');
return $schema;
}
function configuration_install() {
$directory = variable_get('configuration_config_path', conf_path() . '/files/config');
if (!is_dir($directory) && !drupal_mkdir($directory, NULL, TRUE)) {
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)) {
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);
}
}
function configuration_uninstall() {
$config_dir = variable_get('configuration_config_path', conf_path() . '/files/config');
foreach (glob($config_dir . "/*") as $filename) {
unlink($filename);
}
if (is_file($config_dir . '/.htaccess')) {
unlink($config_dir . '/.htaccess');
}
rmdir($config_dir);
variable_del('configuration_config_path');
}