* Mon May 12 2025 Brian Read <brianr@koozali.org> 11.0.0-1.sme

- Adding SM2 panel [SME: 13004]
- Upgrade to phpsysinfo 3.4.4
- Add code to delete inline styles and add css to make it look better.
- version saved / built uses the static version, which means no drops downs and choices.
This commit is contained in:
2025-05-14 16:14:01 +01:00
parent 80b1da5fa5
commit c8ce77259d
952 changed files with 51341 additions and 28699 deletions

View File

@@ -8,7 +8,7 @@
* @package PSI_UPS
* @author Robert Pelletier <drizzt@menzonet.org>
* @copyright 2014 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.nut.inc.php 661 2012-08-27 11:26:39Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
@@ -19,7 +19,7 @@
* @package PSI_UPS
* @author Robert Pelletier <drizzt@menzonet.org>
* @copyright 2014 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
@@ -38,41 +38,60 @@ class Pmset extends UPS
public function __construct()
{
parent::__construct();
CommonFunctions::executeProgram('pmset', '-g batt', $temp);
if (! empty($temp)) {
$this->_output[] = $temp;
if (defined('PSI_UPS_PMSET_ACCESS') && (strtolower(trim(PSI_UPS_PMSET_ACCESS))==='data')) {
if (CommonFunctions::rftsdata('upspmset.tmp', $temp)) {
$this->_output[] = $temp;
}
} elseif (PSI_OS == 'Darwin') {
if (CommonFunctions::executeProgram('pmset', '-g batt', $temp) && !empty($temp)) {
$this->_output[] = $temp;
}
}
}
/**
* parse the input and store data in resultset for xml generation
*
* @return array
* @return void
*/
private function _info()
{
if (empty($this->_output)) {
return;
}
$model = array();
$percCharge = array();
$lines = explode(PHP_EOL, implode($this->_output));
$dev = new UPSDevice();
$model = explode('FW:', $lines[1]);
if (strpos($model[0], 'InternalBattery') === false) {
$percCharge = explode(';', $lines[1]);
$dev->setName('UPS');
if ($model !== false) {
$dev->setModel(substr(trim($model[0]), 1));
}
if ($percCharge !== false) {
$dev->setBatterCharge(trim(substr($percCharge[0], -4, 3)));
$dev->setStatus(trim($percCharge[1]));
if (isset($percCharge[2])) {
$time = explode(':', $percCharge[2]);
$hours = $time[0];
$minutes = $hours*60+substr($time[1], 0, 2);
$dev->setTimeLeft($minutes);
if (count($lines)>1) {
if (strpos($lines[1], 'InternalBattery') === false) {
$dev = new UPSDevice();
$dev->setName('UPS');
$percCharge = explode(';', $lines[1]);
$model = explode('FW:', $lines[1]);
if ($model !== false) {
$dev->setModel(substr(trim($model[0]), 1));
}
if ($percCharge !== false) {
if (preg_match("/\s(\d+)\%$/", trim($percCharge[0]), $tmpbuf)) {
if ($tmpbuf[1]>100) {
$dev->setBatterCharge(100);
} else {
$dev->setBatterCharge($tmpbuf[1]);
}
}
$percCharge[1]=trim($percCharge[1]);
if (preg_match("/^(.+) present:/", $percCharge[1], $tmpbuf)) {
$dev->setStatus(trim($tmpbuf[1]));
} else {
$dev->setStatus($percCharge[1]);
}
if (isset($percCharge[2]) && preg_match("/\s(\d+):(\d+)\s/", $percCharge[2], $tmpbuf)) {
$dev->setTimeLeft($tmpbuf[1]*60+$tmpbuf[2]);
}
}
$dev->setMode("pmset");
$this->upsinfo->setUpsDevices($dev);
}
$this->upsinfo->setUpsDevices($dev);
}
}
@@ -81,7 +100,7 @@ class Pmset extends UPS
*
* @see PSI_Interface_UPS::build()
*
* @return Void
* @return void
*/
public function build()
{