You've already forked phpmyadmin
mirror of
https://github.com/phpmyadmin/phpmyadmin.git
synced 2026-10-28 07:41:55 +03:00
Check if we can access system information before using it
This commit is contained in:
@@ -42,7 +42,10 @@ function PMA_getSysInfo()
|
||||
$sysinfo = array();
|
||||
|
||||
if (in_array($php_os, $supported)) {
|
||||
return eval("return new PMA_sysinfo" . $php_os . "();");
|
||||
$ret = eval("return new PMA_sysinfo" . $php_os . "();");
|
||||
if ($ret->supported()) {
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
return new PMA_Sysinfo_Default;
|
||||
@@ -77,6 +80,11 @@ class PMA_sysinfoWinnt
|
||||
return array('loadavg' => $sum / count($buffer));
|
||||
}
|
||||
|
||||
function supported()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private function _getWMI($strClass, $strValue = array())
|
||||
{
|
||||
$arrData = array();
|
||||
@@ -148,6 +156,11 @@ class PMA_sysinfoLinux
|
||||
);
|
||||
}
|
||||
|
||||
function supported()
|
||||
{
|
||||
return is_readable('/proc/meminfo') && is_readable('/proc/stat');
|
||||
}
|
||||
|
||||
function memory()
|
||||
{
|
||||
preg_match_all(
|
||||
@@ -188,6 +201,11 @@ class PMA_sysinfoSunos
|
||||
return array('loadavg' => $load1);
|
||||
}
|
||||
|
||||
function supported()
|
||||
{
|
||||
return is_readable('/proc/meminfo');
|
||||
}
|
||||
|
||||
public function memory()
|
||||
{
|
||||
preg_match_all(
|
||||
@@ -221,4 +239,9 @@ class PMA_sysinfoDefault
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function supported()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user