diff --git a/CHANGELOG.md b/CHANGELOG.md index cdf50a1..8423fca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). In order to read more about upgrading and BC breaks have a look at the [UPGRADE Document](UPGRADE.md). +## 1.3.0 (1. December 2020) + ++ [#11](https://github.com/luyadev/luya-aws/issues/11) The upload object have a default max-age cache control header of 30 days, this can be turned of by setting `maxAge=false`. + ## 1.2.1 (19. November 2020) + [#10](https://github.com/luyadev/luya-aws/pull/10) Fix issue where content type was not provided correctly, also ensure the disposition is set correctly when uploading or updating and object. diff --git a/composer.lock b/composer.lock index fe0bc5e..4f6212a 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "aws/aws-sdk-php", - "version": "3.151.0", + "version": "3.164.1", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "10db635441685088731345da13c6680a3dacb003" + "reference": "bfd16503bd71491e654483773efd23c431817710" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/10db635441685088731345da13c6680a3dacb003", - "reference": "10db635441685088731345da13c6680a3dacb003", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/bfd16503bd71491e654483773efd23c431817710", + "reference": "bfd16503bd71491e654483773efd23c431817710", "shasum": "" }, "require": { @@ -89,37 +89,36 @@ "s3", "sdk" ], - "time": "2020-08-26T21:08:26+00:00" + "time": "2020-12-01T04:29:55+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "7.0.1", + "version": "7.2.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "2d9d3c186a6637a43193e66b097c50e4451eaab2" + "reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/2d9d3c186a6637a43193e66b097c50e4451eaab2", - "reference": "2d9d3c186a6637a43193e66b097c50e4451eaab2", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/0aa74dfb41ae110835923ef10a9d803a22d50e79", + "reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.6.1", - "php": "^7.2.5", + "guzzlehttp/promises": "^1.4", + "guzzlehttp/psr7": "^1.7", + "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0" }, "provide": { "psr/http-client-implementation": "1.0" }, "require-dev": { - "ergebnis/composer-normalize": "^2.0", "ext-curl": "*", - "php-http/client-integration-tests": "dev-phpunit8", - "phpunit/phpunit": "^8.5.5", + "php-http/client-integration-tests": "^3.0", + "phpunit/phpunit": "^8.5.5 || ^9.3.5", "psr/log": "^1.1" }, "suggest": { @@ -130,7 +129,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.0-dev" + "dev-master": "7.1-dev" } }, "autoload": { @@ -170,27 +169,45 @@ "rest", "web service" ], - "time": "2020-06-27T10:33:25+00:00" + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://github.com/alexeyshockov", + "type": "github" + }, + { + "url": "https://github.com/gmponos", + "type": "github" + } + ], + "time": "2020-10-10T11:47:56+00:00" }, { "name": "guzzlehttp/promises", - "version": "v1.3.1", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + "reference": "60d379c243457e073cff02bc323a2a86cb355631" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "url": "https://api.github.com/repos/guzzle/promises/zipball/60d379c243457e073cff02bc323a2a86cb355631", + "reference": "60d379c243457e073cff02bc323a2a86cb355631", "shasum": "" }, "require": { - "php": ">=5.5.0" + "php": ">=5.5" }, "require-dev": { - "phpunit/phpunit": "^4.0" + "symfony/phpunit-bridge": "^4.4 || ^5.1" }, "type": "library", "extra": { @@ -221,20 +238,20 @@ "keywords": [ "promise" ], - "time": "2016-12-20T10:07:11+00:00" + "time": "2020-09-30T07:37:28+00:00" }, { "name": "guzzlehttp/psr7", - "version": "1.6.1", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a" + "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/53330f47520498c0ae1f61f7e2c90f55690c06a3", + "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3", "shasum": "" }, "require": { @@ -247,15 +264,15 @@ }, "require-dev": { "ext-zlib": "*", - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10" }, "suggest": { - "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6-dev" + "dev-master": "1.7-dev" } }, "autoload": { @@ -292,7 +309,7 @@ "uri", "url" ], - "time": "2019-07-01T23:21:34+00:00" + "time": "2020-09-30T07:37:11+00:00" }, { "name": "mtdowling/jmespath.php", @@ -492,20 +509,20 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.18.1", + "version": "v1.20.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a" + "reference": "39d483bdf39be819deabf04ec872eb0b2410b531" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/a6977d63bf9a0ad4c65cd352709e230876f9904a", - "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/39d483bdf39be819deabf04ec872eb0b2410b531", + "reference": "39d483bdf39be819deabf04ec872eb0b2410b531", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "suggest": { "ext-mbstring": "For best performance" @@ -513,7 +530,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.18-dev" + "dev-main": "1.20-dev" }, "thanks": { "name": "symfony/polyfill", @@ -565,7 +582,7 @@ "type": "tidelift" } ], - "time": "2020-07-14T12:35:20+00:00" + "time": "2020-10-23T14:02:19+00:00" } ], "packages-dev": [ @@ -842,36 +859,31 @@ }, { "name": "doctrine/instantiator", - "version": "1.3.1", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "f350df0268e904597e3bd9c4685c53e0e333feea" + "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f350df0268e904597e3bd9c4685c53e0e333feea", - "reference": "f350df0268e904597e3bd9c4685c53e0e333feea", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", + "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^6.0", + "doctrine/coding-standard": "^8.0", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-shim": "^0.11", - "phpunit/phpunit": "^7.0" + "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" @@ -885,7 +897,7 @@ { "name": "Marco Pivetta", "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" + "homepage": "https://ocramius.github.io/" } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", @@ -908,7 +920,7 @@ "type": "tidelift" } ], - "time": "2020-05-29T17:27:14+00:00" + "time": "2020-11-10T18:47:58+00:00" }, { "name": "ezyang/htmlpurifier", @@ -1014,16 +1026,16 @@ }, { "name": "giggsey/libphonenumber-for-php", - "version": "8.12.8", + "version": "8.12.13", "source": { "type": "git", "url": "https://github.com/giggsey/libphonenumber-for-php.git", - "reference": "5a6e4e730de52f55882d2db27016e2916f8791e9" + "reference": "571bbbabdab5b1cf16550cb257005bb527fa0899" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/giggsey/libphonenumber-for-php/zipball/5a6e4e730de52f55882d2db27016e2916f8791e9", - "reference": "5a6e4e730de52f55882d2db27016e2916f8791e9", + "url": "https://api.github.com/repos/giggsey/libphonenumber-for-php/zipball/571bbbabdab5b1cf16550cb257005bb527fa0899", + "reference": "571bbbabdab5b1cf16550cb257005bb527fa0899", "shasum": "" }, "require": { @@ -1037,7 +1049,7 @@ "pear/versioncontrol_git": "^0.5", "phing/phing": "^2.7", "php-coveralls/php-coveralls": "^1.0|^2.0", - "phpunit/phpunit": "^4.8.36|^5.0", + "phpunit/phpunit": "^4.8.36|^5.0|^7.0", "symfony/console": "^2.8|^3.0" }, "type": "library", @@ -1078,7 +1090,7 @@ "phonenumber", "validation" ], - "time": "2020-08-13T17:48:08+00:00" + "time": "2020-11-12T14:42:30+00:00" }, { "name": "giggsey/locale", @@ -1131,24 +1143,24 @@ }, { "name": "imagine/imagine", - "version": "1.2.3", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/avalanche123/Imagine.git", - "reference": "cb2361e5bb4410b681462d8e4f912bc5dabf84ab" + "reference": "d2e18be6e930ca169e4f921ef73ebfc061bf55d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/avalanche123/Imagine/zipball/cb2361e5bb4410b681462d8e4f912bc5dabf84ab", - "reference": "cb2361e5bb4410b681462d8e4f912bc5dabf84ab", + "url": "https://api.github.com/repos/avalanche123/Imagine/zipball/d2e18be6e930ca169e4f921ef73ebfc061bf55d8", + "reference": "d2e18be6e930ca169e4f921ef73ebfc061bf55d8", "shasum": "" }, "require": { "php": ">=5.3.2" }, "require-dev": { - "friendsofphp/php-cs-fixer": "2.2.*", - "phpunit/phpunit": "^4.8 || ^5.7 || ^6.5 || ^7.5 || ^8.4" + "friendsofphp/php-cs-fixer": "^2.2", + "phpunit/phpunit": "^4.8 || ^5.7 || ^6.5 || ^7.5 || ^8.4 || ^9.3" }, "suggest": { "ext-gd": "to use the GD implementation", @@ -1185,7 +1197,7 @@ "image manipulation", "image processing" ], - "time": "2019-12-04T09:55:33+00:00" + "time": "2020-11-03T22:35:03+00:00" }, { "name": "lcobucci/jwt", @@ -1297,16 +1309,16 @@ }, { "name": "luyadev/luya-core", - "version": "1.7.0", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/luyadev/luya-core.git", - "reference": "112b225e58e5f15012309fcdcda12a49dce6a4f5" + "reference": "1e7011ff014b7146d2be84a4a0605a4a9e6c3c26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/luyadev/luya-core/zipball/112b225e58e5f15012309fcdcda12a49dce6a4f5", - "reference": "112b225e58e5f15012309fcdcda12a49dce6a4f5", + "url": "https://api.github.com/repos/luyadev/luya-core/zipball/1e7011ff014b7146d2be84a4a0605a4a9e6c3c26", + "reference": "1e7011ff014b7146d2be84a4a0605a4a9e6c3c26", "shasum": "" }, "require": { @@ -1351,25 +1363,25 @@ "yii", "yii2" ], - "time": "2020-08-26T09:03:03+00:00" + "time": "2020-11-24T10:22:12+00:00" }, { "name": "luyadev/luya-module-admin", - "version": "3.5.2", + "version": "3.9.0", "source": { "type": "git", "url": "https://github.com/luyadev/luya-module-admin.git", - "reference": "46ad9e6963c324b60a2ee2b25c3a34f44267fb02" + "reference": "6ed80eea2a6152a031ad27989abe8ca0e2f702f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/luyadev/luya-module-admin/zipball/46ad9e6963c324b60a2ee2b25c3a34f44267fb02", - "reference": "46ad9e6963c324b60a2ee2b25c3a34f44267fb02", + "url": "https://api.github.com/repos/luyadev/luya-module-admin/zipball/6ed80eea2a6152a031ad27989abe8ca0e2f702f5", + "reference": "6ed80eea2a6152a031ad27989abe8ca0e2f702f5", "shasum": "" }, "require": { "flowjs/flow-php-server": "^1.0", - "luyadev/luya-core": "^1.3", + "luyadev/luya-core": "^1.7", "robthree/twofactorauth": "^1.7", "sizeg/yii2-jwt": "^1.2", "whichbrowser/parser": "^2.0", @@ -1389,8 +1401,8 @@ "bower-asset/ui-cropper": "^1.0", "bower-asset/ui-router": "~0.4.0", "cebe/php-openapi": "^1.4", - "luyadev/luya-testsuite": "^1.0", - "twbs/bootstrap": "^4.3", + "luyadev/luya-testsuite": "^1.2", + "twbs/bootstrap": "^4.5", "unglue/client": "^1.4.1" }, "suggest": { @@ -1438,25 +1450,25 @@ "yii", "yii2" ], - "time": "2020-08-26T09:10:46+00:00" + "time": "2020-11-24T14:51:32+00:00" }, { "name": "luyadev/luya-module-cms", - "version": "3.3.6", + "version": "3.5.1", "source": { "type": "git", "url": "https://github.com/luyadev/luya-module-cms.git", - "reference": "be6cc102b9a5b29cb5e751ac40537acff158f274" + "reference": "987a32468bf2852094f0fdfcc42d1bb4544a8d09" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/luyadev/luya-module-cms/zipball/be6cc102b9a5b29cb5e751ac40537acff158f274", - "reference": "be6cc102b9a5b29cb5e751ac40537acff158f274", + "url": "https://api.github.com/repos/luyadev/luya-module-cms/zipball/987a32468bf2852094f0fdfcc42d1bb4544a8d09", + "reference": "987a32468bf2852094f0fdfcc42d1bb4544a8d09", "shasum": "" }, "require-dev": { "luyadev/luya-testsuite": "^1.0", - "twbs/bootstrap": "~4.3.0", + "twbs/bootstrap": "^4.3.0", "unglue/client": "^1.3" }, "type": "luya-core", @@ -1502,20 +1514,20 @@ "yii2", "yii2-cms" ], - "time": "2020-08-06T15:24:26+00:00" + "time": "2020-11-24T10:15:51+00:00" }, { "name": "luyadev/luya-testsuite", - "version": "1.1.1", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/luyadev/luya-testsuite.git", - "reference": "373ec1dd5490977c5ac962a0d3b6f5f14d92aea9" + "reference": "2f7d50d7788c4ce0b50ab26b5745e7d2ba4cf898" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/luyadev/luya-testsuite/zipball/373ec1dd5490977c5ac962a0d3b6f5f14d92aea9", - "reference": "373ec1dd5490977c5ac962a0d3b6f5f14d92aea9", + "url": "https://api.github.com/repos/luyadev/luya-testsuite/zipball/2f7d50d7788c4ce0b50ab26b5745e7d2ba4cf898", + "reference": "2f7d50d7788c4ce0b50ab26b5745e7d2ba4cf898", "shasum": "" }, "require": { @@ -1560,20 +1572,20 @@ "module", "php" ], - "time": "2020-08-18T10:13:12+00:00" + "time": "2020-09-22T16:12:09+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.10.1", + "version": "1.10.2", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5" + "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", - "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", + "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", "shasum": "" }, "require": { @@ -1614,7 +1626,7 @@ "type": "tidelift" } ], - "time": "2020-06-29T13:22:24+00:00" + "time": "2020-11-13T09:40:50+00:00" }, { "name": "phar-io/manifest", @@ -1769,16 +1781,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.2.1", + "version": "5.2.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "d870572532cd70bc3fab58f2e23ad423c8404c44" + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d870572532cd70bc3fab58f2e23ad423c8404c44", - "reference": "d870572532cd70bc3fab58f2e23ad423c8404c44", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", "shasum": "" }, "require": { @@ -1817,20 +1829,20 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-08-15T11:14:08+00:00" + "time": "2020-09-03T19:13:55+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.3.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e878a14a65245fbe78f8080eba03b47c3b705651" + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e878a14a65245fbe78f8080eba03b47c3b705651", - "reference": "e878a14a65245fbe78f8080eba03b47c3b705651", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", "shasum": "" }, "require": { @@ -1862,31 +1874,35 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2020-06-27T10:12:23+00:00" + "time": "2020-09-17T18:55:26+00:00" }, { "name": "phpmailer/phpmailer", - "version": "v6.1.7", + "version": "v6.2.0", "source": { "type": "git", "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "2c2370ba3df7034f9eb7b8f387c97b52b2ba5ad0" + "reference": "e38888a75c070304ca5514197d4847a59a5c853f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/2c2370ba3df7034f9eb7b8f387c97b52b2ba5ad0", - "reference": "2c2370ba3df7034f9eb7b8f387c97b52b2ba5ad0", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/e38888a75c070304ca5514197d4847a59a5c853f", + "reference": "e38888a75c070304ca5514197d4847a59a5c853f", "shasum": "" }, "require": { "ext-ctype": "*", "ext-filter": "*", + "ext-hash": "*", "php": ">=5.5.0" }, "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "doctrine/annotations": "^1.2", - "friendsofphp/php-cs-fixer": "^2.2", - "phpunit/phpunit": "^4.8 || ^5.7" + "phpcompatibility/php-compatibility": "^9.3.5", + "roave/security-advisories": "dev-latest", + "squizlabs/php_codesniffer": "^3.5.6", + "yoast/phpunit-polyfills": "^0.2.0" }, "suggest": { "ext-mbstring": "Needed to send email in multibyte encoding charset", @@ -1926,11 +1942,11 @@ "description": "PHPMailer is a full-featured email creation and transfer class for PHP", "funding": [ { - "url": "https://github.com/synchro", + "url": "https://github.com/Synchro", "type": "github" } ], - "time": "2020-07-14T18:50:27+00:00" + "time": "2020-11-25T15:24:57+00:00" }, { "name": "phpspec/prophecy", @@ -2488,23 +2504,23 @@ }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", + "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": ">=5.6" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { @@ -2529,7 +2545,13 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T08:15:22+00:00" }, { "name": "sebastian/comparator", @@ -2699,20 +2721,20 @@ }, { "name": "sebastian/exporter", - "version": "3.1.2", + "version": "3.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" + "reference": "6b853149eab67d4da22291d36f5b0631c0fd856e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/6b853149eab67d4da22291d36f5b0631c0fd856e", + "reference": "6b853149eab67d4da22291d36f5b0631c0fd856e", "shasum": "" }, "require": { - "php": "^7.0", + "php": ">=7.0", "sebastian/recursion-context": "^3.0" }, "require-dev": { @@ -2762,7 +2784,13 @@ "export", "exporter" ], - "time": "2019-09-14T09:02:43+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:47:53+00:00" }, { "name": "sebastian/global-state", @@ -2817,20 +2845,20 @@ }, { "name": "sebastian/object-enumerator", - "version": "3.0.3", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", + "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", "shasum": "" }, "require": { - "php": "^7.0", + "php": ">=7.0", "sebastian/object-reflector": "^1.1.1", "sebastian/recursion-context": "^3.0" }, @@ -2860,24 +2888,30 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03T12:35:26+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:40:27+00:00" }, { "name": "sebastian/object-reflector", - "version": "1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "773f97c67f28de00d397be301821b06708fca0be" + "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", - "reference": "773f97c67f28de00d397be301821b06708fca0be", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", + "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.0" }, "require-dev": { "phpunit/phpunit": "^6.0" @@ -2905,24 +2939,30 @@ ], "description": "Allows reflection of object attributes, including inherited and non-public ones", "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29T09:07:27+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:37:18+00:00" }, { "name": "sebastian/recursion-context", - "version": "3.0.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb", + "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.0" }, "require-dev": { "phpunit/phpunit": "^6.0" @@ -2943,14 +2983,14 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, { "name": "Adam Harvey", "email": "aharvey@php.net" @@ -2958,7 +2998,13 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:34:24+00:00" }, { "name": "sebastian/resource-operations", @@ -3091,20 +3137,20 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.18.1", + "version": "v1.20.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "1c302646f6efc070cd46856e600e5e0684d6b454" + "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/1c302646f6efc070cd46856e600e5e0684d6b454", - "reference": "1c302646f6efc070cd46856e600e5e0684d6b454", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f4ba089a5b6366e453971d3aad5fe8e897b37f41", + "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "suggest": { "ext-ctype": "For best performance" @@ -3112,7 +3158,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.18-dev" + "dev-main": "1.20-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3163,31 +3209,26 @@ "type": "tidelift" } ], - "time": "2020-07-14T12:35:20+00:00" + "time": "2020-10-23T14:02:19+00:00" }, { "name": "symfony/process", - "version": "v4.4.11", + "version": "v4.4.17", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "65e70bab62f3da7089a8d4591fb23fbacacb3479" + "reference": "ec1482f13d53911a8a32e54ba6f9a3b43a57d943" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/65e70bab62f3da7089a8d4591fb23fbacacb3479", - "reference": "65e70bab62f3da7089a8d4591fb23fbacacb3479", + "url": "https://api.github.com/repos/symfony/process/zipball/ec1482f13d53911a8a32e54ba6f9a3b43a57d943", + "reference": "ec1482f13d53911a8a32e54ba6f9a3b43a57d943", "shasum": "" }, "require": { "php": ">=7.1.3" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Process\\": "" @@ -3226,7 +3267,7 @@ "type": "tidelift" } ], - "time": "2020-07-23T08:31:43+00:00" + "time": "2020-11-02T15:10:16+00:00" }, { "name": "theseer/tokenizer", @@ -3276,20 +3317,20 @@ }, { "name": "twig/twig", - "version": "v1.43.1", + "version": "v1.44.1", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "2311602f6a208715252febe682fa7c38e56a3373" + "reference": "04b15d4c0bb18ddbf82626320ac07f6a73f199c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/2311602f6a208715252febe682fa7c38e56a3373", - "reference": "2311602f6a208715252febe682fa7c38e56a3373", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/04b15d4c0bb18ddbf82626320ac07f6a73f199c9", + "reference": "04b15d4c0bb18ddbf82626320ac07f6a73f199c9", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=7.2.5", "symfony/polyfill-ctype": "^1.8" }, "require-dev": { @@ -3299,7 +3340,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.43-dev" + "dev-master": "1.44-dev" } }, "autoload": { @@ -3346,7 +3387,7 @@ "type": "tidelift" } ], - "time": "2020-08-05T15:05:05+00:00" + "time": "2020-10-27T19:22:48+00:00" }, { "name": "webmozart/assert", @@ -3458,16 +3499,16 @@ }, { "name": "yiisoft/yii2", - "version": "2.0.38", + "version": "2.0.39.3", "source": { "type": "git", "url": "https://github.com/yiisoft/yii2-framework.git", - "reference": "fd01e747cc66a049ec105048f0ab8dfbdf60bf4b" + "reference": "7c3b93b57e568509a7cb5cef826d8c424a779f3f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/fd01e747cc66a049ec105048f0ab8dfbdf60bf4b", - "reference": "fd01e747cc66a049ec105048f0ab8dfbdf60bf4b", + "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/7c3b93b57e568509a7cb5cef826d8c424a779f3f", + "reference": "7c3b93b57e568509a7cb5cef826d8c424a779f3f", "shasum": "" }, "require": { @@ -3568,7 +3609,7 @@ "type": "tidelift" } ], - "time": "2020-09-14T21:52:10+00:00" + "time": "2020-11-23T19:17:58+00:00" }, { "name": "yiisoft/yii2-composer", diff --git a/src/S3FileSystem.php b/src/S3FileSystem.php index 2017c62..a7f8e1e 100644 --- a/src/S3FileSystem.php +++ b/src/S3FileSystem.php @@ -71,6 +71,12 @@ class S3FileSystem extends BaseFileSystemStorage * @since 1.1.0 */ public $endpoint; + + /** + * @var string The number of seconds provided for max-age cache control header. If false or null, no cache control header will be set. + * @since 1.3.0 + */ + public $maxAge = 2592000; /** * @inheritdoc @@ -83,25 +89,48 @@ public function init() throw new InvalidConfigException("region, bucket and key must be provided for s3 component configuration."); } - $this->on(self::FILE_UPDATE_EVENT, function(FileEvent $event) { - // Copy the object in order to not upload the content again - $config = [ - 'Bucket' => $this->bucket, - 'CopySource' => "{$this->bucket}/{$event->file->name_new_compound}", - 'Key' => $event->file->name_new_compound, - 'MetadataDirective' => 'REPLACE', - 'ContentType' => $event->file->mime_type, - ]; + $this->on(self::FILE_UPDATE_EVENT, [$this, 'fileUpdateEvent']); + } + + /** + * Update/Replace the online file + * + * @param FileEvent $event + */ + public function fileUpdateEvent(FileEvent $event) + { + // Copy the object in order to not upload the content again + $config = [ + 'Bucket' => $this->bucket, + 'CopySource' => "{$this->bucket}/{$event->file->name_new_compound}", + 'Key' => $event->file->name_new_compound, + 'MetadataDirective' => 'REPLACE', + 'ContentType' => $event->file->mime_type, + ]; - if ($event->file->inline_disposition) { - // keep ContentDisposition because this is the default value for s3 objects - // therefore ensure its not provided in the config. - } else { - $config['ContentDisposition'] = 'attachement'; // inline is default setting - } + if ($event->file->inline_disposition) { + // keep ContentDisposition because this is the default value for s3 objects + // therefore ensure its not provided in the config. + } else { + $config['ContentDisposition'] = 'attachement'; // inline is default setting + } + + return $this->client->copyObject($this->extendPutObject($config)); + } + + /** + * Extend the a given put object config with cache information. + * + * @param array $config The array to extend + * @return array Returns the array with the new Expires option if not disabled. + */ + public function extendPutObject(array $config) + { + if ($this->maxAge) { + $config['CacheControl'] = 'max-age=' . $this->maxAge; + } - return $this->client->copyObject($config); - }); + return $config; } private $_client; @@ -265,7 +294,7 @@ public function fileSystemSaveFile($source, $fileName) } // see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#putobject - return $this->client->putObject($config); + return $this->client->putObject($this->extendPutObject($config)); } /** diff --git a/tests/S3FileSystemTest.php b/tests/S3FileSystemTest.php index 51660b0..66bfcb0 100644 --- a/tests/S3FileSystemTest.php +++ b/tests/S3FileSystemTest.php @@ -2,20 +2,31 @@ namespace luya\aws\test; +use Aws\Arn\Exception\InvalidArnException; use Aws\S3\Exception\S3Exception; use Aws\S3\S3Client; +use luya\admin\events\FileEvent; +use luya\admin\models\StorageFile; use luya\aws\helpers\S3PolicyHelper; use luya\aws\S3FileSystem; use luya\testsuite\cases\WebApplicationTestCase; +use luya\testsuite\fixtures\NgRestModelFixture; +use luya\testsuite\traits\AdminDatabaseTableTrait; +use yii\base\ErrorException; class S3FileSystemTest extends WebApplicationTestCase { + use AdminDatabaseTableTrait; + public function getConfigArray() { return [ 'id' => 'packagetest', 'basePath' => __DIR__, 'language' => 'en', + 'components' => [ + 'db' => ['class' => 'yii\db\Connection', 'dsn' => 'sqlite::memory:'], + ] ]; } @@ -102,4 +113,48 @@ public function testUpdateBucket() $this->expectException(S3Exception::class); $s3->updateBucketPolicy(S3PolicyHelper::S3_POLICY_PUBLIC_READ); } + + public function testExtendPutObjectExpires() + { + $s3 = new S3FileSystem($this->app->request, [ + 'region' => 'a', + 'bucket' => 'b', + 'key' => 'c', + ]); + + $this->assertArrayHasKey('CacheControl', $s3->extendPutObject([])); + $this->assertSame([ + 'bar' => 'foo', + 'CacheControl' => 'max-age=2592000', + ], $s3->extendPutObject(['bar' => 'foo'])); + + + $s3->maxAge = false; + $this->assertArrayNotHasKey('CacheControl', $s3->extendPutObject([])); + + $this->expectException(ErrorException::class); + $s3->fileSystemSaveFile('x', 'y'); + } + + public function testFileUpdateEvent() + { + new NgRestModelFixture([ + 'modelClass' => StorageFile::class, + ]); + + $event = new FileEvent([ + 'file' => new StorageFile([ + 'name_new_compound' => 'barfoo.jpg' + ]) + ]); + + $s3 = new S3FileSystem($this->app->request, [ + 'region' => 'a', + 'bucket' => 'b', + 'key' => 'c', + ]); + + $this->expectException(\InvalidArgumentException::class); + $s3->fileUpdateEvent($event); + } } \ No newline at end of file