Skip to content
Snippets Groups Projects
Commit 3fe27a8d authored by Angie Byron's avatar Angie Byron
Browse files

Issue #1772708 by alexpott, sun, chx, catch, beejeebus: Fixed The...

Issue #1772708 by alexpott, sun, chx, catch, beejeebus: Fixed The configuration directories can not be outside of DRUPAL_ROOT.
parent 4efc71cf
No related branches found
No related tags found
No related merge requests found
......@@ -508,7 +508,13 @@ function config_get_config_directory($type = CONFIG_ACTIVE_DIRECTORY) {
$path = conf_path() . '/files/simpletest/' . substr($test_prefix, 10) . '/config_' . $type;
}
elseif (!empty($config_directories[$type])) {
$path = conf_path() . '/files/' . $config_directories[$type];
// Allow a configuration directory path to be outside of webroot.
if (empty($config_directories[$type]['absolute'])) {
$path = conf_path() . '/files/' . $config_directories[$type]['path'];
}
else {
$path = $config_directories[$type]['path'];
}
}
else {
throw new Exception(format_string('The configuration directory type %type does not exist.', array('%type' => $type)));
......
......@@ -266,8 +266,12 @@ function drupal_install_config_directories() {
if (empty($config_directories)) {
$settings['config_directories'] = array(
'value' => array(
CONFIG_ACTIVE_DIRECTORY => 'config/active_' . drupal_hash_base64(drupal_random_bytes(55)),
CONFIG_STAGING_DIRECTORY => 'config/staging_' . drupal_hash_base64(drupal_random_bytes(55)),
CONFIG_ACTIVE_DIRECTORY => array(
'path' => 'config/active_' . drupal_hash_base64(drupal_random_bytes(55)),
),
CONFIG_STAGING_DIRECTORY => array(
'path' => 'config/staging_' . drupal_hash_base64(drupal_random_bytes(55)),
),
),
'required' => TRUE,
);
......
......@@ -727,7 +727,7 @@ protected function prepareEnvironment() {
// @see config_get_config_directory()
$GLOBALS['config_directories'] = array();
foreach (array(CONFIG_ACTIVE_DIRECTORY, CONFIG_STAGING_DIRECTORY) as $type) {
$GLOBALS['config_directories'][$type] = 'simpletest/' . substr($this->databasePrefix, 10) . '/config_' . $type;
$GLOBALS['config_directories'][$type]['path'] = 'simpletest/' . substr($this->databasePrefix, 10) . '/config_' . $type;
}
// Reset and create a new service container.
......@@ -735,11 +735,11 @@ protected function prepareEnvironment() {
$this->configDirectories = array();
include_once DRUPAL_ROOT . '/core/includes/install.inc';
foreach ($GLOBALS['config_directories'] as $type => $path) {
foreach ($GLOBALS['config_directories'] as $type => $directory) {
if (!install_ensure_config_directory($type)) {
return FALSE;
}
$this->configDirectories[$type] = $this->originalFileDirectory . '/' . $path;
$this->configDirectories[$type] = $this->originalFileDirectory . '/' . $directory['path'];
}
// Unset globals.
......
......@@ -259,8 +259,14 @@
* Example:
* @code
* $config_directories = array(
* CONFIG_ACTIVE_DIRECTORY => '/some/directory/outside/webroot',
* CONFIG_STAGING_DIRECTORY => '/another/directory/outside/webroot',
* CONFIG_ACTIVE_DIRECTORY => array(
* 'path' => '/some/directory/outside/webroot',
* 'absolute' => TRUE,
* ),
* CONFIG_STAGING_DIRECTORY => array(
* 'path' => '/another/directory/outside/webroot',
* 'absolute' => TRUE,
* ),
* );
* @endcode
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment