Commit 23d6c544 authored by anarcat's avatar anarcat Committed by anarcat

implement a fqdn() function to replace hostname -f and uname calls

untested, should just work
parent fb2cf3e2
......@@ -43,7 +43,19 @@ function provision_is_local_host($host) {
// 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') || ($host == strtolower(php_uname('n'))) || ($host == strtolower(gethostbyaddr(gethostbyname(php_uname('n')))));
return ($host == 'localhost') || ($host == '127.0.0.1') || ($host == strtolower(php_uname('n'))) || ($host == provision_fqdn());
}
/**
* return the FQDN of the machine or provided host
*
* this replicates hostname -f, which is not portable
*/
function provision_fqdn($host = null) {
if (is_null($host)) {
$host = php_uname('n');
}
return strtolower(gethostbyaddr(gethostbyname($host)));
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment