PageRenderTime 41ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/Provision/Config/Drupal/provision_drupal_settings_7.tpl.php

https://gitlab.com/aegir/provision
PHP | 194 lines | 112 code | 20 blank | 62 comment | 20 complexity | 3f377f9eb5adf27e16c540ebb50b7144 MD5 | raw file
  1. <?php
  2. /**
  3. * @file
  4. * Template file for a settings.php.
  5. */
  6. print '<?php' ?>
  7. /**
  8. * @file Drupal's settings.php file
  9. *
  10. * This file was automatically generated by Aegir <?php print $this->version; ?>
  11. * on <?php print date('r'); ?>.
  12. *
  13. * If it is still managed by Aegir, changes to this file may be
  14. * lost. If it is not managed by aegir, you should remove this header
  15. * to avoid further confusion.
  16. */
  17. <?php if ($subdirs_support_enabled): ?>
  18. /**
  19. * Detecting subdirectory mode
  20. */
  21. if (isset($_SERVER['SITE_SUBDIR']) && isset($_SERVER['RAW_HOST'])) {
  22. $base_url = 'http://' . $_SERVER['RAW_HOST'] . '/' . $_SERVER['SITE_SUBDIR'];
  23. $cookie_domain = "." . $_SERVER['RAW_HOST'];
  24. ini_set('session.cookie_path', '/' . $_SERVER['SITE_SUBDIR'] . '/');
  25. }
  26. <?php endif; ?>
  27. <?php if ($this->cloaked): ?>
  28. if (isset($_SERVER['db_name'])) {
  29. /**
  30. * The database credentials are stored in the Apache or Nginx vhost config
  31. * of the associated site with SetEnv (fastcgi_param in Nginx) parameters.
  32. * They are called here with $_SERVER environment variables to
  33. * prevent sensitive data from leaking to site administrators
  34. * with PHP access, that potentially might be of other sites in
  35. * Drupal's multisite set-up.
  36. * This is a security measure implemented by the Aegir project.
  37. */
  38. $databases['default']['default'] = array(
  39. 'driver' => $_SERVER['db_type'],
  40. 'database' => $_SERVER['db_name'],
  41. 'username' => $_SERVER['db_user'],
  42. 'password' => $_SERVER['db_passwd'],
  43. 'host' => $_SERVER['db_host'],
  44. /* Drupal interprets $databases['db_port'] as a string, whereas Drush sees
  45. * it as an integer. To maintain consistency, we cast it to a string. This
  46. * should probably be fixed in Drush.
  47. */
  48. 'port' => (string) $_SERVER['db_port'],
  49. <?php if ($utf8mb4_is_configurable && $utf8mb4_is_supported): ?>
  50. 'charset' => 'utf8mb4',
  51. 'collation' => 'utf8mb4_general_ci',
  52. <?php endif; ?>
  53. );
  54. $db_url['default'] = $_SERVER['db_type'] . '://' . $_SERVER['db_user'] . ':' . $_SERVER['db_passwd'] . '@' . $_SERVER['db_host'] . ':' . $_SERVER['db_port'] . '/' . $_SERVER['db_name'];
  55. }
  56. /**
  57. * Now that we used the credentials from the apache environment, we
  58. * don't need them anymore. Clear them from apache and the _SERVER
  59. * array, otherwise they show up in phpinfo() and other friendly
  60. * places.
  61. */
  62. if (function_exists('apache_setenv')) {
  63. apache_setenv('db_type', null);
  64. apache_setenv('db_user', null);
  65. apache_setenv('db_passwd', null);
  66. apache_setenv('db_host', null);
  67. apache_setenv('db_port', null);
  68. apache_setenv('db_name', null);
  69. // no idea why they are also in REDIRECT_foo, but they are
  70. apache_setenv('REDIRECT_db_type', null);
  71. apache_setenv('REDIRECT_db_user', null);
  72. apache_setenv('REDIRECT_db_passwd', null);
  73. apache_setenv('REDIRECT_db_host', null);
  74. apache_setenv('REDIRECT_db_port', null);
  75. apache_setenv('REDIRECT_db_name', null);
  76. }
  77. unset($_SERVER['db_type']);
  78. unset($_SERVER['db_user']);
  79. unset($_SERVER['db_passwd']);
  80. unset($_SERVER['db_host']);
  81. unset($_SERVER['db_port']);
  82. unset($_SERVER['db_name']);
  83. unset($_SERVER['REDIRECT_db_type']);
  84. unset($_SERVER['REDIRECT_db_user']);
  85. unset($_SERVER['REDIRECT_db_passwd']);
  86. unset($_SERVER['REDIRECT_db_host']);
  87. unset($_SERVER['REDIRECT_db_port']);
  88. unset($_SERVER['REDIRECT_db_name']);
  89. <?php else: ?>
  90. $databases['default']['default'] = array(
  91. 'driver' => "<?php print $this->creds['db_type']; ?>",
  92. 'database' => "<?php print $this->creds['db_name']; ?>",
  93. 'username' => "<?php print $this->creds['db_user']; ?>",
  94. 'password' => "<?php print $this->creds['db_passwd']; ?>",
  95. 'host' => "<?php print $this->creds['db_host']; ?>",
  96. 'port' => "<?php print $this->creds['db_port']; ?>",
  97. );
  98. $db_url['default'] = "<?php print strtr("%db_type://%db_user:%db_passwd@%db_host:%db_port/%db_name", array(
  99. '%db_type' => $this->creds['db_type'],
  100. '%db_user' => $this->creds['db_user'],
  101. '%db_passwd' => $this->creds['db_passwd'],
  102. '%db_host' => $this->creds['db_host'],
  103. '%db_port' => $this->creds['db_port'],
  104. '%db_name' => $this->creds['db_name'])); ?>";
  105. <?php endif; ?>
  106. $profile = "<?php print $this->profile ?>";
  107. $install_profile = "<?php print $this->profile ?>";
  108. /**
  109. * PHP settings:
  110. *
  111. * To see what PHP settings are possible, including whether they can
  112. * be set at runtime (ie., when ini_set() occurs), read the PHP
  113. * documentation at http://www.php.net/manual/en/ini.php#ini.list
  114. * and take a look at the .htaccess file to see which non-runtime
  115. * settings are used there. Settings defined here should not be
  116. * duplicated there so as to avoid conflict issues.
  117. */
  118. ini_set('session.gc_probability', 1);
  119. ini_set('session.gc_divisor', 100);
  120. ini_set('session.gc_maxlifetime', 200000);
  121. ini_set('session.cookie_lifetime', 2000000);
  122. /**
  123. * Set the umask so that new directories created by Drupal have the correct permissions
  124. */
  125. umask(0002);
  126. global $conf;
  127. $conf['install_profile'] = '<?php print $this->profile ?>';
  128. $conf['file_public_path'] = 'sites/<?php print $this->uri ?>/files';
  129. $conf['file_private_path'] = 'sites/<?php print $this->uri ?>/private/files';
  130. $conf['file_temporary_path'] = 'sites/<?php print $this->uri ?>/private/temp';
  131. $drupal_hash_salt = '';
  132. $conf['clean_url'] = 1;
  133. $conf['aegir_api'] = <?php print $this->api_version ? $this->api_version : 0 ?>;
  134. $conf['allow_authorize_operations'] = FALSE;
  135. // Nginx tries to cache the admin_menu if we don't do this.
  136. $conf['admin_menu_cache_client'] = FALSE;
  137. <?php if (!$this->site_enabled) : ?>
  138. <?php if (isset($maintenance_var_new)): ?>
  139. $conf['maintenance_mode'] = 1;
  140. <?php else: ?>
  141. $conf['site_offline'] = 1;
  142. <?php endif; ?>
  143. <?php endif; ?>
  144. /**
  145. * Set the Syslog identity to the site name so it's not always "drupal".
  146. */
  147. $conf['syslog_identity'] = '<?php print $this->uri ?>';
  148. /**
  149. * If external request was HTTPS but internal request is HTTP, set $_SERVER['HTTPS'] so Drupal detects the right scheme.
  150. */
  151. if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && isset($_SERVER['REQUEST_SCHEME'])) {
  152. if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' && $_SERVER["REQUEST_SCHEME"] == 'http') {
  153. $_SERVER['HTTPS'] = 'on';
  154. }
  155. }
  156. <?php print $extra_config; ?>
  157. # Additional host wide configuration settings. Useful for safely specifying configuration settings.
  158. if (is_readable('<?php print $this->platform->server->include_path ?>/global.inc')) {
  159. include_once('<?php print $this->platform->server->include_path ?>/global.inc');
  160. }
  161. # Additional platform wide configuration settings.
  162. <?php $this->platform->root = provision_auto_fix_platform_root($this->platform->root); ?>
  163. if (is_readable('<?php print $this->platform->root ?>/sites/all/platform.settings.php')) {
  164. include_once('<?php print $this->platform->root ?>/sites/all/platform.settings.php');
  165. }
  166. # Additional platform wide configuration settings.
  167. if (is_readable('<?php print $this->platform->root ?>/sites/all/settings.php')) {
  168. include_once('<?php print $this->platform->root ?>/sites/all/settings.php');
  169. }
  170. # Additional site configuration settings.
  171. if (is_readable('<?php print $this->site_path ?>/local.settings.php')) {
  172. include_once('<?php print $this->site_path ?>/local.settings.php');
  173. }