2015-08-18 00:06:59 +00:00
|
|
|
<?php
|
|
|
|
|
2015-10-08 02:56:35 +00:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Pantheon configuration file.
|
|
|
|
*
|
2015-10-08 18:09:31 +00:00
|
|
|
* IMPORTANT NOTE:
|
2015-10-08 02:56:35 +00:00
|
|
|
* Do not modify this file. This file is maintained by Pantheon.
|
|
|
|
*
|
|
|
|
* Site-specific modifications belong in settings.php, not this file. This file
|
2015-10-08 18:09:31 +00:00
|
|
|
* may change in future releases and modifications would cause conflicts when
|
2015-10-08 02:56:35 +00:00
|
|
|
* attempting to apply upstream updates.
|
|
|
|
*/
|
|
|
|
|
2015-12-01 19:30:46 +00:00
|
|
|
/**
|
|
|
|
* Version of Pantheon files.
|
|
|
|
*
|
|
|
|
* This is a monotonically-increasing sequence number that is
|
|
|
|
* incremented whenever a change is made to any Pantheon file.
|
|
|
|
* Not changed if Drupal core is updated without any change to
|
|
|
|
* any Pantheon file.
|
|
|
|
*
|
|
|
|
* The Pantheon version is included in the git tag only if a
|
|
|
|
* release is made that includes changes to Pantheon files, but
|
|
|
|
* not to any Drupal files.
|
|
|
|
*/
|
2015-12-01 23:06:24 +00:00
|
|
|
if (!defined("PANTHEON_VERSION")) {
|
2016-10-06 22:16:20 +00:00
|
|
|
define("PANTHEON_VERSION", "3");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Determine whether this is a preproduction or production environment, and
|
|
|
|
* then load the pantheon services.yml file. This file should be named either
|
|
|
|
* 'pantheon-production-services.yml' (for 'live' or 'test' environments)
|
|
|
|
* 'pantheon-preproduction-services.yml' (for 'dev' or multidev environments).
|
|
|
|
*/
|
|
|
|
$pantheon_services_file = __DIR__ . '/services.pantheon.preproduction.yml';
|
|
|
|
if (
|
|
|
|
isset($_ENV['PANTHEON_ENVIRONMENT']) &&
|
|
|
|
( ($_ENV['PANTHEON_ENVIRONMENT'] == 'live') || ($_ENV['PANTHEON_ENVIRONMENT'] == 'test') )
|
|
|
|
) {
|
|
|
|
$pantheon_services_file = __DIR__ . '/services.pantheon.production.yml';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (file_exists($pantheon_services_file)) {
|
|
|
|
$settings['container_yamls'][] = $pantheon_services_file;
|
2015-12-01 23:06:24 +00:00
|
|
|
}
|
2015-12-01 19:30:46 +00:00
|
|
|
|
2015-10-08 18:09:31 +00:00
|
|
|
/**
|
|
|
|
* Set the default location for the 'private' directory. Note
|
|
|
|
* that this location is protected when running on the Pantheon
|
|
|
|
* environment, but may be exposed if you migrate your site to
|
|
|
|
* another environment.
|
|
|
|
*/
|
|
|
|
$settings['file_private_path'] = 'sites/default/files/private';
|
|
|
|
|
2015-09-18 20:47:50 +00:00
|
|
|
// Check to see if we are serving an installer page.
|
2015-09-19 23:33:21 +00:00
|
|
|
$is_installer_url = (strpos($_SERVER['SCRIPT_NAME'], '/core/install.php') === 0);
|
2015-09-18 20:47:50 +00:00
|
|
|
|
2015-08-18 00:06:59 +00:00
|
|
|
/**
|
|
|
|
* Add the Drupal 8 CMI Directory Information directly in settings.php to make sure
|
|
|
|
* Drupal knows all about that.
|
|
|
|
*
|
|
|
|
* Issue: https://github.com/pantheon-systems/drops-8/issues/2
|
|
|
|
*
|
|
|
|
* IMPORTANT SECURITY NOTE: The configuration paths set up
|
|
|
|
* below are secure when running your site on Pantheon. If you
|
|
|
|
* migrate your site to another environment on the public internet,
|
|
|
|
* you should relocate these locations. See "After Installation"
|
|
|
|
* at https://www.drupal.org/node/2431247
|
|
|
|
*
|
|
|
|
*/
|
2015-09-18 20:47:50 +00:00
|
|
|
if ($is_installer_url) {
|
2015-08-18 00:06:59 +00:00
|
|
|
$config_directories = array(
|
2015-10-08 18:40:12 +00:00
|
|
|
CONFIG_SYNC_DIRECTORY => 'sites/default/files',
|
2015-08-18 00:06:59 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$config_directories = array(
|
2015-10-08 18:40:12 +00:00
|
|
|
CONFIG_SYNC_DIRECTORY => 'sites/default/config',
|
2015-08-18 00:06:59 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allow Drupal 8 to Cleanly Redirect to Install.php For New Sites.
|
|
|
|
*
|
|
|
|
* Issue: https://github.com/pantheon-systems/drops-8/issues/3
|
|
|
|
*
|
|
|
|
* c.f. https://github.com/pantheon-systems/drops-8/pull/53
|
|
|
|
*
|
|
|
|
*/
|
2015-09-18 20:47:50 +00:00
|
|
|
if (
|
|
|
|
isset($_ENV['PANTHEON_ENVIRONMENT']) &&
|
|
|
|
!$is_installer_url &&
|
2015-11-19 15:04:44 +00:00
|
|
|
(isset($_SERVER['PANTHEON_DATABASE_STATE']) && ($_SERVER['PANTHEON_DATABASE_STATE'] == 'empty')) &&
|
2015-09-18 20:47:50 +00:00
|
|
|
(empty($GLOBALS['install_state'])) &&
|
|
|
|
(php_sapi_name() != "cli")
|
|
|
|
) {
|
2015-08-26 22:28:22 +00:00
|
|
|
include_once __DIR__ . '/../../core/includes/install.core.inc';
|
2015-08-18 00:06:59 +00:00
|
|
|
include_once __DIR__ . '/../../core/includes/install.inc';
|
|
|
|
install_goto('core/install.php');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Override the $databases variable to pass the correct Database credentials
|
|
|
|
* directly from Pantheon to Drupal.
|
|
|
|
*
|
|
|
|
* Issue: https://github.com/pantheon-systems/drops-8/issues/8
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
if (isset($_SERVER['PRESSFLOW_SETTINGS'])) {
|
|
|
|
$pressflow_settings = json_decode($_SERVER['PRESSFLOW_SETTINGS'], TRUE);
|
|
|
|
foreach ($pressflow_settings as $key => $value) {
|
|
|
|
// One level of depth should be enough for $conf and $database.
|
|
|
|
if ($key == 'conf') {
|
|
|
|
foreach($value as $conf_key => $conf_value) {
|
|
|
|
$conf[$conf_key] = $conf_value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elseif ($key == 'databases') {
|
|
|
|
// Protect default configuration but allow the specification of
|
|
|
|
// additional databases. Also, allows fun things with 'prefix' if they
|
|
|
|
// want to try multisite.
|
|
|
|
if (!isset($databases) || !is_array($databases)) {
|
|
|
|
$databases = array();
|
|
|
|
}
|
|
|
|
$databases = array_replace_recursive($databases, $value);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$$key = $value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle Hash Salt Value from Drupal
|
|
|
|
*
|
|
|
|
* Issue: https://github.com/pantheon-systems/drops-8/issues/10
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
if (isset($_ENV['PANTHEON_ENVIRONMENT'])) {
|
|
|
|
$settings['hash_salt'] = $_ENV['DRUPAL_HASH_SALT'];
|
|
|
|
}
|
|
|
|
|
2015-12-01 18:12:41 +00:00
|
|
|
/**
|
|
|
|
* Define appropriate location for tmp directory
|
|
|
|
*
|
|
|
|
* Issue: https://github.com/pantheon-systems/drops-8/issues/114
|
|
|
|
*
|
|
|
|
*/
|
2015-12-01 23:00:39 +00:00
|
|
|
if (isset($_ENV['PANTHEON_ENVIRONMENT'])) {
|
|
|
|
$config['system.file']['path']['temporary'] = $_SERVER['HOME'] .'/tmp';
|
2015-12-01 18:12:41 +00:00
|
|
|
}
|
|
|
|
|
2015-08-18 00:06:59 +00:00
|
|
|
|
2016-10-06 22:16:20 +00:00
|
|
|
/**
|
|
|
|
* The default list of directories that will be ignored by Drupal's file API.
|
|
|
|
*
|
|
|
|
* By default ignore node_modules and bower_components folders to avoid issues
|
|
|
|
* with common frontend tools and recursive scanning of directories looking for
|
|
|
|
* extensions.
|
|
|
|
*
|
|
|
|
* @see file_scan_directory()
|
|
|
|
* @see \Drupal\Core\Extension\ExtensionDiscovery::scanDirectory()
|
|
|
|
*/
|
|
|
|
if (empty($settings['file_scan_ignore_directories'])) {
|
|
|
|
$settings['file_scan_ignore_directories'] = [
|
|
|
|
'node_modules',
|
|
|
|
'bower_components',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|