Skip to content
Permalink
Browse files

Update mercury.class.php

  • Loading branch information...
directman66 committed Sep 15, 2018
1 parent bd52ca2 commit de5434f810bfb22a01f9d3c173b793e00e8626ec
Showing with 18 additions and 3 deletions.
  1. +18 −3 modules/mercury/mercury.class.php
@@ -263,16 +263,27 @@ function usual(&$out) {
function processCycle() {
// $every=$this->config['EVERY'];
$every=SETTINGS_APPMILUR_EVERY;
// $every=SETTINGS_APPMILUR_EVERY;
$cmd_rec = SQLSelectOne("SELECT VALUE FROM mercury_config where parametr='EVERY'");
$every=$cmd_rec['VALUE'];
$cmd_rec = SQLSelectOne("SELECT VALUE FROM mercury_config where parametr='LASTCYCLE_TS'");
$latest=$cmd_rec['VALUE'];
$tdev = time()-$latest;
$has = $tdev>$every*60;
if ($tdev < 0) {$has = true;}
if ($has) {
if ($enable==1) {$this->getpu(); }
if ($enable==1) {
$cmd_rec = SQLSelect("SELECT ID FROM mercury_devices");
foreach ($cmd_rec as $ID)
{getpu($ID);}
}
}
}
@@ -412,7 +423,11 @@ function getpu($id) {
//echo "Total T2: $Tot[0]<br>";
if ($Tot[0]) {sg($objname.'.Total2',$Tot[0]);$sql['Total2']=$Tot[0];}
SQLUpdate('properties',$property);
SQLUpdate('mercury_devices',$sql);
SQLexec("update mercury_config set value=UNIX_TIMESTAMP() where parametr='LASTCYCLE_TS'");
//echo "Закрываем сокет...";
socket_close($socket252);

0 comments on commit de5434f

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.