mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-12 19:21:33 +00:00
updated streamline-setup v2
This commit is contained in:
@@ -7,6 +7,7 @@ namespace League\Flysystem;
|
||||
use DateTimeInterface;
|
||||
use Throwable;
|
||||
|
||||
use function compact;
|
||||
use function method_exists;
|
||||
use function sprintf;
|
||||
|
||||
@@ -33,6 +34,15 @@ class MountManager implements FilesystemOperator
|
||||
$this->config = new Config($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* It is not recommended to mount filesystems after creation because interacting
|
||||
* with the Mount Manager becomes unpredictable. Use this as an escape hatch.
|
||||
*/
|
||||
public function dangerouslyMountFilesystems(string $key, FilesystemOperator $filesystem): void
|
||||
{
|
||||
$this->mountFilesystem($key, $filesystem);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string,FilesystemOperator> $filesystems
|
||||
*/
|
||||
@@ -156,15 +166,15 @@ class MountManager implements FilesystemOperator
|
||||
}
|
||||
}
|
||||
|
||||
public function visibility(string $location): string
|
||||
public function visibility(string $path): string
|
||||
{
|
||||
/** @var FilesystemOperator $filesystem */
|
||||
[$filesystem, $path] = $this->determineFilesystemAndPath($location);
|
||||
[$filesystem, $location] = $this->determineFilesystemAndPath($path);
|
||||
|
||||
try {
|
||||
return $filesystem->visibility($path);
|
||||
return $filesystem->visibility($location);
|
||||
} catch (UnableToRetrieveMetadata $exception) {
|
||||
throw UnableToRetrieveMetadata::visibility($location, $exception->reason(), $exception);
|
||||
throw UnableToRetrieveMetadata::visibility($path, $exception->reason(), $exception);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,11 +328,7 @@ class MountManager implements FilesystemOperator
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $key
|
||||
* @param mixed $filesystem
|
||||
*/
|
||||
private function guardAgainstInvalidMount($key, $filesystem): void
|
||||
private function guardAgainstInvalidMount(mixed $key, mixed $filesystem): void
|
||||
{
|
||||
if ( ! is_string($key)) {
|
||||
throw UnableToMountFilesystem::becauseTheKeyIsNotValid($key);
|
||||
@@ -391,10 +397,11 @@ class MountManager implements FilesystemOperator
|
||||
try {
|
||||
if ($visibility == null && $retainVisibility) {
|
||||
$visibility = $sourceFilesystem->visibility($sourcePath);
|
||||
$config = $config->extend(compact('visibility'));
|
||||
}
|
||||
|
||||
$stream = $sourceFilesystem->readStream($sourcePath);
|
||||
$destinationFilesystem->writeStream($destinationPath, $stream, $visibility ? compact(Config::OPTION_VISIBILITY) : []);
|
||||
$destinationFilesystem->writeStream($destinationPath, $stream, $config->toArray());
|
||||
} catch (UnableToRetrieveMetadata | UnableToReadFile | UnableToWriteFile $exception) {
|
||||
throw UnableToCopyFile::fromLocationTo($source, $destination, $exception);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user