debug\ncode optimization
This commit is contained in:
@ -183,13 +183,16 @@ function iterateDevice($topic, $fn, $parentDevice, &$device, $payloadArray, $pro
|
||||
|
||||
}else
|
||||
{
|
||||
if (empty($device->$key) or $value != null)
|
||||
{
|
||||
//if (empty($device->$key) or $value != null)
|
||||
//{
|
||||
if (property_exists($device, $key))
|
||||
{
|
||||
if (is_array($device->$key))
|
||||
{
|
||||
$oldValue = $device->$key["value"];
|
||||
if (!empty($device->$key["value"]))
|
||||
{
|
||||
$oldValue = $device->$key["value"];
|
||||
}
|
||||
}else
|
||||
{
|
||||
$oldValue = $device->$key;
|
||||
@ -202,16 +205,10 @@ function iterateDevice($topic, $fn, $parentDevice, &$device, $payloadArray, $pro
|
||||
if ($oldValue !== $value)
|
||||
{
|
||||
$device->$key["value"] = $value;
|
||||
$changed[$fn]["key"] = $key;
|
||||
$changed[$fn]["value"] = $value;
|
||||
logger(INFO, sprintf(_("Device %s property %s, value changed to %s"), $fn, $propertyTree . $key, $value));
|
||||
if ($testMode === false)
|
||||
{
|
||||
$mohaDB->logProperty($parentDevice, $propertyTree . $key, $value, $oldValue);
|
||||
}else
|
||||
{
|
||||
logger(INFO, _("Test mode on: not storing in DB "));
|
||||
}
|
||||
//$changed[$fn]["key"] = $key;
|
||||
//$changed[$fn]["value"] = $value;
|
||||
logger(INFO, sprintf(_("Device %s property %s, %s"), $fn, $propertyTree . $key, bool2string($value)));
|
||||
$mohaDB->logProperty($parentDevice, $propertyTree . $key, $value, $oldValue);
|
||||
}
|
||||
if (!empty($device->$key["functions"]))
|
||||
{
|
||||
@ -221,7 +218,7 @@ function iterateDevice($topic, $fn, $parentDevice, &$device, $payloadArray, $pro
|
||||
$function($device, $key, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user