]> _ Git - fluidbook_processfarm.git/commitdiff
wip #6598 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 27 Dec 2023 11:37:38 +0000 (12:37 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 27 Dec 2023 11:37:38 +0000 (12:37 +0100)
app/src/Buffer.php

index a660109fc4f5997d5f0a1cb299ef0c9325b76a52..f59b79fdf26ddf61efc4aedfa864cd9a0b39d41f 100644 (file)
@@ -9,8 +9,13 @@ class Buffer
 {
     protected static $_out = [];
 
+    const LOCAL = 'dracula';
+
     public static function getOut($path)
     {
+        if (self::isLocal()) {
+            return $path;
+        }
         self::getDirAndFile($path, $dir, $file);
         if (!isset(self::$_out[$path])) {
             self::$_out[$path] = ['local' => Files::mkdir('/tmp/out/' . sha1($path)), 'dir' => $dir];
@@ -18,8 +23,16 @@ class Buffer
         return self::$_out[$path]['local'] . $file;
     }
 
+    public static function isLocal()
+    {
+        return trim(file_get_contents('/etc/hostname')) === self::LOCAL;
+    }
+
     public static function getIn($path, $force = false)
     {
+        if(self::isLocal()){
+            return $path;
+        }
         self::getDirAndFile($path, $dir, $file);
         if ($file) {
             $e = explode('.', $file);
@@ -34,6 +47,9 @@ class Buffer
 
     public static function syncOut()
     {
+        if(self::isLocal()){
+            return;
+        }
         foreach (self::$_out as $o) {
             $rsync = new Rsync($o['local'], $o['dir']);
             $rsync->execute();