Tim Landscheidt has submitted this change and it was merged.

Change subject: Query proxy for list of active entries
......................................................................


Query proxy for list of active entries

Bug: T93197
Change-Id: I08c348536f34c674886a935e015cbbe203303604
---
M www/content/list.php
1 file changed, 13 insertions(+), 5 deletions(-)

Approvals:
  Tim Landscheidt: Verified; Looks good to me, approved



diff --git a/www/content/list.php b/www/content/list.php
index 6316fa5..de61f58 100644
--- a/www/content/list.php
+++ b/www/content/list.php
@@ -34,12 +34,20 @@
     }
   }
 
-  $dyn = fopen("/data/project/.system/dynamic", "r");
-  while(!feof($dyn)) {
-    list($tname, $where) = fscanf($dyn, "%s %s\n");
-    $tooldyn{$tname} = 1;
+  # Query list of active web services.
+  $active_proxy = file_get_contents('/etc/active-proxy');
+  $active_proxies_json = file_get_contents('http://' . $active_proxy . 
':8081/list');
+  $tooldyn = array();
+  if ($active_proxies_json == false) {
+    error_log('Cannot retrieve list of active proxies from http://' . 
$active_proxy . ':8081/list');
+  } else {
+    $active_proxies = json_decode($active_proxies_json, true);
+    foreach ($active_proxies as $key => $value) {
+      if(array_key_exists('status', $value) && $value['status'] == 'active') {
+        $tooldyn[$key] = 1;
+      }
+    }
   }
-  fclose($dyn);
 
   $ini = parse_ini_file("/data/project/admin/replica.my.cnf");
   $db = new mysqli("tools.labsdb", $ini['user'], $ini['password'], 
"toollabs_p");

-- 
To view, visit https://gerrit.wikimedia.org/r/235030
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I08c348536f34c674886a935e015cbbe203303604
Gerrit-PatchSet: 1
Gerrit-Project: labs/toollabs
Gerrit-Branch: master
Gerrit-Owner: Tim Landscheidt <t...@tim-landscheidt.de>
Gerrit-Reviewer: Tim Landscheidt <t...@tim-landscheidt.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to