function provision_is_local_host

7.x-3.x provision.inc provision_is_local_host($host)

Make a determination whether or not the given host is local or not.

We needed to fork this from drush core to handle the case sensitivity in host names.

Parameters

host: A hostname, 'localhost' or '127.0.0.1'.

Return value

True if the host is local.

Related topics

3 calls to provision_is_local_host()
Provision_Context_server::fetch in Provision/Context/server.php
If necessary, fetch file from a remote server.
Provision_Context_server::shell_exec in Provision/Context/server.php
Execute $command on this server, using SSH if necessary.
Provision_Context_server::sync in Provision/Context/server.php
If necessary, sync files out to a remote server.

File

./provision.inc, line 118
The provisioning framework API.

Code

function provision_is_local_host($host) {
  $host = strtolower($host);
  // In order for this to work right, you must use 'localhost' or '127.0.0.1'
  // or the machine returned by 'uname -n' for your 'remote-host' entry in
  // your site alias.  Note that sometimes 'uname -n' does not return the
  // correct value.  To fix it, put the correct hostname in /etc/hostname
  // and then run 'hostname -F /etc/hostname'.
  return ($host == 'localhost') || ($host == '127.0.0.1') || (gethostbyname($host) == '127.0.0.1') || (gethostbyname($host) == '127.0.1.1') || // common setting on
  // ubuntu and friends
  ($host == strtolower(php_uname('n'))) || ($host == provision_fqdn());
}