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

Upgrade to v8 #1728

Merged
merged 121 commits into from
Mar 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
00ec7c5
wip
freekmurze Feb 10, 2020
9fcfa60
wip
freekmurze Feb 10, 2020
f5d0c08
wip
freekmurze Feb 10, 2020
fe23ae0
wip
freekmurze Feb 10, 2020
0fa2f72
simlify url generation
freekmurze Feb 10, 2020
834a2ea
wip
freekmurze Feb 10, 2020
eb5091d
make pdf-to-image optional
freekmurze Feb 10, 2020
2d0e2e2
add shouldMatchBothExtensionsAndMimeTypes
freekmurze Feb 10, 2020
3270616
Added progress bar for clear command (#1623)
ahmed-aliraqi Feb 10, 2020
04cff20
wip
freekmurze Feb 10, 2020
6d8f452
Merge branch 'v8' of github.com:spatie/laravel-medialibrary into v8
freekmurze Feb 10, 2020
d2d038c
wip
freekmurze Feb 11, 2020
d9c9e2f
wip
freekmurze Feb 11, 2020
b3bb509
use PHP 7.4 features
freekmurze Feb 11, 2020
ba9e2b8
wip
freekmurze Feb 11, 2020
f5c5290
wip
freekmurze Feb 11, 2020
84fcfe3
wip
freekmurze Feb 11, 2020
3aca65d
clean up tests
freekmurze Feb 11, 2020
fd71bba
rename namespace
freekmurze Feb 11, 2020
05412a6
v8
freekmurze Feb 11, 2020
323eb4b
wip
freekmurze Feb 11, 2020
d54cf41
fix doc links
freekmurze Feb 11, 2020
0e0220e
wip
freekmurze Feb 11, 2020
dba0740
add typehint
freekmurze Feb 11, 2020
23f81a3
v8
freekmurze Feb 11, 2020
9be0e48
wip
freekmurze Feb 11, 2020
f34400c
Add support for loading attribute (#1730)
freekmurze Feb 11, 2020
1dd928d
simplify path generator
freekmurze Feb 11, 2020
2cde964
wip
freekmurze Feb 11, 2020
aebd4f0
use media to determine conversion file name
freekmurze Feb 11, 2020
fd416e3
add conversion file namers
freekmurze Feb 11, 2020
1096863
wip
freekmurze Feb 11, 2020
4310f43
wip
freekmurze Feb 11, 2020
319d67f
wip
freekmurze Feb 11, 2020
bbf09e0
wip
freekmurze Feb 11, 2020
9279f59
wip
freekmurze Feb 11, 2020
a732089
wip
freekmurze Feb 11, 2020
511d42a
wip
freekmurze Feb 11, 2020
0e42ad2
wip
freekmurze Feb 11, 2020
b2f0d8c
wip
freekmurze Feb 11, 2020
1a312f5
wip
freekmurze Feb 11, 2020
c8c0be5
wip
freekmurze Feb 11, 2020
c9cbf4f
Scope trim_trailing_whitespace setting change to blade files (#1732)
sebastiandedeyne Feb 12, 2020
4037401
v8
freekmurze Feb 13, 2020
e939330
Merge branch 'v8' of github.com:spatie/laravel-medialibrary into v8
freekmurze Feb 13, 2020
991a7cc
use uuid type
freekmurze Feb 18, 2020
46aa558
language fix
freekmurze Feb 18, 2020
eb020bf
fix types
freekmurze Feb 18, 2020
da70a23
wip
freekmurze Feb 18, 2020
23f1db9
Fix typo
brendt Feb 18, 2020
28c8498
wip
freekmurze Feb 18, 2020
f3eed3f
remove docblock
freekmurze Feb 18, 2020
6f0619c
add return type
freekmurze Feb 18, 2020
0c9aaa3
wip
freekmurze Feb 18, 2020
04aca0a
Merge branch 'v8' of github.com:spatie/laravel-medialibrary into v8
freekmurze Feb 18, 2020
5f71d73
wip
freekmurze Feb 18, 2020
e577a31
wip
freekmurze Feb 18, 2020
15f883a
wip
freekmurze Mar 3, 2020
1aceb38
wip
freekmurze Mar 3, 2020
8969f53
v8
freekmurze Mar 4, 2020
1f5947a
move traits to concerns
freekmurze Mar 4, 2020
5e56b4e
wip
freekmurze Mar 4, 2020
cc81f70
v8
freekmurze Mar 4, 2020
535d02e
wip
freekmurze Mar 4, 2020
f50b191
v8
freekmurze Mar 4, 2020
5da20f1
wip
freekmurze Mar 4, 2020
b429aae
v8
freekmurze Mar 4, 2020
6c9a224
wip
freekmurze Mar 4, 2020
2cb959b
v8
freekmurze Mar 4, 2020
d69beb0
wip
freekmurze Mar 4, 2020
a8656d1
wip
freekmurze Mar 4, 2020
faf2bd0
wip
freekmurze Mar 4, 2020
e613da9
wip
freekmurze Mar 4, 2020
7a8fa76
wip
freekmurze Mar 4, 2020
b011005
wip
freekmurze Mar 4, 2020
2a60ce5
wip
freekmurze Mar 4, 2020
0f433a9
v8
freekmurze Mar 4, 2020
0ffcdb9
wip
freekmurze Mar 4, 2020
6b9b44d
v8
freekmurze Mar 4, 2020
8c75fe5
wip
freekmurze Mar 4, 2020
3f92e31
wip
freekmurze Mar 4, 2020
cf9349f
v8
freekmurze Mar 4, 2020
9bf4f25
wip
freekmurze Mar 4, 2020
282b6f2
wip
freekmurze Mar 4, 2020
8ad307f
v8
freekmurze Mar 4, 2020
10e97e0
v8
freekmurze Mar 4, 2020
dedcdaa
wip
freekmurze Mar 4, 2020
6b9ccab
wip
freekmurze Mar 4, 2020
1f9e7db
wip
freekmurze Mar 4, 2020
b6e781f
v8
freekmurze Mar 5, 2020
040c175
v8
freekmurze Mar 5, 2020
8d3cf34
v8
freekmurze Mar 5, 2020
9b2d2bd
v8
freekmurze Mar 5, 2020
f76ffe5
v8
freekmurze Mar 5, 2020
2953bfe
wip
freekmurze Mar 5, 2020
1a6bbf1
wip
freekmurze Mar 5, 2020
e8144c3
v8
freekmurze Mar 6, 2020
c96d70c
wip
freekmurze Mar 6, 2020
ebf416d
v8
freekmurze Mar 6, 2020
9da10a4
wip
freekmurze Mar 6, 2020
c2aab59
wip
freekmurze Mar 6, 2020
852d941
wip
freekmurze Mar 6, 2020
a2cf12d
wip
freekmurze Mar 6, 2020
c56a5c5
wip
freekmurze Mar 6, 2020
7a44df6
wip
freekmurze Mar 6, 2020
6379638
wip
freekmurze Mar 6, 2020
4bde62c
wip
freekmurze Mar 8, 2020
66a9da4
Fix namespace in docs
AlexVanderbist Mar 9, 2020
d5f00ce
Fix docs
AlexVanderbist Mar 9, 2020
98be79e
wip
freekmurze Mar 9, 2020
10b15bb
Merge branch 'v8' of github.com:spatie/laravel-medialibrary into v8
freekmurze Mar 9, 2020
ad66c53
wip
freekmurze Mar 9, 2020
da2bea6
wip
freekmurze Mar 9, 2020
1a556c0
wip
freekmurze Mar 9, 2020
a09aa32
wip
freekmurze Mar 9, 2020
4fb67c2
Merge branch 'master' into v8
freekmurze Mar 9, 2020
7b10833
wip
freekmurze Mar 9, 2020
0e31e7b
Merge branch 'v8' of github.com:spatie/laravel-medialibrary into v8
freekmurze Mar 9, 2020
13dd804
Use native file copy (#1758)
mattdfloyd Mar 9, 2020
481939a
wip
freekmurze Mar 9, 2020
5d239ef
Merge branch 'v8' of github.com:spatie/laravel-medialibrary into v8
freekmurze Mar 9, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.blade.php]
insert_final_newline = false
trim_trailing_whitespace = false

[*.md]
trim_trailing_whitespace = false
20 changes: 14 additions & 6 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,26 @@ jobs:

runs-on: ubuntu-latest
strategy:
fail-fast: true
fail-fast: false
matrix:
php: [7.4, 7.3, 7.2]
laravel: [7.*, 6.*, 5.8.*]
php: [7.4]
laravel: [7.*, 6.*]
dependency-version: [prefer-lowest, prefer-stable]
include:
- laravel: 7.*
testbench: 5.*
- laravel: 6.*
testbench: 4.*
- laravel: 5.8.*
testbench: 3.8.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}

steps:
- name: Update apt
run: sudo apt-get update --fix-missing

- name: Install ffmpeg
run: sudo apt-get install ffmpeg

- name: Checkout code
uses: actions/checkout@v1

Expand All @@ -49,11 +53,15 @@ jobs:
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer require league/flysystem-aws-s3-v3
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest

- name: Execute tests
run: vendor/bin/phpunit
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
AWS_BUCKET: ${{ secrets.AWS_BUCKET }}

- name: Send Slack notification
uses: 8398a7/action-slack@v2
Expand Down
36 changes: 27 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

All notable changes to `laravel-medialibrary` will be documented in this file

## 8.0.0 - 2020-03-09

- added `uuid` on `media` table
- an empty string is now a proper collection name. `getMedia('')` will not return media from the default collection anymore (#1697).
- add the ability to store conversions on a separate disk
- simplify URL generation. You can now just use the `root` and `url` properties on a configured disk
- spatie/pdf-to-image is now a suggestion dependency, removing the need for always having to install ext-imagick
- added `shouldMatchBothExtensionsAndMimeTypes` to `Spatie\MediaLibrary\ImageGenerators\BaseGenerator`
- added progress bar on the clean command (#1623)
- the `UrlGenerator` interface now contains all required methods (#1656)
- use PHP 7.4 features where possible
- the namespace has been renamed from `Spatie\MediaLibrary` to `Spatie\MediaLibrary`. All code where `MediaLibrary` was used is renamed to `MediaLibrary`
- added support for the `loading` attribute (#1667)
- conversion files can now be named using the `conversion_file_namer` key in the `media-library` config file (#1636)
- improved naming of classes and namespaces.

To learn how to upgrade, take a look in UPGRADING.md

## 7.19.3 - 2020-03-09

- fix responsive images extension (#1752)
Expand Down Expand Up @@ -325,7 +343,7 @@ All notable changes to `laravel-medialibrary` will be documented in this file

- added `move` and `copy` methods on `Media`

- file names will be lowercased when adding them to the medialibrary
- file names will be lowercased when adding them to the media library
- the names of converted images will now start with the name of the original file

- dropped support for soft deletes
Expand Down Expand Up @@ -389,7 +407,7 @@ All notable changes to `laravel-medialibrary` will be documented in this file

## 6.5.0 - 2017-10-24

- add `only-missing` and `only` options to the `medialibrary:regenerate` command
- add `only-missing` and `only` options to the `media-library:regenerate` command

## 6.4.2 - 2017-10-20

Expand Down Expand Up @@ -564,7 +582,7 @@ All notable changes to `laravel-medialibrary` will be documented in this file
- remove `toCollection` and `toCollectionOnDisk` and `toMediaLibraryOnDisk`
- replace dependency on `spatie/laravel-glide` by `spatie/image`
- mime types will now be stored in the database so they can be queried even if files are stored on external filesystems
- rename `Spatie\MedialibraryFilesystemInterface` to `Spatie\Medialibrary\Filesystem\Filesystem`
- rename `Spatie\MediaLibraryFilesystemInterface` to `Spatie\MediaLibrary\Filesystem\Filesystem`
- remove `withCustomProperties`, `getNestedCustomProperty`, `setNestedCustomProperty`, `forgetNestedCustomProperty` and `hasNestedCustomProperty`
- drop support for Lumen and anything below Laravel 5.4
- clean up all classes
Expand Down Expand Up @@ -653,8 +671,8 @@ All notable changes to `laravel-medialibrary` will be documented in this file

## 4.5.0 - 2016-07-09

- added `medialibrary:clean` command
- the `medialibrary:regenerate` will continue regenerating files even if a primary media file is missing
- added `media-library:clean` command
- the `media-library:regenerate` will continue regenerating files even if a primary media file is missing

## 4.4.1 - 2016-07-08
- Fix regeneration command (see #260). It'll now properly regenerate files for all passed media id's
Expand Down Expand Up @@ -704,7 +722,7 @@ All notable changes to `laravel-medialibrary` will be documented in this file
- The `regenerate`-command now accepts an `ids`-option

## 3.15.0
- Added `medialibrary:clear` command
- Added `media-library:clear` command

## 3.14.1
- Make migrations compatible with mysql's strict mode
Expand Down Expand Up @@ -904,7 +922,7 @@ This version is a complete rewrite. Though there are lots of breaking changes mo
- Bugfix: make compatible with Laravel 5.1

## 1.5.5
- Bugfix: Renamed the boot method of MedialibraryModeltrait so it plays nice with the boot method of
- Bugfix: Renamed the boot method of MediaLibraryModeltrait so it plays nice with the boot method of
other traits and the base model.

## 1.5.4
Expand All @@ -922,13 +940,13 @@ other traits and the base model.
- Added `getImageProfileProperties()`to interface

## 1.1.3
- Create the medialibrary directory if it does not exist
- Create the media library directory if it does not exist

## 1.1.2
- Files without extensions are now allowed

## 1.1.1
- Added check to make sure the file that must be added to the medialibrary exists
- Added check to make sure the file that must be added to the media library exists

## 1.1.0
- Added option to specify the name of the queue that should be used to create image manipulations
Expand Down
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ $newsItem->addMedia($bigFile)->toMediaCollection('downloads', 's3');

The storage of the files is handled by [Laravel's Filesystem](https://laravel.com/docs/5.6/filesystem),
so you can use any filesystem you like. Additionally the package can create image manipulations
on images and pdfs that have been added in the medialibrary.
on images and pdfs that have been added in the media library.

Spatie is a webdesign agency in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource).

Expand All @@ -42,7 +42,7 @@ We highly appreciate you sending us a postcard from your hometown, mentioning wh

## Documentation

You'll find the documentation on [https://docs.spatie.be/laravel-medialibrary/v7](https://docs.spatie.be/laravel-medialibrary/v7).
You'll find the documentation on [https://docs.spatie.be/laravel-medialibrary/v8](https://docs.spatie.be/laravel-medialibrary/v8).

Find yourself stuck using the package? Found a bug? Do you have general questions or suggestions for improving the media library? Feel free to [create an issue on GitHub](https://github.com/spatie/laravel-medialibrary/issues), we'll try to address it as soon as possible.

Expand All @@ -57,7 +57,7 @@ If you've found a bug regarding security please mail [[email protected]](mailto:fr
You can install this package via composer using this command:

```bash
composer require "spatie/laravel-medialibrary:^7.0.0"
composer require "spatie/laravel-medialibrary:^8.0.0"
```

The package will automatically register itself.
Expand Down Expand Up @@ -106,7 +106,7 @@ return [
/*
* The class name of the media model that should be used.
*/
'media_model' => Spatie\MediaLibrary\Models\Media::class,
'media_model' => Spatie\MediaLibrary\MediaCollections\Models\Media::class,

/*
* The engine that should perform the image conversions.
Expand Down Expand Up @@ -150,15 +150,15 @@ return [
* These generators will be used to create an image of media files.
*/
'image_generators' => [
Spatie\MediaLibrary\ImageGenerators\FileTypes\Image::class,
Spatie\MediaLibrary\ImageGenerators\FileTypes\Webp::class,
Spatie\MediaLibrary\ImageGenerators\FileTypes\Pdf::class,
Spatie\MediaLibrary\ImageGenerators\FileTypes\Svg::class,
Spatie\MediaLibrary\ImageGenerators\FileTypes\Video::class,
Spatie\MediaLibrary\Conversions\ImageGenerators\Image::class,
Spatie\MediaLibrary\Conversions\ImageGenerators\Webp::class,
Spatie\MediaLibrary\Conversions\ImageGenerators\Pdf::class,
Spatie\MediaLibrary\Conversions\ImageGenerators\Svg::class,
Spatie\MediaLibrary\Conversions\ImageGenerators\Video::class,
],

/*
* Medialibrary will try to optimize all converted images by removing
* MediaLibrary will try to optimize all converted images by removing
* metadata and applying a little bit of compression. These are
* the optimizers that will be used by default.
*/
Expand Down Expand Up @@ -186,7 +186,7 @@ return [

/*
* The path where to store temporary files while performing image conversions.
* If set to null, storage_path('medialibrary/temp') will be used.
* If set to null, storage_path('media-library/temp') will be used.
*/
'temporary_directory_path' => null,

Expand All @@ -200,7 +200,7 @@ return [
];
```

By default medialibrary will store it's files on Laravel's `public` disk. If you want a dedicated disk you should add a disk to `app/config/filesystems.php`. This would be a typical configuration:
By default, media library will store it's files on Laravel's `public` disk. If you want a dedicated disk you should add a disk to `app/config/filesystems.php`. This would be a typical configuration:

```php
...
Expand All @@ -216,7 +216,7 @@ By default medialibrary will store it's files on Laravel's `public` disk. If you
...
```

All files of the medialibrary will be stored on that disk. If you are planning on
All files of the media library will be stored on that disk. If you are planning on
working with the image manipulations you should configure a queue on your service
with the name specified in the config file.

Expand Down Expand Up @@ -262,7 +262,7 @@ public function register()
}
```

Manually copy the package config file to `app\config\laravel-medialibrary.php` (you may need to
Manually copy the package config file to `app\config\laravel-media-library.php` (you may need to
create the config directory if it does not already exist).

Copy the [Laravel filesystem config file](https://github.com/laravel/laravel/blob/v6.4.0/config/filesystems.php) into `app\config\filesystem.php`. You should add a disk configuration to the filesystem config matching the `default_filesystem` specified in the laravel-medialibrary config file.
Expand All @@ -271,7 +271,7 @@ Finally, update `boostrap/app.php` to load both config files:

```php
// bootstrap/app.php
$app->configure('medialibrary');
$app->configure('media-library');
$app->configure('filesystems');
```

Expand Down
22 changes: 19 additions & 3 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

Because there are many breaking changes an upgrade is not that easy. There are many edge cases this guide does not cover. We accept PRs to improve this guide.

## From v7 to v8

- internally the media library has been restructured an nearly all namespaces have changed. Class names remained the same. In your application code hunt to any usages of classes that start with `Spatie\MediaLibrary`. Take a look in the source code of medialibrary what the new namespace of the class is and use that.
- rename `config/medialibrary.php` to `config/media-library.php`
- all medialibrary commands have been renamed from `medialibrary:xxx` to `media-library:xxx`. Make sure to update all media library commands in your console kernel.
- the `Spatie\MediaLibrary\HasMedia\HasMediaTrait` has been renamed to `Spatie\MediaLibrary\HasMedia\InteractsWithMedia`. Make sure to update this in all models that use media.
- Add a `conversions_disk` field to the `media` table (you'll find the definition in the migrations file of the package) and for each row copy the value of `disk` to `conversions_disk`.
- Add a `uuid` field to the `media` table and fill each row with a unique value, preferably a `uuid`
- Url generation has been vastly simplified. You should set the `url_generator` in the `media-library` config file to `Spatie\MediaLibrary\Support\UrlGenerator\DefaultUrlGenerator::class`. It will be able to handle most disks.
- remove the `s3.domain` key from the `media-library` config file
- spatie/pdf-to-image is now a suggestion dependency. Make sure to install it, if you want to create thumbnails for PDFs or SVGs
- `registerMediaConversions` and `registerMediaCollections` should now use the `void` return type.
- if the `path_generator` key in the `media-library` config file was set to `null`, change the value to `Spatie\MediaLibrary\Support\PathGenerator\DefaultPathGenerator::class`
- the `rawUrlEncodeFilename` method on `BaseUrlGenerator` has been removed. Remove all calls in your own code to this method.
- `getConversionFile` on `Conversion` now accepts a `Media` instance instead of a `string`. In normal circumstance you wouldn't have used this function directly.

## 7.3.0

- Before `hasGeneratedConversion` will work, the custom properties
Expand Down Expand Up @@ -42,7 +58,7 @@ to

- change the `defaultFilesystem` key in the config file to `default_filesystem`
- add the `image_optimizers` key from the default config file to your config file.
- be aware that the medialibrary will now optimize all conversions by default. If you do not want this tack on `nonOptimized` to all your media conversions.
- be aware that the media library will now optimize all conversions by default. If you do not want this tack on `nonOptimized` to all your media conversions.
- `toMediaLibrary` has been removed. Use `toMediaCollection` instead.
- `toMediaLibraryOnCloudDisk` has been removed. Use `toMediaCollectionOnCloudDisk` instead.

Expand All @@ -53,13 +69,13 @@ to
- media conversions are now handled by `spatie/image`. Convert all manipulations on your conversion to manipulations supported by `spatie/image`.
- add a `mime_type` column to the `media` table, manually populate the column with the right values.
- calls to `getNestedCustomProperty`, `setNestedCustomProperty`, `forgetNestedCustomProperty` and `hasNestedCustomProperty` should be replaced by their non-nested counterparts.
- All exceptions have been renamed. If you were catching medialibrary specific exception please look up the new name in /src/Exceptions.
- All exceptions have been renamed. If you were catching media library specific exception please look up the new name in /src/Exceptions.
- be aware`getMedia` and related functions now return only the media from the `default` collection
- `image_generators` have now been added to the config file.


## From v3 to v4
- All exceptions have been renamed. If you were catching medialibrary specific exception please look up the new name in /src/Exceptions.
- All exceptions have been renamed. If you were catching media library specific exception please look up the new name in /src/Exceptions.
- Glide has been upgraded from 0.3 in 1.0. Glide renamed some operations in their 1.0 release, most notably the `crop` and `fit` ones. If you were using those in your conversions refer the Glide documentation how they should be changed.

## From v2 to v3
Expand Down
Loading