Advertisement
Guest User

Untitled

a guest
Jul 1st, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.17 KB | None | 0 0
  1. if (isset($_SERVER['db_name'])) {
  2.   /**
  3.    * The database credentials are stored in the Apache or Nginx vhost config
  4.    * of the associated site with SetEnv (fastcgi_param in Nginx) parameters.
  5.    * They are called here with $_SERVER environment variables to
  6.    * prevent sensitive data from leaking to site administrators
  7.    * with PHP access, that potentially might be of other sites in
  8.    * Drupal's multisite set-up.
  9.    * This is a security measure implemented by the Aegir project.
  10.    */
  11.   $databases['default']['default'] = array(
  12.     'driver' => $_SERVER['db_type'],
  13.     'database' => $_SERVER['db_name'],
  14.     'username' => $_SERVER['db_user'],
  15.     'password' => $_SERVER['db_passwd'],
  16.     'host' => $_SERVER['db_host'],
  17.     /* Drupal interprets $databases['db_port'] as a string, whereas Drush sees
  18.      * it as an integer. To maintain consistency, we cast it to a string. This
  19.      * should probably be fixed in Drush.
  20.      */
  21.     'port' => (string) $_SERVER['db_port'],
  22.   );
  23.   $db_url['default'] = $_SERVER['db_type'] . '://' . $_SERVER['db_user'] . ':' . $_SERVER['db_passwd'] . '@' . $_SERVER['db_host'] . ':' . $_SERVER['db_port'] . '/' . $_SERVER['db_name'];
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement