{
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];
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);
public static function syncOut()
{
+ if(self::isLocal()){
+ return;
+ }
foreach (self::$_out as $o) {
$rsync = new Rsync($o['local'], $o['dir']);
$rsync->execute();