mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-29 16:54:04 +02:00
parent
8fcf21a6b8
commit
5b3d549e5c
@ -30,6 +30,16 @@ class Platform
|
|||||||
*/
|
*/
|
||||||
protected static $fqdn;
|
protected static $fqdn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the operating system's name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function getOperatingSystemName()
|
||||||
|
{
|
||||||
|
return php_uname('s');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of windows
|
* Test of windows
|
||||||
*
|
*
|
||||||
@ -37,7 +47,7 @@ class Platform
|
|||||||
*/
|
*/
|
||||||
public static function isWindows()
|
public static function isWindows()
|
||||||
{
|
{
|
||||||
return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
|
return strtoupper(substr(self::getOperatingSystemName(), 0, 3)) === 'WIN';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,7 +57,7 @@ class Platform
|
|||||||
*/
|
*/
|
||||||
public static function isLinux()
|
public static function isLinux()
|
||||||
{
|
{
|
||||||
return strtoupper(substr(PHP_OS, 0, 5)) === 'LINUX';
|
return strtoupper(substr(self::getOperatingSystemName(), 0, 5)) === 'LINUX';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -120,6 +130,16 @@ class Platform
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the version of PHP
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function getPhpVersion()
|
||||||
|
{
|
||||||
|
return phpversion();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for php extension
|
* Test for php extension
|
||||||
*
|
*
|
||||||
@ -131,4 +151,32 @@ class Platform
|
|||||||
{
|
{
|
||||||
return extension_loaded($extensionName);
|
return extension_loaded($extensionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the value for the given PHP configuration option
|
||||||
|
*
|
||||||
|
* @param string $option The option name for which to return the value
|
||||||
|
*
|
||||||
|
* @return string|false
|
||||||
|
*/
|
||||||
|
public static function getPhpConfig($option)
|
||||||
|
{
|
||||||
|
return ini_get($option);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return whether the given Zend framework class exists
|
||||||
|
*
|
||||||
|
* @param string $name The name of the class to check
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function zendClassExists($name)
|
||||||
|
{
|
||||||
|
if (class_exists($name)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (@include str_replace('_', '/', $name) . '.php') !== false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user