diff --git a/.gitattributes b/.gitattributes index 189463dc..3f8ef18d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8,6 +8,7 @@ /.travis.yml export-ignore /phpunit.xml.dist export-ignore /.scrutinizer.yml export-ignore +/.styleci.yml export-ignore /tests export-ignore /.editorconfig export-ignore /docs export-ignore diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 4edb979b..e62b87fb 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -2,6 +2,7 @@ name: run-tests on: push: + pull_request: schedule: - cron: '0 0 * * *' @@ -13,9 +14,11 @@ jobs: fail-fast: true matrix: php: [7.4, 7.3, 7.2] - laravel: [6.*, 5.8.*] + laravel: [7.*, 6.*, 5.8.*] dependency-version: [prefer-lowest, prefer-stable] include: + - laravel: 7.* + testbench: 5.* - laravel: 6.* testbench: 4.* - laravel: 5.8.* diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 73550bb8..bb976656 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,10 +1,22 @@ filter: excluded_paths: [tests/*] checks: - php: true + php: + code_rating: true + remove_extra_empty_lines: true + remove_php_closing_tag: true + remove_trailing_whitespace: true + fix_use_statements: + remove_unused: true + preserve_multiple: false + preserve_blanklines: true + order_alphabetically: true + fix_php_opening_tag: true + fix_linefeed: true + fix_line_ending: true + fix_identation_4spaces: true + fix_doc_comments: true tools: - php_mess_detector: true - php_pdepend: true external_code_coverage: false php_analyzer: true php_code_coverage: false @@ -13,7 +25,6 @@ tools: standard: PSR2 filter: paths: ['src'] - sensiolabs_security_checker: true php_loc: enabled: true excluded_dirs: [vendor, tests] diff --git a/CHANGELOG.md b/CHANGELOG.md index fdcbbb82..dc90ec35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [7.17.2](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.17.1...Okipa:7.17.2) + +2020-02-14 + +* Implemented https://github.com/spatie/laravel-medialibrary/releases/tag/7.18.2 release. + ## [7.17.1](https://github.com/Okipa/laravel-medialibrary-ext/compare/7.17.0...Okipa:7.17.1) 2020-01-22 diff --git a/composer.json b/composer.json index a60d0fa6..844cfc52 100644 --- a/composer.json +++ b/composer.json @@ -4,16 +4,17 @@ "keywords": [ "spatie", "okipa", - "laravel-medialibrary-extension", "laravel-medialibrary", - "laravel", + "laravel-medialibrary-extension", "media", - "library", - "package" + "conversion", + "images", + "downloads", + "cms", + "laravel" ], "homepage": "https://github.com/okipa/laravel-medialibrary-ext", "license": "MIT", - "type": "library", "authors": [ { "name": "Arthur LORENT", @@ -29,27 +30,28 @@ ], "require": { "php": "^7.2", - "illuminate/bus": "~5.8.35|^6.0", - "illuminate/console": "~5.8.35|^6.0", - "illuminate/database": "~5.8.35|^6.0", - "illuminate/pipeline": "~5.8.35|^6.0", - "illuminate/support": "~5.8.35|^6.0", + "ext-fileinfo": "*", + "illuminate/bus": "~5.8.35|^6.0|^7.0", + "illuminate/console": "~5.8.35|^6.0|^7.0", + "illuminate/database": "~5.8.35|^6.0|^7.0", + "illuminate/pipeline": "~5.8.35|^6.0|^7.0", + "illuminate/support": "~5.8.35|^6.0|^7.0", "league/flysystem": "^1.0.8", - "symfony/console": "^4.4", "maennchen/zipstream-php": "^1.0", "spatie/image": "^1.4.0", "spatie/pdf-to-image": "^2.0", "spatie/temporary-directory": "^1.1", - "ext-fileinfo": "*", - "symfony/mime": "^4.0||^5.0" + "symfony/console": "^4.4|^5.0", + "symfony/mime": "^4.0||^5.0", + "ext-json": "*" }, "require-dev": { "ext-pdo_sqlite": "*", "doctrine/dbal": "^2.5.2", "guzzlehttp/guzzle": "^6.3", "league/flysystem-aws-s3-v3": "^1.0.13", - "mockery/mockery": "^1.0.0", - "orchestra/testbench": "~3.8.0|^4.0", + "mockery/mockery": "^1.0", + "orchestra/testbench": "^3.8|^4.0|^5.0", "phpunit/phpunit": "^8.0", "spatie/phpunit-snapshot-assertions": "^2.0" }, diff --git a/src/MediaObserver.php b/src/MediaObserver.php index 21d8332f..ee57553e 100644 --- a/src/MediaObserver.php +++ b/src/MediaObserver.php @@ -3,6 +3,7 @@ namespace Spatie\MediaLibrary; use Illuminate\Database\Eloquent\SoftDeletes; +use Illuminate\Foundation\Application; use Spatie\MediaLibrary\Filesystem\Filesystem; use Spatie\MediaLibrary\Models\Media; @@ -28,7 +29,13 @@ public function updated(Media $media) return; } - if ($media->manipulations !== json_decode($media->getOriginal('manipulations'), true)) { + $original = $media->getOriginal('manipulations'); + + if (! $this->isLaravel7OrHigher()) { + $original = json_decode($original, true); + } + + if ($media->manipulations !== $original) { $eventDispatcher = Media::getEventDispatcher(); Media::unsetEventDispatcher(); @@ -48,4 +55,17 @@ public function deleted(Media $media) app(Filesystem::class)->removeAllFiles($media); } + + private function isLaravel7OrHigher(): bool + { + if (Application::VERSION === '7.x-dev') { + return true; + } + + if (version_compare(Application::VERSION, '7.0', '>=')) { + return true; + } + + return false; + } } diff --git a/src/MediaStream.php b/src/MediaStream.php index 4c1a5a9f..7914597b 100644 --- a/src/MediaStream.php +++ b/src/MediaStream.php @@ -6,7 +6,6 @@ use Illuminate\Support\Collection; use Spatie\MediaLibrary\Models\Media; use Symfony\Component\HttpFoundation\StreamedResponse; -use ZipStream\Option\Archive; use ZipStream\ZipStream; class MediaStream implements Responsable