PHP 클래스 CommonFunctions, phpsysinfo

파일 보기 프로젝트 열기: phpsysinfo/phpsysinfo 1 사용 예제들

공개 메소드들

메소드 설명
checkForExtensions ( array $arrExt = [] ) : void Check for needed php extensions
executeProgram ( string $strProgramname, string $strArgs, &$strBuffer, boolean $booErrorRep = true ) : boolean Execute a system program. return a trim()'d result.
fileexists ( string $strFileName ) : boolean file exists
gdc ( string $strPath, boolean $booErrorRep = true ) : array reads a directory and return the name of the files and directorys in it
getPlugins ( ) : array get all configured plugins from phpsysinfo.ini (file must be included and processed before calling this function)
getWMI ( $wmi, string $strClass, array $strValue = [] ) : array function for getting a list of values in the specified context optionally filter this list, based on the list from third parameter
rfts ( string $strFileName, &$strRet, integer $intLines, integer $intBytes = 4096, boolean $booErrorRep = true ) : boolean read a file and return the content as a string

비공개 메소드들

메소드 설명
_findProgram ( string $strProgram ) : string Find a system program, do also path checking when not running on WINNT on WINNT we simply return the name with the exe extension to the program name
_parse_log_file ( $string )
_timeoutfgets ( array $pipes, &$out, &$err, integer $timeout = 30 ) : void get the content of stdout/stderr with the option to set a timeout for reading

메소드 상세

checkForExtensions() 공개 정적인 메소드

We need that extensions for almost everything This function will return a hard coded XML string (with headers) if the SimpleXML extension isn't loaded. Then it will terminate the script. See bug #1787137
public static checkForExtensions ( array $arrExt = [] ) : void
$arrExt array additional extensions for which a check should run
리턴 void

executeProgram() 공개 정적인 메소드

does very crude pipe checking. you need ' | ' for it to work ie $program = CommonFunctions::executeProgram('netstat', '-anp | grep LIST'); NOT $program = CommonFunctions::executeProgram('netstat', '-anp|grep LIST');
public static executeProgram ( string $strProgramname, string $strArgs, &$strBuffer, boolean $booErrorRep = true ) : boolean
$strProgramname string name of the program
$strArgs string arguments to the program
$booErrorRep boolean en- or disables the reporting of errors which should be logged
리턴 boolean command successfull or not

fileexists() 공개 정적인 메소드

file exists
public static fileexists ( string $strFileName ) : boolean
$strFileName string name of the file which should be check
리턴 boolean command successfull or not

gdc() 공개 정적인 메소드

reads a directory and return the name of the files and directorys in it
public static gdc ( string $strPath, boolean $booErrorRep = true ) : array
$strPath string path of the directory which should be read
$booErrorRep boolean en- or disables the reporting of errors which should be logged
리턴 array content of the directory excluding . and ..

getPlugins() 공개 정적인 메소드

get all configured plugins from phpsysinfo.ini (file must be included and processed before calling this function)
public static getPlugins ( ) : array
리턴 array

getWMI() 공개 정적인 메소드

function for getting a list of values in the specified context optionally filter this list, based on the list from third parameter
public static getWMI ( $wmi, string $strClass, array $strValue = [] ) : array
$wmi holds the COM object that we pull the WMI data from
$strClass string name of the class where the values are stored
$strValue array filter out only needed values, if not set all values of the class are returned
리턴 array content of the class stored in an array

rfts() 공개 정적인 메소드

read a file and return the content as a string
public static rfts ( string $strFileName, &$strRet, integer $intLines, integer $intBytes = 4096, boolean $booErrorRep = true ) : boolean
$strFileName string name of the file which should be read
$intLines integer control how many lines should be read
$intBytes integer control how many bytes of each line should be read
$booErrorRep boolean en- or disables the reporting of errors which should be logged
리턴 boolean command successfull or not