00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 $__dir = realpath(dirname(__FILE__)."/../../");
00022 require_once "$__dir/platform.php";
00023
00024 class ProgramCheck extends Check
00025 {
00030 var $programs;
00031 var $path;
00032
00033 function ProgramCheck($path = null)
00034 {
00035 $this->path = $path;
00036 }
00037
00043 function Action()
00044 {
00045
00046
00047 if (!is_null($this->path))
00048 {
00049 foreach ($this->programs as $program)
00050 {
00051 if (is_executable($this->path."/$program"))
00052 {
00053 $this->found[] = $program;
00054 }
00055 else
00056 {
00057 $this->missing[] = $program;
00058 }
00059 }
00060 }
00061 else
00062 {
00063
00064 foreach ($this->programs as $program)
00065 {
00066 $pp = fs_find_executable($program);
00067 if ($pp != "")
00068 {
00069 $this->found[] = $pp;
00070 }
00071 else
00072 {
00073 $this->missing[] = $program;
00074 }
00075 }
00076 }
00077
00078 $found = count($this->founded);
00079 $notfound = count($this->missing);
00080 $expect = count($this->programs);
00081
00082
00083 if ($found > $this->warn_level)
00084 {
00085 $this->status = STATUS_PASSED;
00086 }
00087 elseif ($found > $this->err_level)
00088 {
00089 $this->status = STATUS_WARNING;
00090 }
00091 elseif ($this->serious)
00092 {
00093 $this->status = STATUS_SERIOUS_ERROR;
00094 }
00095 else
00096 {
00097 $this->status = STATUS_ERROR;
00098 }
00099 }
00100
00108 function Result()
00109 {
00110 return $this->missing;
00111 }
00112 }
00113 ?>