public static function gdc($strPath, $booErrorRep = true)
{
$arrDirectoryContent = array();
$error = PSI_Error::singleton();
if (is_dir($strPath)) {
if ($handle = opendir($strPath)) {
while (($strFile = readdir($handle)) !== false) {
if ($strFile != "." && $strFile != "..") {
$arrDirectoryContent[] = $strFile;
}
}
closedir($handle);
} else {
if ($booErrorRep) {
$error->addError('opendir(' . $strPath . ')', 'directory can not be read by phpsysinfo');
}
}
} else {
if ($booErrorRep) {
$error->addError('is_dir(' . $strPath . ')', 'directory does not exist on your machine');
}
}
return $arrDirectoryContent;
}
/** * IDE devices * * @return void */ private function _ide() { $bufd = CommonFunctions::gdc('/proc/ide', false); foreach ($bufd as $file) { if (preg_match('/^hd/', $file)) { $dev = new HWDevice(); $dev->setName(trim($file)); if (CommonFunctions::rfts("/proc/ide/" . $file . "/media", $buf, 1)) { if (trim($buf) == 'disk') { if (CommonFunctions::rfts("/proc/ide/" . $file . "/capacity", $buf, 1, 4096, false) || CommonFunctions::rfts("/sys/block/" . $file . "/size", $buf, 1, 4096, false)) { $dev->setCapacity(trim($buf) * 512 / 1024); } } } if (CommonFunctions::rfts("/proc/ide/" . $file . "/model", $buf, 1)) { $dev->setName($dev->getName() . ": " . trim($buf)); } $this->sys->setIdeDevices($dev); } } }