Browse Source

Make sure that we do not overwrite status other than offline and online.

master
Bernhard Fröhlich 1 year ago
parent
commit
cb57e18e10
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      bin/updatelinkdata

+ 4
- 4
bin/updatelinkdata View File

@@ -80,11 +80,11 @@ foreach($links as $linkdata)
80 80
         logMsg("Could not insert linkdata", "ERROR");
81 81
     }
82 82
 
83
-    $handle->exec('UPDATE interfaces SET status = \'online\' WHERE interfaceid = '.$link->fromif);
84
-    $handle->exec('UPDATE interfaces SET status = \'online\' WHERE interfaceid = '.$link->toif);
83
+    $handle->exec('UPDATE interfaces SET status = \'online\' WHERE status = \'offline\' AND interfaceid = '.$link->fromif);
84
+    $handle->exec('UPDATE interfaces SET status = \'online\' WHERE status = \'offline\' AND interfaceid = '.$link->toif);
85 85
 
86
-    $handle->exec('UPDATE locations SET status = \'online\' WHERE locationid = '.$link->getFromLocation()->locationid);
87
-    $handle->exec('UPDATE locations SET status = \'online\' WHERE locationid = '.$link->getToLocation()->locationid);
86
+    $handle->exec('UPDATE locations SET status = \'online\' WHERE status = \'offline\' AND locationid = '.$link->getFromLocation()->locationid);
87
+    $handle->exec('UPDATE locations SET status = \'online\' WHERE status = \'offline\' AND locationid = '.$link->getToLocation()->locationid);
88 88
 
89 89
     printf("%s -> %s (%f)\n", $linkdata['from'], $linkdata['to'], $linkdata['quality']);
90 90
 }

Loading…
Cancel
Save