diff options
author | Simon Rettberg | 2022-06-24 14:06:21 +0200 |
---|---|---|
committer | Simon Rettberg | 2022-06-24 14:06:21 +0200 |
commit | a12cff0605cc9da29ee8d266cefb28c0c7405179 (patch) | |
tree | 53cf0d9b6d03f0ed15accbcc56e0ad1983a33e1e /modules-available/dnbd3/inc/dnbd3.inc.php | |
parent | [statistics] Fix standby crash filter (diff) | |
download | slx-admin-a12cff0605cc9da29ee8d266cefb28c0c7405179.tar.gz slx-admin-a12cff0605cc9da29ee8d266cefb28c0c7405179.tar.xz slx-admin-a12cff0605cc9da29ee8d266cefb28c0c7405179.zip |
[dnbd3] Rename/refactor RPC methods/constants
Diffstat (limited to 'modules-available/dnbd3/inc/dnbd3.inc.php')
-rw-r--r-- | modules-available/dnbd3/inc/dnbd3.inc.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/modules-available/dnbd3/inc/dnbd3.inc.php b/modules-available/dnbd3/inc/dnbd3.inc.php index 83baffbf..0c640973 100644 --- a/modules-available/dnbd3/inc/dnbd3.inc.php +++ b/modules-available/dnbd3/inc/dnbd3.inc.php @@ -26,4 +26,17 @@ class Dnbd3 { Property::set(self::PROP_NFS_FALLBACK, $bool ? 1 : 0); } + public static function getActiveServers(): array + { + $res = Database::simpleQuery('SELECT s.serverid, m.clientip, s.fixedip + FROM dnbd3_server s + LEFT JOIN machine m ON (s.machineuuid = m.machineuuid) + WHERE s.lastseen > :cutoff', ['cutoff' => time() - 310]); + $lookup = []; + foreach ($res as $row) { + $lookup[$row['fixedip'] ?? $row['clientip'] ?? ''] = $row['serverid']; + } + return $lookup; + } + } |