/web/sites/default/OLD_settings.php

https://github.com/MickeA/socialanimal.se · PHP · 111 lines · 69 code · 18 blank · 24 comment · 17 complexity · b9d9b86f54c9a860a2eec858b9f338fc MD5 · raw file

  1. <?php
  2. /**
  3. * @file
  4. * Platform.sh example settings.php file for Drupal 8.
  5. */
  6. // Install with the 'standard' profile for this example.
  7. $settings['install_profile'] = 'minimal';
  8. // You should modify the hash_salt so that it is specific to your application.
  9. $settings['hash_salt'] = '7026414f6c20cd65256767cd1a149af8';
  10. /**
  11. * Default Drupal 8 settings.
  12. *
  13. * These are already explained with detailed comments in Drupal's
  14. * default.settings.php file.
  15. *
  16. * See https://api.drupal.org/api/drupal/sites!default!default.settings.php/8
  17. */
  18. $databases = array();
  19. $config_directories = array();
  20. $settings['update_free_access'] = FALSE;
  21. $settings['container_yamls'][] = __DIR__ . '/services.yml';
  22. // Override paths for config files in Platform.sh.
  23. // Define a config sync directory outside the document root.
  24. if (isset($_ENV['PLATFORM_APP_DIR'])) {
  25. $config_directories[CONFIG_SYNC_DIRECTORY] = $_ENV['PLATFORM_APP_DIR'] . '/staging';
  26. }
  27. // Set trusted hosts based on real Platform.sh routes.
  28. if (isset($_ENV['PLATFORM_ROUTES'])) {
  29. $routes = json_decode(base64_decode($_ENV['PLATFORM_ROUTES']), TRUE);
  30. $settings['trusted_host_patterns'] = array();
  31. foreach ($routes as $url => $route) {
  32. $host = parse_url($url, PHP_URL_HOST);
  33. if ($host !== FALSE && $route['type'] == 'upstream' && $route['upstream'] == $_ENV['PLATFORM_APPLICATION_NAME']) {
  34. $settings['trusted_host_patterns'][] = '^' . preg_quote($host) . '$';
  35. }
  36. }
  37. $settings['trusted_host_patterns'] = array_unique($settings['trusted_host_patterns']);
  38. }
  39. // Because we're using the Composer toolstack, we replicate the necessary local
  40. // settings file for Drupal here.
  41. if (getenv("PLATFORM_RELATIONSHIPS")) {
  42. // Configure relationships.
  43. $relationships = json_decode(base64_decode($_ENV['PLATFORM_RELATIONSHIPS']), TRUE);
  44. if (empty($databases['default']['default'])) {
  45. foreach ($relationships['database'] as $endpoint) {
  46. $database = array(
  47. 'driver' => $endpoint['scheme'],
  48. 'database' => $endpoint['path'],
  49. 'username' => $endpoint['username'],
  50. 'password' => $endpoint['password'],
  51. 'host' => $endpoint['host'],
  52. );
  53. if (!empty($endpoint['query']['compression'])) {
  54. $database['pdo'][PDO::MYSQL_ATTR_COMPRESS] = TRUE;
  55. }
  56. if (!empty($endpoint['query']['is_master'])) {
  57. $databases['default']['default'] = $database;
  58. }
  59. else {
  60. $databases['default']['slave'][] = $database;
  61. }
  62. }
  63. }
  64. $routes = json_decode(base64_decode($_ENV['PLATFORM_ROUTES']), TRUE);
  65. if (!isset($conf['file_private_path'])) {
  66. if(!$application_home = getenv('PLATFORM_APP_DIR')) {
  67. $application_home = '/app';
  68. }
  69. $conf['file_private_path'] = $application_home . '/private';
  70. $conf['file_temporary_path'] = $application_home . '/tmp';
  71. }
  72. $variables = json_decode(base64_decode($_ENV['PLATFORM_VARIABLES']), TRUE);
  73. $prefix_len = strlen('drupal:');
  74. foreach ($variables as $name => $value) {
  75. if (substr($name, 0, $prefix_len) == 'drupal:') {
  76. $conf[substr($name, $prefix_len)] = $value;
  77. }
  78. }
  79. // Default PHP settings.
  80. ini_set('session.gc_probability', 1);
  81. ini_set('session.gc_divisor', 100);
  82. ini_set('session.gc_maxlifetime', 200000);
  83. ini_set('session.cookie_lifetime', 2000000);
  84. ini_set('pcre.backtrack_limit', 200000);
  85. ini_set('pcre.recursion_limit', 200000);
  86. }
  87. // Force Drupal not to check for HTTP connectivity until we fixed the self test.
  88. $conf['drupal_http_request_fails'] = FALSE;
  89. // Local settings. These allow local development environments to use their own
  90. // database connections rather than the Platform-only settings above.
  91. if (file_exists(__DIR__ . '/settings.local.php')) {
  92. include __DIR__ . '/settings.local.php';
  93. }