function detect_kernels() { $unix = new unix(); if (!$GLOBALS["VERBOSE"]) { if (is_file("/usr/share/artica-postfix/ressources/logs/kernel.lst")) { if ($unix->file_time_min("/usr/share/artica-postfix/ressources/logs/kernel.lst") < 360) { die; } } } $users = new usersMenus(); if ($users->LinuxDistriCode != "DEBIAN" && $users->LinuxDistriCode != "UBUNTU") { die; } $unix = new unix(); $apt_cache = $unix->find_program("apt-cache"); if ($apt_cache == null) { echo "Could not find apt-cache\n"; die; } if (system_is_overloaded(basename(__FILE__))) { $unix->send_email_events("apt-cache aborted, system is overloaded..", "will restart analyzis in next cycle", "system"); die; } echo "{$apt_cache} search linux-image\n"; exec("{$apt_cache} search linux-image", $results); while (list($num, $val) = each($results)) { if (preg_match("#linux-image-([0-9\\.]+)-([0-9]+)-(.+?)\\s+-\\s+(.+?)\$#", $val, $re)) { $array["DPKG"][] = array("VERSION" => $re[1], "BUILD" => $re[2], "ARCH" => $re[3], "INFOS" => $re[4], "PACKAGE" => "linux-image-{$re[1]}-{$re[2]}-{$re[3]}", "FULL_VERSION" => "{$re[1]}-{$re[2]}-{$re[3]}"); } } $array["INFOS"] = CpuFamilyInfos(); @file_put_contents("/usr/share/artica-postfix/ressources/logs/kernel.lst", base64_encode(serialize($array))); }
function detect_kernels(){ $unix=new unix(); if(!$GLOBALS["VERBOSE"]){ if(is_file("/usr/share/artica-postfix/ressources/logs/kernel.lst")){ if($unix->file_time_min("/usr/share/artica-postfix/ressources/logs/kernel.lst")<360){die();} }} $users=new usersMenus(); if(($users->LinuxDistriCode<>"DEBIAN") && ($users->LinuxDistriCode<>"UBUNTU")){die();} $unix=new unix(); $apt_cache=$unix->find_program("apt-cache"); if($apt_cache==null){ echo "Could not find apt-cache\n"; die(); } echo "$apt_cache search linux-image\n"; exec("$apt_cache search linux-image",$results); while (list ($num, $val) = each ($results) ){ if(preg_match("#linux-image-([0-9\.]+)-([0-9]+)-(.+?)\s+-\s+(.+?)$#",$val,$re)){ $array["DPKG"][]=array("VERSION"=>$re[1],"BUILD"=>$re[2],"ARCH"=>$re[3],"INFOS"=>$re[4], "PACKAGE"=>"linux-image-{$re[1]}-{$re[2]}-{$re[3]}", "FULL_VERSION"=>"{$re[1]}-{$re[2]}-{$re[3]}" ); } } $array["INFOS"]=CpuFamilyInfos(); @file_put_contents("/usr/share/artica-postfix/ressources/logs/kernel.lst",base64_encode(serialize($array))); }