Browse Source

fixes + tuning, add author field

Jan Behrens 1 year ago
parent
commit
bd27ed5057
3 changed files with 7 additions and 5 deletions
  1. 3 2
      patchpanel/index.php
  2. 1 1
      poll_HV_data.php
  3. 3 2
      update_database.php

+ 3 - 2
patchpanel/index.php

@@ -35,6 +35,7 @@
 		// write TXT patch-panel configuration
 
         $config = $_POST["configurationname"] != "" ? $_POST["configurationname"] : $_POST["configurationload"];
+        $author = $_POST["author"] != "" ? $_POST["author"] : "(anonymous)";
 
         //$time = strtotime($_POST["validfrom"]);
 		$time = strtotime($_POST["validfrom-date"] . " " . $_POST["validfrom-time"]);
@@ -83,10 +84,10 @@
             sleep(1);
             //require '../update_database.php';
             if ($time === FALSE) {
-                shell_exec('cd .. ; php ./update_database.php "' . $config . '"');
+                shell_exec('cd .. ; php ./update_database.php "' . $config . '" "' . $author . '"');
             }
             else {
-                shell_exec('cd .. ; php ./update_database.php "' . $config . '" "' . date('Y-m-d H:i:s', $time) . '"');
+                shell_exec('cd .. ; php ./update_database.php "' . $config . '" "' . $author . '" "' . date('Y-m-d H:i:s', $time) . '"');
             }
         }
 

+ 1 - 1
poll_HV_data.php

@@ -211,7 +211,7 @@
         //echo $strFileContent.PHP_EOL;
         //echo $n." ".time().PHP_EOL;
 
-    }
+//    }
 //    while (time() < $starttime + 50);
 
     //echo "stopped".date("r", time()).PHP_EOL;

+ 3 - 2
update_database.php

@@ -51,9 +51,10 @@
 
     // get config name (optionally pass to script, 1st arg)
     $config = !empty($argv[1]) ? $argv[1] : "";
+    $author = !empty($argv[2]) ? $argv[2] : "";
 
     // get validity time (optionally pass to script, 2nd arg)
-    $ts = !empty($argv[2]) ? $argv[2] : date('Y-m-d H:i:s', $time);
+    $ts = !empty($argv[3]) ? $argv[3] : date('Y-m-d H:i:s', $time);
 
     // include channel list
     //include "SDS_status_channels.php";
@@ -246,7 +247,7 @@
         foreach ($relationKatrinNumbers[$eastwest] as $kn) {
             $json['relation'][$kn] = array();
             $json['relation'][$kn]['ValidityStart'] = $ts;
-            $json['relation'][$kn]['Comment'] = "Patchpanel configuration: " . $config;
+            $json['relation'][$kn]['Comment'] = $config . " (" .  $author . ")";
 
             $index = $check[$ch++];
             assert($index >= 0 and $index <= 22);