Skip to content

Commit

Permalink
Upgrade to v8 (spatie#1728)
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze authored Mar 9, 2020
1 parent 7d6b634 commit 1f4dabf
Show file tree
Hide file tree
Showing 240 changed files with 3,022 additions and 2,933 deletions.
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

0 comments on commit 1f4dabf

Please sign in to comment.