Logo Search packages:      
Sourcecode: aegir-provision version File versions  Download package

_provision_mysql_grant_host ( db_host,

Properly guess the host part of the MySQL username based on a given database server host , web server IP and web server host.

If the database and web server are the same machine, return a localhost grant, which is a special and very common case which does not involve any dns lookups and is thus faster and more secure.

If the web server and database server are different machines, we prefer to use the IP address, which is faster and more secure because fewer lookups are done during connections.

Definition at line 265 of file provision_mysql.drush.inc.

Referenced by _provision_mysql_destroy_site_db(), and _provision_mysql_new_site_db().

  // The database hostname is localhost, not defined or on the same ip/host as the webserver.
  if (in_array($db_host, array('', 'localhost', '', $web_ip, $web_host))) {
    $grant = 'localhost';
  // if we have the web ip, use that first.
  elseif ($web_ip) {
    $grant = $web_ip;
  } else {
    $grant = $web_host;
  return $grant;

Generated by  Doxygen 1.6.0   Back to index