]> _ Git - cubeextranet.git/commitdiff
wip #4209 @1
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 13 Jul 2022 16:14:25 +0000 (16:14 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 13 Jul 2022 16:14:25 +0000 (16:14 +0000)
inc/ws/Controlleur/class.ws.maintenance.php
inc/ws/Metier/class.ws.document.php

index c3adc66d05b731bd94b8cb3ac8c63f53be986b50..ccfddfa6dbdc58481a85e062ccdc71446f74167c 100644 (file)
@@ -1871,54 +1871,6 @@ class wsMaintenance
 
     }
 
-    public static function updateFarm()
-    {
-
-        foreach (wsDocument::getFarmServers() as $id => $farmer) {
-            echo '<h2>' . $farmer['host'] . ' (' . $id . ')</h2><pre>';
-            $cl = new CubeIT_CommandLine('sudo /usr/local/fluidbook_processfarm/bin/update');
-            $cl->setSSH($farmer['host'], 'fluidbookfarmer', '', $farmer['port'] ?? 22, '/home/extranet/.ssh/id_rsa');
-            $cl->execute();
-            echo $cl->commande . "\n\n--\n\n" . $cl->output . '</pre>';
-        }
-    }
-
-    public static function pingFarm()
-    {
-        $originalConnectionTimeout = ini_get('default_socket_timeout');
-        ini_set('default_socket_timeout', 5);
-        $cache = WS_CACHE . '/farmpings';
-        $servers = wsDocument::getFarmServers();
-        $pings = [];
-        if (file_exists($cache)) {
-            $cached = json_decode(file_get_contents($cache));
-            if (count($cached) === count($servers)) {
-                $pings = $cached;
-            }
-        }
-
-        foreach ($servers as $id => $farmer) {
-            echo '<h2>' . $farmer['name'] . ' (' . $id . ')</h2>';
-            if (isset($pings[$id]) && !$pings[$id]) {
-                // If ping failed recently, we wait a bit before trying again.
-                if (rand(0, 9) != 5) {
-                    echo '<p>Skipped, will try again soon</p>';
-                    continue;
-                }
-            }
-
-            $cl = new CubeIT_CommandLine('/usr/local/fluidbook_processfarm/bin/ping');
-            $cl->setSSH($farmer['host'], 'fluidbookfarmer', '', $farmer['port'] ?? 22, '/home/extranet/.ssh/id_rsa');
-            $cl->execute();
-            $ok = trim($cl->output) == '1';
-            echo '<p>' . ($ok ? 'OK' : 'KO') . ' : ' . $cl->output . '</p>';
-
-            $pings[$id] = $ok;
-        }
-        file_put_contents($cache, json_encode($pings));
-        ini_set('default_socket_timeout', $originalConnectionTimeout);
-    }
-
     public static function fluidbookFarm($args)
     {
         global $core;
index 327b66cf4b329cccd58aee75b5c1be72f558d2be..14b65395af8b3ae0714f0146299265d0b21065fe 100644 (file)
@@ -63,6 +63,7 @@ class wsDocument extends cubeMetier
         ['name' => 'godzilla', 'host' => 'godzilla.cubedesigners.com', 'weight' => 3],
         ['name' => 'dracula', 'host' => 'dracula.cubedesigners.com', 'weight' => 3],
         ['name' => 'her', 'host' => 'her2.cubedesigners.com', 'weight' => 4],
+        ['name' => 'brazil', 'host' => 'brazil.cubedesigners.com', 'weight' => 6],
     ];
 
     protected static $resolution2multiply = array(72 => 2, 100 => 2, 150 => 3, 200 => 3, 300 => 3, 450 => 4, 600 => 5);
@@ -458,7 +459,7 @@ class wsDocument extends cubeMetier
     public static function pickOneFarmServer()
     {
         $hat = [];
-        $pings = json_decode(file_get_contents(WS_CACHE . '/farmpings'));
+        $pings = json_decode(file_get_contents('/home/extranet/toolbox/storage/fluidbookfarm/pings'));
 
         foreach (self::$_farmServers as $k => $farmServer) {
             if (!isset($pings[$k]) || !$pings[$k]) {