Skip to content

Commit

Permalink
apcups: ensure numeric fields are 0 if the values are empty
Browse files Browse the repository at this point in the history
  • Loading branch information
eschultz committed May 26, 2018
1 parent 902fcd4 commit 46cfa87
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugins/dynamix.apcupsd/include/update.apcupsd.php
Expand Up @@ -20,9 +20,9 @@
exec("sed -i -e '/^NISIP/c\\NISIP 0.0.0.0' $conf");
exec("sed -i -e '/^UPSTYPE/c\\UPSTYPE '".str_replace("'","\\'",$new['UPSTYPE'])."'' $conf");
exec("sed -i -e '/^DEVICE/c\\DEVICE '".str_replace("'","\\'",$new['DEVICE'])."'' $conf");
exec("sed -i -e '/^BATTERYLEVEL/c\\BATTERYLEVEL '".str_replace("'","\\'",$new['BATTERYLEVEL'])."'' $conf");
exec("sed -i -e '/^MINUTES/c\\MINUTES '".str_replace("'","\\'",$new['MINUTES'])."'' $conf");
exec("sed -i -e '/^TIMEOUT/c\\TIMEOUT '".str_replace("'","\\'",$new['TIMEOUT'])."'' $conf");
exec("sed -i -e '/^BATTERYLEVEL/c\\BATTERYLEVEL '".intval($new['BATTERYLEVEL'])."'' $conf");
exec("sed -i -e '/^MINUTES/c\\MINUTES '".intval($new['MINUTES'])."'' $conf");
exec("sed -i -e '/^TIMEOUT/c\\TIMEOUT '".intval($new['TIMEOUT'])."'' $conf");
exec("sed -i -e '/^UPSCABLE/c\\UPSCABLE '".str_replace("'","\\'",$cable)."'' $conf");

if ($new['KILLUPS']=='yes' && $new['SERVICE']=='enable')
Expand Down

0 comments on commit 46cfa87

Please sign in to comment.