12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- namespace PhpMyAdmin;
- use PhpMyAdmin\SysInfoBase;
- class SysInfo
- {
- const MEMORY_REGEXP = '/^(MemTotal|MemFree|Cached|Buffers|SwapCached|SwapTotal|SwapFree):\s+(.*)\s*kB/im';
-
- public static function getOs($php_os = PHP_OS)
- {
-
- $unix_like = array('FreeBSD', 'DragonFly');
- if (in_array($php_os, $unix_like)) {
- $php_os = 'Linux';
- }
- return ucfirst($php_os);
- }
-
- public static function get()
- {
- $php_os = self::getOs();
- $supported = array('Linux', 'WINNT', 'SunOS');
- if (in_array($php_os, $supported)) {
- $class_name = 'PhpMyAdmin\SysInfo' . $php_os;
-
- $ret = new $class_name();
- if ($ret->supported()) {
- return $ret;
- }
- }
- return new SysInfoBase();
- }
- }
|