[Phpsysinfo-subversion] SF.net SVN: phpsysinfo:[119] plugins/psstatus
Brought to you by:
namiltd
From: <Big...@us...> - 2009-01-22 09:12:59
|
Revision: 119 http://phpsysinfo.svn.sourceforge.net/phpsysinfo/?rev=119&view=rev Author: BigMichi1 Date: 2009-01-22 09:12:53 +0000 (Thu, 22 Jan 2009) Log Message: ----------- added winnt support Modified Paths: -------------- plugins/psstatus/class.psstatus.inc.php plugins/psstatus/psstatus.config.php Modified: plugins/psstatus/class.psstatus.inc.php =================================================================== --- plugins/psstatus/class.psstatus.inc.php 2009-01-19 18:54:40 UTC (rev 118) +++ plugins/psstatus/class.psstatus.inc.php 2009-01-22 09:12:53 UTC (rev 119) @@ -49,10 +49,20 @@ parent :: __construct(__CLASS__); switch(PSI_PLUGIN_PSSTATUS_ACCESS) { case 'command': - $processes = preg_split("/[\s]?,[\s]?/", PSI_PLUGIN_PSSTATUS_PROCESSES, -1, PREG_SPLIT_NO_EMPTY); - foreach($processes as $process) { - execute_program("pidof", "-s " . $process, $buffer, $this->debug); - $this->filecontent[] = array($process, trim($buffer)); + if(PHP_OS == 'WINNT') { + $objLocator = new COM("WbemScripting.SWbemLocator"); + $wmi = $objLocator->ConnectServer(); + $process_wmi = $wmi->InstancesOf('Win32_Process'); + foreach($process_wmi as $process) + { + $this->filecontent[] = array(trim($process->Caption), trim($process->ProcessId)); + } + } else { + $processes = preg_split("/[\s]?,[\s]?/", PSI_PLUGIN_PSSTATUS_PROCESSES, -1, PREG_SPLIT_NO_EMPTY); + foreach($processes as $process) { + execute_program("pidof", "-s " . $process, $buffer, $this->debug); + $this->filecontent[] = array(trim($process), trim($buffer)); + } } break; case 'data': @@ -61,7 +71,7 @@ foreach($processes as $process) { $ps = preg_split("/[\s]?\|[\s]?/", $process, -1, PREG_SPLIT_NO_EMPTY); if(count($ps) == 2) { - $this->filecontent[] = array($ps[0], $ps[1]); + $this->filecontent[] = array(trim($ps[0]), trim($ps[1])); } } break; @@ -107,7 +117,7 @@ foreach($this->result as $ps) { $xmlps = $xml->addChild("ProcessStatus"); $xmlps->addChild("Name", $ps[0]); - $xmlps->addChild("Status", $ps[1] ? 1 : 0); + $xmlps->addChild("Status", $ps[1] ? 1 : 0); } return $xml; } Modified: plugins/psstatus/psstatus.config.php =================================================================== --- plugins/psstatus/psstatus.config.php 2009-01-19 18:54:40 UTC (rev 118) +++ plugins/psstatus/psstatus.config.php 2009-01-22 09:12:53 UTC (rev 119) @@ -11,7 +11,7 @@ /** * define how to access the psstatus statistic data - * - 'command' pidof command is run everytime the block gets refreshed or build + * - 'command' pidof command is run everytime the block gets refreshed or build / on WINNT information is retrieved everytime through WMI * - 'data' (a file must be available in the data directory of the phpsysinfo installation with the filename "psstatus.txt"; content is the output from <code>ps=("apache2" "mysqld" "sshd"); for((i=0;i<${#ps};i++)); do echo ${ps[$i]} "|" `pidof -s ${ps[$i]}` ;done</code>) * * @var string @@ -21,7 +21,7 @@ /** * controls which processes are checked if they are running * - * @var string contains a list of process names that are checked, names are seperated by a comma + * @var string contains a list of process names that are checked, names are seperated by a comma (on WINNT names must end with '.exe') */ -define('PSI_PLUGIN_PSSTATUS_PROCESSES', 'mysqld, sshd'); +define('PSI_PLUGIN_PSSTATUS_PROCESSES', 'mysqld, sshd, explorer.exe'); ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |