本文整理汇总了PHP中CommonFunctions::rfts方法的典型用法代码示例。如果您正苦于以下问题:PHP CommonFunctions::rfts方法的具体用法?PHP CommonFunctions::rfts怎么用?PHP CommonFunctions::rfts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommonFunctions
的用法示例。
在下文中一共展示了CommonFunctions::rfts方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct();
switch (defined('PSI_SENSOR_SPEEDFAN_ACCESS') ? strtolower(PSI_SENSOR_SPEEDFAN_ACCESS) : 'command') {
case 'command':
if (CommonFunctions::executeProgram("SpeedFanGet.exe", "", $buffer, PSI_DEBUG) && strlen($buffer) > 0) {
if (preg_match("/^Temperatures:\\s+(.+)\$/m", $buffer, $out)) {
$this->_filecontent["temp"] = $out[1];
}
if (preg_match("/^Fans:\\s+(.+)\$/m", $buffer, $out)) {
$this->_filecontent["fans"] = $out[1];
}
if (preg_match("/^Voltages:\\s+(.+)\$/m", $buffer, $out)) {
$this->_filecontent["volt"] = $out[1];
}
}
break;
case 'data':
if (CommonFunctions::rfts(APP_ROOT . '/data/speedfan.txt', $buffer) && strlen($buffer) > 0) {
if (preg_match("/^Temperatures:\\s+(.+)\$/m", $buffer, $out)) {
$this->_filecontent["temp"] = $out[1];
}
if (preg_match("/^Fans:\\s+(.+)\$/m", $buffer, $out)) {
$this->_filecontent["fans"] = $out[1];
}
if (preg_match("/^Voltages:\\s+(.+)\$/m", $buffer, $out)) {
$this->_filecontent["volt"] = $out[1];
}
}
break;
default:
$this->error->addConfigError('__construct()', 'PSI_SENSOR_SPEEDFAN_ACCESS');
break;
}
}
示例2: __construct
/**
* fill the private content var through command or data access
*/
public function __construct()
{
parent::__construct();
switch (defined('PSI_SENSOR_LMSENSORS_ACCESS') ? strtolower(PSI_SENSOR_LMSENSORS_ACCESS) : 'command') {
case 'command':
if (CommonFunctions::executeProgram("sensors", "", $lines)) {
// Martijn Stolk: Dirty fix for misinterpreted output of sensors,
// where info could come on next line when the label is too long.
$lines = str_replace(":\n", ":", $lines);
$lines = str_replace("\n\n", "\n", $lines);
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
}
break;
case 'data':
if (CommonFunctions::rfts(APP_ROOT . '/data/lmsensors.txt', $lines)) {
$lines = str_replace(":\n", ":", $lines);
$lines = str_replace("\n\n", "\n", $lines);
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
}
break;
default:
$this->error->addConfigError('__construct()', 'PSI_SENSOR_LMSENSORS_ACCESS');
break;
}
}
示例3: __construct
/**
* read the data into an internal array and also call the parent constructor
*
* @param String $enc encoding
*/
public function __construct($enc)
{
parent::__construct(__CLASS__, $enc);
switch (strtolower(PSI_PLUGIN_UPDATENOTIFIER_ACCESS)) {
case 'command':
if (PSI_PLUGIN_UPDATENOTIFIER_UBUNTU_LANDSCAPE_FORMAT === true) {
CommonFunctions::executeProgram("/usr/lib/update-notifier/apt-check", "--human-readable", $buffer_info);
} else {
CommonFunctions::executeProgram("/usr/lib/update-notifier/apt-check", "2>&1", $buffer_info);
}
break;
case 'data':
if (defined('PSI_PLUGIN_UPDATENOTIFIER_FILE') && is_string(PSI_PLUGIN_UPDATENOTIFIER_FILE)) {
CommonFunctions::rfts(PSI_PLUGIN_UPDATENOTIFIER_FILE, $buffer_info);
} else {
CommonFunctions::rfts("/var/lib/update-notifier/updates-available", $buffer_info);
}
break;
default:
$this->global_error->addConfigError("__construct()", "PSI_PLUGIN_UPDATENOTIFIER_ACCESS");
break;
}
// Remove blank lines
$this->_filecontent = preg_split("/\r?\n/", $buffer_info, -1, PREG_SPLIT_NO_EMPTY);
}
示例4: __construct
/**
* fill the private content var through tcp, command or data access
*/
public function __construct()
{
parent::__construct();
switch (defined('PSI_SENSOR_MBMON_ACCESS') ? strtolower(PSI_SENSOR_MBMON_ACCESS) : 'command') {
case 'tcp':
$fp = fsockopen("localhost", 411, $errno, $errstr, 5);
if ($fp) {
$lines = "";
while (!feof($fp)) {
$lines .= fread($fp, 1024);
}
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
} else {
$this->error->addError("fsockopen()", $errno . " " . $errstr);
}
break;
case 'command':
CommonFunctions::executeProgram('mbmon', '-c 1 -r', $lines, PSI_DEBUG);
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
break;
case 'data':
if (CommonFunctions::rfts(APP_ROOT . '/data/mbmon.txt', $lines)) {
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
}
break;
default:
$this->error->addConfigError('__construct()', 'PSI_SENSOR_MBMON_ACCESS');
break;
}
}
示例5: __construct
/**
* read the data into an internal array and also call the parent constructor
*
* @param String $enc encoding
*/
public function __construct($enc)
{
parent::__construct(__CLASS__, $enc);
CommonFunctions::rfts(PSI_PLUGIN_UPDATENOTIFIER_FILE, $buffer_info);
// Remove blank lines
$this->_filecontent = preg_split("/\n/", $buffer_info, -1, PREG_SPLIT_NO_EMPTY);
}
示例6: __construct
/**
* read the data into an internal array and also call the parent constructor
*
* @param String $enc encoding
*/
public function __construct($enc)
{
$buffer = "";
parent::__construct(__CLASS__, $enc);
switch (strtolower(PSI_PLUGIN_DMRAID_ACCESS)) {
case 'command':
if (PSI_OS == 'FreeBSD') {
CommonFunctions::executeProgram("graid", "list", $buffer);
} else {
CommonFunctions::executeProgram("dmraid", "-s -vv 2>&1", $buffer);
}
break;
case 'data':
CommonFunctions::rfts(APP_ROOT . "/data/dmraid.txt", $buffer);
break;
default:
$this->global_error->addConfigError("__construct()", "PSI_PLUGIN_DMRAID_ACCESS");
break;
}
if (trim($buffer) != "") {
if (PSI_OS == 'FreeBSD') {
$this->_filecontent = preg_split("/Consumers:\r?\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY);
} else {
$this->_filecontent = preg_split("/(\r?\n\\*\\*\\* )|(\r?\n--> )/", $buffer, -1, PREG_SPLIT_NO_EMPTY);
}
} else {
$this->_filecontent = array();
}
}
示例7: _temperature
/**
* get temperature information
*
* @return void
*/
private function _temperature()
{
if (PSI_OS == 'Linux') {
$hwpaths = glob("/sys/devices/platform/coretemp.*/", GLOB_NOSORT);
if (($totalh = count($hwpaths)) > 0) {
$buf = "";
for ($h = 0; $h < $totalh; $h++) {
$tempsensor = glob($hwpaths[$h] . "temp*_input", GLOB_NOSORT);
if (($total = count($tempsensor)) > 0) {
$buf = "";
for ($i = 0; $i < $total; $i++) {
if (CommonFunctions::rfts($tempsensor[$i], $buf, 1, 4096, false) && trim($buf) != "") {
$dev = new SensorDevice();
$dev->setValue(trim($buf) / 1000);
$label = preg_replace("/_input\$/", "_label", $tempsensor[$i]);
$crit = preg_replace("/_input\$/", "_crit", $tempsensor[$i]);
$max = preg_replace("/_input\$/", "_max", $tempsensor[$i]);
$crit_alarm = preg_replace("/_input\$/", "_crit_alarm", $tempsensor[$i]);
if (CommonFunctions::fileexists($label) && CommonFunctions::rfts($label, $buf, 1, 4096, false) && trim($buf) != "") {
$dev->setName(trim($buf));
} else {
$labelname = trim(preg_replace("/_input\$/", "", pathinfo($tempsensor[$i], PATHINFO_BASENAME)));
if ($labelname !== "") {
$dev->setName($labelname);
} else {
$dev->setName('unknown');
}
}
if (CommonFunctions::fileexists($crit) && CommonFunctions::rfts($crit, $buf, 1, 4096, false) && trim($buf) != "") {
$dev->setMax(trim($buf) / 1000);
if (CommonFunctions::fileexists($crit_alarm) && CommonFunctions::rfts($crit_alarm, $buf, 1, 4096, false) && trim($buf) === "1") {
$dev->setEvent("Critical Alarm");
}
} elseif (CommonFunctions::fileexists($max) && CommonFunctions::rfts($max, $buf, 1, 4096, false) && trim($buf) != "") {
$dev->setMax(trim($buf) / 1000);
}
$this->mbinfo->setMbTemp($dev);
}
}
}
}
}
} else {
$smp = 1;
CommonFunctions::executeProgram('sysctl', '-n kern.smp.cpus', $smp);
for ($i = 0; $i < $smp; $i++) {
$temp = 0;
if (CommonFunctions::executeProgram('sysctl', '-n dev.cpu.' . $i . '.temperature', $temp)) {
$temp = preg_replace('/C/', '', $temp);
$dev = new SensorDevice();
$dev->setName("CPU " . ($i + 1));
$dev->setValue($temp);
// $dev->setMax(70);
$this->mbinfo->setMbTemp($dev);
}
}
}
}
示例8: __construct
/**
* read the MBM5.csv file and fill the private arrays
*/
public function __construct()
{
parent::__construct();
$delim = "/;/";
CommonFunctions::rfts(APP_ROOT . "/data/MBM5.csv", $buffer);
if (strpos($buffer, ";") === false) {
$delim = "/,/";
}
$buffer = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY);
$this->_buf_label = preg_split($delim, substr($buffer[0], 0, -2), -1, PREG_SPLIT_NO_EMPTY);
$this->_buf_value = preg_split($delim, substr($buffer[1], 0, -2), -1, PREG_SPLIT_NO_EMPTY);
}
示例9: __construct
/**
* read the data into an internal array and also call the parent constructor
*
* @param String $enc encoding
*/
public function __construct($enc)
{
parent::__construct(__CLASS__, $enc);
switch (PSI_PLUGIN_PS_ACCESS) {
case 'command':
if (PHP_OS == 'WINNT') {
$objLocator = new COM("WbemScripting.SWbemLocator");
$wmi = $objLocator->ConnectServer();
$os_wmi = $wmi->InstancesOf('Win32_OperatingSystem');
foreach ($os_wmi as $os) {
$memtotal = $os->TotalVisibleMemorySize * 1024;
}
$process_wmi = $wmi->InstancesOf('Win32_Process');
foreach ($process_wmi as $process) {
if (strlen(trim($process->CommandLine)) > 0) {
$ps = trim($process->CommandLine);
} else {
$ps = trim($process->Caption);
}
if (trim($process->ProcessId) != 0) {
$memusage = round(trim($process->WorkingSetSize) * 100 / $memtotal, 1);
//ParentProcessId
//Unique identifier of the process that creates a process. Process identifier numbers are reused, so they
//only identify a process for the lifetime of that process. It is possible that the process identified by
//ParentProcessId is terminated, so ParentProcessId may not refer to a running process. It is also
//possible that ParentProcessId incorrectly refers to a process that reuses a process identifier. You can
//use the CreationDate property to determine whether the specified parent was created after the process
//represented by this Win32_Process instance was created.
//=> subtrees of processes may be missing (WHAT TODO?!?)
$this->_filecontent[] = trim($process->ProcessId) . " " . trim($process->ParentProcessId) . " " . $memusage . " " . $ps;
}
}
} else {
CommonFunctions::executeProgram("ps", "axo pid,ppid,pmem,args", $buffer, PSI_DEBUG);
}
break;
case 'data':
CommonFunctions::rfts(APP_ROOT . "/data/ps.txt", $buffer);
break;
default:
$this->global_error->addConfigError("__construct()", "PSI_PLUGIN_PS_ACCESS");
break;
}
if (PHP_OS != 'WINNT') {
if (trim($buffer) != "") {
$this->_filecontent = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY);
unset($this->_filecontent[0]);
} else {
$this->_filecontent = array();
}
}
}
示例10: __construct
/**
* read the data into an internal array and also call the parent constructor
*
* @param String $enc target encoding
*/
public function __construct($enc)
{
parent::__construct(__CLASS__, $enc);
switch (strtolower(PSI_PLUGIN_PSSTATUS_ACCESS)) {
case 'command':
if (PSI_OS == 'WINNT') {
try {
$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));
}
} catch (Exception $e) {
}
} else {
if (defined('PSI_PLUGIN_PSSTATUS_PROCESSES') && is_string(PSI_PLUGIN_PSSTATUS_PROCESSES)) {
if (preg_match(ARRAY_EXP, PSI_PLUGIN_PSSTATUS_PROCESSES)) {
$processes = eval(PSI_PLUGIN_PSSTATUS_PROCESSES);
} else {
$processes = array(PSI_PLUGIN_PSSTATUS_PROCESSES);
}
foreach ($processes as $process) {
CommonFunctions::executeProgram("pidof", "-s " . $process, $buffer, PSI_DEBUG);
if (strlen(trim($buffer)) > 0) {
$this->_filecontent[] = array($process, trim($buffer));
}
}
}
}
break;
case 'data':
CommonFunctions::rfts(APP_ROOT . "/data/psstatus.txt", $buffer);
$processes = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY);
foreach ($processes as $process) {
$ps = preg_split("/[\\s]?\\|[\\s]?/", $process, -1, PREG_SPLIT_NO_EMPTY);
if (count($ps) == 2) {
$this->_filecontent[] = array(trim($ps[0]), trim($ps[1]));
}
}
break;
default:
$this->global_error->addError("switch(PSI_PLUGIN_PSSTATUS_ACCESS)", "Bad psstatus configuration in psstatus.config.php");
break;
}
}
示例11: __construct
/**
* read the data into an internal array and also call the parent constructor
*
* @param String $enc target encoding
*/
public function __construct($enc)
{
parent::__construct(__CLASS__, $enc);
switch (PSI_PLUGIN_SMART_ACCESS) {
case 'command':
$disks = preg_split('/([\\s]+)?,([\\s]+)?/', PSI_PLUGIN_SMART_DEVICES, -1, PREG_SPLIT_NO_EMPTY);
foreach ($disks as $disk) {
$buffer = "";
if (CommonFunctions::executeProgram('smartctl', '--all' . (PSI_PLUGIN_SMART_DEVICE ? ' --device ' . PSI_PLUGIN_SMART_DEVICE : '') . ' ' . $disk, $buffer, PSI_DEBUG)) {
$this->_filecontent[$disk] = $buffer;
}
}
$fullIds = preg_split('/([\\s]+)?,([\\s]+)?/', PSI_PLUGIN_SMART_IDS, -1, PREG_SPLIT_NO_EMPTY);
foreach ($fullIds as $fullId) {
$arrFullId = preg_split('/-/', $fullId);
$this->_ids[intval($arrFullId[0])] = strtolower($arrFullId[1]);
if (!empty($arrFullId[2])) {
$this->_ids[intval($arrFullId[2])] = "#replace-" . intval($arrFullId[0]);
}
}
break;
case 'data':
$disks = preg_split('/([\\s]+)?,([\\s]+)?/', PSI_PLUGIN_SMART_DEVICES, -1, PREG_SPLIT_NO_EMPTY);
$dn = 0;
foreach ($disks as $disk) {
$buffer = "";
if (CommonFunctions::rfts(APP_ROOT . "/data/SMART{$dn}.txt", $buffer) && !empty($buffer)) {
$this->_filecontent[$disk] = $buffer;
}
$dn++;
}
$fullIds = preg_split('/([\\s]+)?,([\\s]+)?/', PSI_PLUGIN_SMART_IDS, -1, PREG_SPLIT_NO_EMPTY);
foreach ($fullIds as $fullId) {
$arrFullId = preg_split('/-/', $fullId);
$this->_ids[intval($arrFullId[0])] = strtolower($arrFullId[1]);
if (!empty($arrFullId[2])) {
$this->_ids[intval($arrFullId[2])] = "#replace-" . intval($arrFullId[0]);
}
}
break;
default:
$this->global_error->addError("switch(PSI_PLUGIN_SMART_ACCESS)", "Bad SMART configuration in SMART.config.php");
break;
}
}
示例12: __construct
/**
* fill the private content var through tcp or file access
*/
public function __construct()
{
parent::__construct();
switch (strtolower(PSI_SENSOR_ACCESS)) {
case 'command':
CommonFunctions::executeProgram('ipmiutil', 'sensor -stw', $lines);
$this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
break;
case 'file':
if (CommonFunctions::rfts(APP_ROOT . '/data/ipmiutil.txt', $lines)) {
$this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
}
break;
default:
$this->error->addConfigError('__construct()', 'PSI_SENSOR_ACCESS');
break;
}
}
示例13: __construct
/**
* fill the private content var through command or data access
*/
public function __construct()
{
parent::__construct();
switch (defined('PSI_SENSOR_FREEIPMI_ACCESS') ? strtolower(PSI_SENSOR_FREEIPMI_ACCESS) : 'command') {
case 'command':
CommonFunctions::executeProgram('ipmi-sensors', '--output-sensor-thresholds', $lines);
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
break;
case 'data':
if (CommonFunctions::rfts(APP_ROOT . '/data/freeipmi.txt', $lines)) {
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
}
break;
default:
$this->error->addConfigError('__construct()', 'PSI_SENSOR_FREEIPMI_ACCESS');
break;
}
}
示例14: __construct
/**
* fill the private array
*/
public function __construct()
{
parent::__construct();
switch (defined('PSI_SENSOR_K8TEMP_ACCESS') ? strtolower(PSI_SENSOR_K8TEMP_ACCESS) : 'command') {
case 'command':
$lines = "";
CommonFunctions::executeProgram('k8temp', '', $lines);
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
break;
case 'data':
if (CommonFunctions::rfts(APP_ROOT . '/data/k8temp.txt', $lines)) {
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
}
break;
default:
$this->error->addConfigError('__construct()', 'PSI_SENSOR_K8TEMP_ACCESS');
break;
}
}
示例15: __construct
/**
* read the MBM5.csv file and fill the private arrays
*/
public function __construct()
{
parent::__construct();
switch (strtolower(PSI_SENSOR_ACCESS)) {
case 'file':
$delim = "/;/";
CommonFunctions::rfts(APP_ROOT . "/data/MBM5.csv", $buffer);
if (strpos($buffer, ";") === false) {
$delim = "/,/";
}
$buffer = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY);
$this->_buf_label = preg_split($delim, substr($buffer[0], 0, -2), -1, PREG_SPLIT_NO_EMPTY);
$this->_buf_value = preg_split($delim, substr($buffer[1], 0, -2), -1, PREG_SPLIT_NO_EMPTY);
break;
default:
$this->error->addConfigError('__construct()', 'PSI_SENSOR_ACCESS');
break;
}
}