From f20c270a5dbeaf42af5d79257b054902ad56bafb Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 27 Dec 2023 12:37:38 +0100 Subject: [PATCH] wip #6598 @0.5 --- app/src/Buffer.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/src/Buffer.php b/app/src/Buffer.php index a660109..f59b79f 100644 --- a/app/src/Buffer.php +++ b/app/src/Buffer.php @@ -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(); -- 2.39.5