PHP Класс CommonFunctions, phpsysinfo

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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