Fix a bunch of bugs (#12643)

This commit is contained in:
Jellyfrog 2021-03-23 23:08:42 +01:00 committed by GitHub
parent de0fc2125c
commit 58a154d894
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 6 deletions

View File

@ -221,7 +221,7 @@ class AlertUtil
*/
public static function runMacros($rule, $x = 1)
{
$macros = Config::get('alert.macros.rule', []) .
$macros = Config::get('alert.macros.rule', []);
krsort($macros);
foreach ($macros as $macro => $value) {
if (! strstr($macro, ' ')) {

View File

@ -76,7 +76,7 @@ class Boxcar extends Transport
$data['notification[sound]'] = $api['sound_ok'];
}
break;
case AlertState::Active:
case AlertState::ACTIVE:
$title_text = $severity;
break;
case AlertState::ACKNOWLEDGED:

View File

@ -54,8 +54,7 @@ class Telegram extends Transport
$ret = curl_exec($curl);
$code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($code != 200) {
var_dump("API '$host' returned Error"); //FIXME: propper debuging
var_dump('Params: ' . $api); //FIXME: propper debuging
var_dump('Telegram returned Error'); //FIXME: propper debuging
var_dump('Return: ' . $ret); //FIXME: propper debuging
return 'HTTP Status code ' . $code . ', Body ' . $ret;

View File

@ -220,7 +220,7 @@ class Component
\App\Models\Component::whereIn('id', array_keys($updated))
->with('prefs')
->get()
->each(function (\App\Models\Component $component) use ($updated) {
->each(function (\App\Models\Component $component) use ($device_id, $updated) {
$update = $updated[$component->id];
unset($update['type']); // can't change type
@ -256,7 +256,7 @@ class Component
$invalid->forget($existing->id);
$existing->fill(['value' => $value]);
if ($existing->isDirty()) {
Log::event("Component: $component->type($component->id). Attribute: $attribute, was modified from: " . $existing->getOriginal('value') . ", to: $value", $device_id, 'component', 3, $component_id);
Log::event("Component: $component->type($component->id). Attribute: $attribute, was modified from: " . $existing->getOriginal('value') . ", to: $value", $device_id, 'component', 3, $component->id);
$existing->save();
}
} else {