The Wayback Machine - https://web.archive.org/web/20201214140447/https://github.com/laravel/framework/pull/33612
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.x] Flysystem v2 #33612

Merged
merged 7 commits into from Nov 30, 2020
Merged

[9.x] Flysystem v2 #33612

merged 7 commits into from Nov 30, 2020

Conversation

@driesvints
Copy link
Member

@driesvints driesvints commented Jul 21, 2020

Initial attempt at migrating to (currently unreleased) Flysystem v2. Might be a little too soon for Laravel 8. In draft until Flysystem v2 has been released.

Breaking Changes

  • Any write operations (like put, write, writeStream, etc) now overwrite by default. Checking for existing files needs to be done in user land from now on.
  • writeStream no longer throws a FileExistsException. Since this exception is nowhere used anymore in the framework, it's been removed.
  • Similarly, get & readStream no longer throw a FileNotFoundException exception when a file exists. This is because the underlying Flysystem integration no longer distinguishes this specific failure from any other read failure. Both methods will return null when they cannot read a file.
  • delete returns true now even if the file wasn't found.
  • Using custom filesystem creators in a service provider now requires them to return an instance of Illuminate\Contracts\Filesystem\Filesystem rather than League\Flysystem\FilesystemInterface like before. See #33612 (comment)
  • The FTP driver now ships as a separate league package and needs to be explicitly required through Composer for it to be used.
  • The concept of the cached adapter has been removed from Flysystem v2 and thus also from Laravel.
  • Illuminate\Filesystem\FilesystemAdapter's constructor now requires an extra $adapter argument and an optional $options argument.
@driesvints driesvints marked this pull request as draft Jul 21, 2020
}

return $driver;
return $this->customCreators[$config['driver']]($this->app, $config);

This comment has been minimized.

@driesvints

driesvints Jul 24, 2020
Author Member

These changes require custom creators to return an instance of Illuminate\Contracts\Filesystem\Filesystem rather than an instance of League\Flysystem\FilesystemInterface. The reason for that is that creating a FilesystemAdapter instance is now much more complex than what the previous adapt method did (see a bit further below).

@driesvints driesvints force-pushed the flysystem-v2 branch 4 times, most recently from d6a20ae to 81851e5 Jul 24, 2020
@driesvints driesvints force-pushed the flysystem-v2 branch from 5b56283 to 7e4d88c Aug 4, 2020
@driesvints
Copy link
Member Author

@driesvints driesvints commented Aug 4, 2020

Feel free to ignore the failing "prefer-lowest" tests as they test the old alpha.1 which get pulled in because of composer's "prefer-lowest" flag. The most recent version works.

Fixed.

composer.json Outdated Show resolved Hide resolved
@driesvints driesvints changed the title [8.x] Flysystem v2 [9.x] Flysystem v2 Aug 11, 2020
@driesvints driesvints force-pushed the flysystem-v2 branch 2 times, most recently from 8f679ed to ee36968 Aug 24, 2020
@driesvints driesvints force-pushed the flysystem-v2 branch from ee36968 to 54ac2c7 Sep 28, 2020
@driesvints driesvints changed the base branch from master to 8.x Sep 28, 2020
@driesvints driesvints changed the base branch from 8.x to master Sep 28, 2020
@driesvints driesvints force-pushed the flysystem-v2 branch from 54ac2c7 to c544ffc Oct 22, 2020
@driesvints driesvints force-pushed the flysystem-v2 branch from c544ffc to c6a2f49 Nov 16, 2020
driesvints added 5 commits Jul 24, 2020
@driesvints driesvints force-pushed the flysystem-v2 branch from c6a2f49 to 2e8c2fb Nov 27, 2020
@driesvints driesvints marked this pull request as ready for review Nov 27, 2020
composer.json Outdated Show resolved Hide resolved
@taylorotwell taylorotwell merged commit 6095161 into master Nov 30, 2020
26 checks passed
26 checks passed
PHP 7.3 - prefer-lowest
Details
PHP 7.3 - prefer-lowest
Details
PHP 7.3 - prefer-stable
Details
PHP 7.3 - prefer-stable
Details
PHP 7.4 - prefer-lowest
Details
PHP 7.4 - prefer-lowest
Details
PHP 7.4 - prefer-stable
Details
PHP 7.4 - prefer-stable
Details
PHP 8 - prefer-lowest
Details
PHP 8 - prefer-lowest
Details
PHP 8 - prefer-stable
Details
PHP 8 - prefer-stable
Details
PHP 7.3 - prefer-lowest - Windows
Details
PHP 7.3 - prefer-lowest - Windows
Details
PHP 7.3 - prefer-stable - Windows
Details
PHP 7.3 - prefer-stable - Windows
Details
PHP 7.4 - prefer-lowest - Windows
Details
PHP 7.4 - prefer-lowest - Windows
Details
PHP 7.4 - prefer-stable - Windows
Details
PHP 7.4 - prefer-stable - Windows
Details
PHP 8 - prefer-lowest - Windows
Details
PHP 8 - prefer-lowest - Windows
Details
PHP 8 - prefer-stable - Windows
Details
PHP 8 - prefer-stable - Windows
Details
continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/styleci/push The analysis has passed
Details
@taylorotwell taylorotwell deleted the flysystem-v2 branch Nov 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.