Class doc for Platform

refs #5514
This commit is contained in:
Marius Hein 2014-08-28 11:13:18 +02:00
parent 9b83074cc9
commit 35d11bd145
1 changed files with 68 additions and 0 deletions

View File

@ -4,22 +4,57 @@
namespace Icinga\Application; namespace Icinga\Application;
/**
* Platform tests for icingaweb
*/
class Platform class Platform
{ {
/**
* Domain name
*
* @var string
*/
protected static $domain; protected static $domain;
/**
* Host name
*
* @var string
*/
protected static $hostname; protected static $hostname;
/**
* Fully qualified domain name
*
* @var string
*/
protected static $fqdn; protected static $fqdn;
/**
* Test of windows
*
* @return bool
*/
public static function isWindows() public static function isWindows()
{ {
return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
} }
/**
* Test of linux
*
* @return bool
*/
public static function isLinux() public static function isLinux()
{ {
return strtoupper(substr(PHP_OS, 0, 5)) === 'LINUX'; return strtoupper(substr(PHP_OS, 0, 5)) === 'LINUX';
} }
/**
* Test of CLI environment
*
* @return bool
*/
public static function isCli() public static function isCli()
{ {
if (PHP_SAPI == 'cli') { if (PHP_SAPI == 'cli') {
@ -31,6 +66,11 @@ class Platform
return false; return false;
} }
/**
* Get the hostname
*
* @return string
*/
public static function getHostname() public static function getHostname()
{ {
if (self::$hostname === null) { if (self::$hostname === null) {
@ -39,6 +79,11 @@ class Platform
return self::$hostname; return self::$hostname;
} }
/**
* Get the domain name
*
* @return string
*/
public static function getDomain() public static function getDomain()
{ {
if (self::$domain === null) { if (self::$domain === null) {
@ -47,6 +92,11 @@ class Platform
return self::$domain; return self::$domain;
} }
/**
* Get the fully qualified domain name
*
* @return string
*/
public static function getFqdn() public static function getFqdn()
{ {
if (self::$fqdn === null) { if (self::$fqdn === null) {
@ -55,6 +105,9 @@ class Platform
return self::$fqdn; return self::$fqdn;
} }
/**
* Initialize domain and host strings
*/
protected static function discoverHostname() protected static function discoverHostname()
{ {
self::$hostname = gethostname(); self::$hostname = gethostname();
@ -67,16 +120,31 @@ class Platform
} }
} }
/**
* Test of php ldap support
*
* @return bool
*/
public static function ldapAvailable() public static function ldapAvailable()
{ {
return extension_loaded('ldap'); return extension_loaded('ldap');
} }
/**
* Test of php pgsql support
*
* @return bool
*/
public static function pgsqlAvailable() public static function pgsqlAvailable()
{ {
return extension_loaded('pgsql'); return extension_loaded('pgsql');
} }
/**
* Test of php mysql support
*
* @return bool
*/
public static function mysqlAvailable() public static function mysqlAvailable()
{ {
return extension_loaded('mysql'); return extension_loaded('mysql');