🔧
This commit is contained in:
2
vendor/league/flysystem/LICENSE
vendored
2
vendor/league/flysystem/LICENSE
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2013-2023 Frank de Jonge
|
||||
Copyright (c) 2013-2024 Frank de Jonge
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
9
vendor/league/flysystem/composer.json
vendored
9
vendor/league/flysystem/composer.json
vendored
@@ -25,17 +25,20 @@
|
||||
"ext-zip": "*",
|
||||
"ext-fileinfo": "*",
|
||||
"ext-ftp": "*",
|
||||
"ext-mongodb": "^1.3",
|
||||
"microsoft/azure-storage-blob": "^1.1",
|
||||
"phpunit/phpunit": "^9.5.11|^10.0",
|
||||
"phpstan/phpstan": "^1.10",
|
||||
"phpseclib/phpseclib": "^3.0.34",
|
||||
"aws/aws-sdk-php": "^3.220.0",
|
||||
"phpseclib/phpseclib": "^3.0.36",
|
||||
"aws/aws-sdk-php": "^3.295.10",
|
||||
"composer/semver": "^3.0",
|
||||
"friendsofphp/php-cs-fixer": "^3.5",
|
||||
"google/cloud-storage": "^1.23",
|
||||
"async-aws/s3": "^1.5 || ^2.0",
|
||||
"async-aws/simple-s3": "^1.1 || ^2.0",
|
||||
"sabre/dav": "^4.3.1"
|
||||
"mongodb/mongodb": "^1.2",
|
||||
"sabre/dav": "^4.6.0",
|
||||
"guzzlehttp/psr7": "^2.6"
|
||||
},
|
||||
"conflict": {
|
||||
"async-aws/core": "<1.19.0",
|
||||
|
||||
2
vendor/league/flysystem/readme.md
vendored
2
vendor/league/flysystem/readme.md
vendored
@@ -32,6 +32,7 @@ for which ever storage is right for you.
|
||||
* **[AsyncAws S3](https://flysystem.thephpleague.com/docs/adapter/async-aws-s3/)**
|
||||
* **[Google Cloud Storage](https://flysystem.thephpleague.com/docs/adapter/google-cloud-storage/)**
|
||||
* **[Azure Blob Storage](https://flysystem.thephpleague.com/docs/adapter/azure-blob-storage/)**
|
||||
* **[MongoDB GridFS](https://flysystem.thephpleague.com/docs/adapter/gridfs/)**
|
||||
* **[WebDAV](https://flysystem.thephpleague.com/docs/adapter/webdav/)**
|
||||
* **[ZipArchive](https://flysystem.thephpleague.com/docs/adapter/zip-archive/)**
|
||||
|
||||
@@ -45,6 +46,7 @@ for which ever storage is right for you.
|
||||
* **[Dropbox](https://github.com/spatie/flysystem-dropbox)**
|
||||
* **[ReplicateAdapter](https://github.com/ajgarlag/flysystem-replicate)**
|
||||
* **[Uploadcare](https://github.com/vormkracht10/flysystem-uploadcare)**
|
||||
* **[Useful adapters (FallbackAdapter, LogAdapter, ReadWriteAdapter, RetryAdapter)](https://github.com/ElGigi/FlysystemUsefulAdapters)**
|
||||
|
||||
You can always [create an adapter](https://flysystem.thephpleague.com/docs/advanced/creating-an-adapter/) yourself.
|
||||
|
||||
|
||||
17
vendor/league/flysystem/src/Filesystem.php
vendored
17
vendor/league/flysystem/src/Filesystem.php
vendored
@@ -25,7 +25,7 @@ class Filesystem implements FilesystemOperator
|
||||
public function __construct(
|
||||
private FilesystemAdapter $adapter,
|
||||
array $config = [],
|
||||
PathNormalizer $pathNormalizer = null,
|
||||
?PathNormalizer $pathNormalizer = null,
|
||||
private ?PublicUrlGenerator $publicUrlGenerator = null,
|
||||
private ?TemporaryUrlGenerator $temporaryUrlGenerator = null,
|
||||
) {
|
||||
@@ -187,7 +187,10 @@ class Filesystem implements FilesystemOperator
|
||||
?? throw UnableToGeneratePublicUrl::noGeneratorConfigured($path);
|
||||
$config = $this->config->extend($config);
|
||||
|
||||
return $this->publicUrlGenerator->publicUrl($this->pathNormalizer->normalizePath($path), $config);
|
||||
return $this->publicUrlGenerator->publicUrl(
|
||||
$this->pathNormalizer->normalizePath($path),
|
||||
$config,
|
||||
);
|
||||
}
|
||||
|
||||
public function temporaryUrl(string $path, DateTimeInterface $expiresAt, array $config = []): string
|
||||
@@ -214,9 +217,15 @@ class Filesystem implements FilesystemOperator
|
||||
}
|
||||
|
||||
try {
|
||||
return $this->adapter->checksum($path, $config);
|
||||
return $this->adapter->checksum(
|
||||
$this->pathNormalizer->normalizePath($path),
|
||||
$config,
|
||||
);
|
||||
} catch (ChecksumAlgoIsNotSupported) {
|
||||
return $this->calculateChecksumFromStream($path, $config);
|
||||
return $this->calculateChecksumFromStream(
|
||||
$this->pathNormalizer->normalizePath($path),
|
||||
$config,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
27
vendor/league/flysystem/src/MountManager.php
vendored
27
vendor/league/flysystem/src/MountManager.php
vendored
@@ -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);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class UnableToCheckExistence extends RuntimeException implements FilesystemOpera
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
|
||||
public static function forLocation(string $path, Throwable $exception = null): static
|
||||
public static function forLocation(string $path, ?Throwable $exception = null): static
|
||||
{
|
||||
return new static("Unable to check existence for: {$path}", 0, $exception);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ final class UnableToCopyFile extends RuntimeException implements FilesystemOpera
|
||||
public static function fromLocationTo(
|
||||
string $sourcePath,
|
||||
string $destinationPath,
|
||||
Throwable $previous = null
|
||||
?Throwable $previous = null
|
||||
): UnableToCopyFile {
|
||||
$e = new static("Unable to copy file from $sourcePath to $destinationPath", 0 , $previous);
|
||||
$e->source = $sourcePath;
|
||||
|
||||
@@ -22,7 +22,7 @@ final class UnableToDeleteDirectory extends RuntimeException implements Filesyst
|
||||
public static function atLocation(
|
||||
string $location,
|
||||
string $reason = '',
|
||||
Throwable $previous = null
|
||||
?Throwable $previous = null
|
||||
): UnableToDeleteDirectory {
|
||||
$e = new static(rtrim("Unable to delete directory located at: {$location}. {$reason}"), 0, $previous);
|
||||
$e->location = $location;
|
||||
|
||||
@@ -19,7 +19,7 @@ final class UnableToDeleteFile extends RuntimeException implements FilesystemOpe
|
||||
*/
|
||||
private $reason;
|
||||
|
||||
public static function atLocation(string $location, string $reason = '', Throwable $previous = null): UnableToDeleteFile
|
||||
public static function atLocation(string $location, string $reason = '', ?Throwable $previous = null): UnableToDeleteFile
|
||||
{
|
||||
$e = new static(rtrim("Unable to delete file located at: {$location}. {$reason}"), 0, $previous);
|
||||
$e->location = $location;
|
||||
|
||||
@@ -37,7 +37,7 @@ final class UnableToMoveFile extends RuntimeException implements FilesystemOpera
|
||||
public static function fromLocationTo(
|
||||
string $sourcePath,
|
||||
string $destinationPath,
|
||||
Throwable $previous = null
|
||||
?Throwable $previous = null
|
||||
): UnableToMoveFile {
|
||||
$message = $previous?->getMessage() ?? "Unable to move file from $sourcePath to $destinationPath";
|
||||
$e = new static($message, 0, $previous);
|
||||
|
||||
@@ -19,7 +19,7 @@ final class UnableToReadFile extends RuntimeException implements FilesystemOpera
|
||||
*/
|
||||
private $reason = '';
|
||||
|
||||
public static function fromLocation(string $location, string $reason = '', Throwable $previous = null): UnableToReadFile
|
||||
public static function fromLocation(string $location, string $reason = '', ?Throwable $previous = null): UnableToReadFile
|
||||
{
|
||||
$e = new static(rtrim("Unable to read file from location: {$location}. {$reason}"), 0, $previous);
|
||||
$e->location = $location;
|
||||
|
||||
@@ -24,27 +24,27 @@ final class UnableToRetrieveMetadata extends RuntimeException implements Filesys
|
||||
*/
|
||||
private $reason;
|
||||
|
||||
public static function lastModified(string $location, string $reason = '', Throwable $previous = null): self
|
||||
public static function lastModified(string $location, string $reason = '', ?Throwable $previous = null): self
|
||||
{
|
||||
return static::create($location, FileAttributes::ATTRIBUTE_LAST_MODIFIED, $reason, $previous);
|
||||
}
|
||||
|
||||
public static function visibility(string $location, string $reason = '', Throwable $previous = null): self
|
||||
public static function visibility(string $location, string $reason = '', ?Throwable $previous = null): self
|
||||
{
|
||||
return static::create($location, FileAttributes::ATTRIBUTE_VISIBILITY, $reason, $previous);
|
||||
}
|
||||
|
||||
public static function fileSize(string $location, string $reason = '', Throwable $previous = null): self
|
||||
public static function fileSize(string $location, string $reason = '', ?Throwable $previous = null): self
|
||||
{
|
||||
return static::create($location, FileAttributes::ATTRIBUTE_FILE_SIZE, $reason, $previous);
|
||||
}
|
||||
|
||||
public static function mimeType(string $location, string $reason = '', Throwable $previous = null): self
|
||||
public static function mimeType(string $location, string $reason = '', ?Throwable $previous = null): self
|
||||
{
|
||||
return static::create($location, FileAttributes::ATTRIBUTE_MIME_TYPE, $reason, $previous);
|
||||
}
|
||||
|
||||
public static function create(string $location, string $type, string $reason = '', Throwable $previous = null): self
|
||||
public static function create(string $location, string $type, string $reason = '', ?Throwable $previous = null): self
|
||||
{
|
||||
$e = new static("Unable to retrieve the $type for file at location: $location. {$reason}", 0, $previous);
|
||||
$e->reason = $reason;
|
||||
|
||||
@@ -27,7 +27,7 @@ final class UnableToSetVisibility extends RuntimeException implements Filesystem
|
||||
return $this->reason;
|
||||
}
|
||||
|
||||
public static function atLocation(string $filename, string $extraMessage = '', Throwable $previous = null): self
|
||||
public static function atLocation(string $filename, string $extraMessage = '', ?Throwable $previous = null): self
|
||||
{
|
||||
$message = "Unable to set visibility for file {$filename}. $extraMessage";
|
||||
$e = new static(rtrim($message), 0, $previous);
|
||||
|
||||
@@ -19,7 +19,7 @@ final class UnableToWriteFile extends RuntimeException implements FilesystemOper
|
||||
*/
|
||||
private $reason;
|
||||
|
||||
public static function atLocation(string $location, string $reason = '', Throwable $previous = null): UnableToWriteFile
|
||||
public static function atLocation(string $location, string $reason = '', ?Throwable $previous = null): UnableToWriteFile
|
||||
{
|
||||
$e = new static(rtrim("Unable to write file at location: {$location}. {$reason}"), 0, $previous);
|
||||
$e->location = $location;
|
||||
|
||||
Reference in New Issue
Block a user