function provision_is_local_host

7.x-3.x 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.


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

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.


./, line 118
The provisioning framework API.


function provision_is_local_host($host) {
  $host = strtolower($host);
  // In order for this to work right, you must use 'localhost' or ''
  // 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 == '') || (gethostbyname($host) == '') || (gethostbyname($host) == '') || // common setting on
  // ubuntu and friends
  ($host == strtolower(php_uname('n'))) || ($host == provision_fqdn());