diff --git a/library/Icinga/Application/Platform.php b/library/Icinga/Application/Platform.php index 1ca738741..179e2578c 100644 --- a/library/Icinga/Application/Platform.php +++ b/library/Icinga/Application/Platform.php @@ -30,6 +30,16 @@ class Platform */ protected static $fqdn; + /** + * Return the operating system's name + * + * @return string + */ + public static function getOperatingSystemName() + { + return php_uname('s'); + } + /** * Test of windows * @@ -37,7 +47,7 @@ class Platform */ 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() { - 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 * @@ -131,4 +151,32 @@ class Platform { 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; + } }