fix(s3): do not create bucket if not exists, check if healthy instead

update php and js dependencies to latest
This commit is contained in:
Yassine Doghri 2023-03-23 11:46:21 +00:00
parent 18f6b75dee
commit da7076fc2d
7 changed files with 385 additions and 344 deletions

View File

@ -24,15 +24,15 @@
"chrisjean/php-ico": "^1.0.4",
"melbahja/seo": "^v2.1.1",
"codeigniter4/shield": "v1.0.0-beta.3",
"aws/aws-sdk-php": "^3.261.10"
"aws/aws-sdk-php": "^3.261.17"
},
"require-dev": {
"mikey179/vfsstream": "^v1.6.11",
"phpunit/phpunit": "^10.0.16",
"captainhook/captainhook": "^5.15.2",
"symplify/easy-coding-standard": "^11.2.10",
"phpstan/phpstan": "^1.10.6",
"rector/rector": "^0.15.21",
"phpunit/phpunit": "^10.0.18",
"captainhook/captainhook": "^5.15.5",
"symplify/easy-coding-standard": "^11.3.2",
"phpstan/phpstan": "^1.10.7",
"rector/rector": "^0.15.23",
"symplify/coding-standard": "^11.3.0"
},
"autoload": {

95
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "84568da2a8ddda6d9bcd8eb63ee83682",
"content-hash": "44b79ceee12a4fe0ce58763458036267",
"packages": [
{
"name": "adaures/ipcat-php",
@ -116,16 +116,16 @@
},
{
"name": "aws/aws-sdk-php",
"version": "3.261.10",
"version": "3.261.17",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "4889eff2b3fe35e878fbcaf8374d73f043609170"
"reference": "a8d2d89d79e912aa87bd2d381d34f47fbd08be65"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/4889eff2b3fe35e878fbcaf8374d73f043609170",
"reference": "4889eff2b3fe35e878fbcaf8374d73f043609170",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/a8d2d89d79e912aa87bd2d381d34f47fbd08be65",
"reference": "a8d2d89d79e912aa87bd2d381d34f47fbd08be65",
"shasum": ""
},
"require": {
@ -200,9 +200,9 @@
"support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.261.10"
"source": "https://github.com/aws/aws-sdk-php/tree/3.261.17"
},
"time": "2023-03-13T18:19:14+00:00"
"time": "2023-03-22T18:22:29+00:00"
},
{
"name": "brick/math",
@ -3176,16 +3176,16 @@
"packages-dev": [
{
"name": "captainhook/captainhook",
"version": "5.15.2",
"version": "5.15.5",
"source": {
"type": "git",
"url": "https://github.com/captainhookphp/captainhook.git",
"reference": "728fe3847c57f2d9cd4c53a8c26bc5522b42a1d0"
"reference": "7fb1c78586ea58ec4118c2d4db35c9d5da3fabb0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/captainhookphp/captainhook/zipball/728fe3847c57f2d9cd4c53a8c26bc5522b42a1d0",
"reference": "728fe3847c57f2d9cd4c53a8c26bc5522b42a1d0",
"url": "https://api.github.com/repos/captainhookphp/captainhook/zipball/7fb1c78586ea58ec4118c2d4db35c9d5da3fabb0",
"reference": "7fb1c78586ea58ec4118c2d4db35c9d5da3fabb0",
"shasum": ""
},
"require": {
@ -3243,7 +3243,7 @@
],
"support": {
"issues": "https://github.com/captainhookphp/captainhook/issues",
"source": "https://github.com/captainhookphp/captainhook/tree/5.15.2"
"source": "https://github.com/captainhookphp/captainhook/tree/5.15.5"
},
"funding": [
{
@ -3251,7 +3251,7 @@
"type": "github"
}
],
"time": "2023-03-03T11:11:58+00:00"
"time": "2023-03-20T10:35:30+00:00"
},
{
"name": "composer/pcre",
@ -3935,16 +3935,16 @@
},
{
"name": "phpstan/phpstan",
"version": "1.10.6",
"version": "1.10.7",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "50d089a3e0904b0fe7e2cf2d4fd37d427d64235a"
"reference": "b10ceb526d9607903c5b2673f1fc8775dbe48975"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/50d089a3e0904b0fe7e2cf2d4fd37d427d64235a",
"reference": "50d089a3e0904b0fe7e2cf2d4fd37d427d64235a",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/b10ceb526d9607903c5b2673f1fc8775dbe48975",
"reference": "b10ceb526d9607903c5b2673f1fc8775dbe48975",
"shasum": ""
},
"require": {
@ -3963,8 +3963,11 @@
"description": "PHPStan - PHP Static Analysis Tool",
"keywords": ["dev", "static analysis"],
"support": {
"docs": "https://phpstan.org/user-guide/getting-started",
"forum": "https://github.com/phpstan/phpstan/discussions",
"issues": "https://github.com/phpstan/phpstan/issues",
"source": "https://github.com/phpstan/phpstan/tree/1.10.6"
"security": "https://github.com/phpstan/phpstan/security/policy",
"source": "https://github.com/phpstan/phpstan-src"
},
"funding": [
{
@ -3980,7 +3983,7 @@
"type": "tidelift"
}
],
"time": "2023-03-09T16:55:12+00:00"
"time": "2023-03-16T15:24:20+00:00"
},
{
"name": "phpunit/php-code-coverage",
@ -4269,16 +4272,16 @@
},
{
"name": "phpunit/phpunit",
"version": "10.0.16",
"version": "10.0.18",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "07d386a11ac7094032900f07cada1c8975d16607"
"reference": "582563ed2edc62d1455cdbe00ea49fe09428eef3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/07d386a11ac7094032900f07cada1c8975d16607",
"reference": "07d386a11ac7094032900f07cada1c8975d16607",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/582563ed2edc62d1455cdbe00ea49fe09428eef3",
"reference": "582563ed2edc62d1455cdbe00ea49fe09428eef3",
"shasum": ""
},
"require": {
@ -4337,7 +4340,8 @@
"keywords": ["phpunit", "testing", "xunit"],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.0.16"
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.0.18"
},
"funding": [
{
@ -4353,7 +4357,7 @@
"type": "tidelift"
}
],
"time": "2023-03-13T09:02:40+00:00"
"time": "2023-03-22T06:15:31+00:00"
},
{
"name": "psr/container",
@ -4408,16 +4412,16 @@
},
{
"name": "rector/rector",
"version": "0.15.21",
"version": "0.15.23",
"source": {
"type": "git",
"url": "https://github.com/rectorphp/rector.git",
"reference": "1cee8cc5d6d836e1bf9a3006d7b062adde3a6022"
"reference": "f4984ebd62b3613002869b0ddd6868261d62819e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/rectorphp/rector/zipball/1cee8cc5d6d836e1bf9a3006d7b062adde3a6022",
"reference": "1cee8cc5d6d836e1bf9a3006d7b062adde3a6022",
"url": "https://api.github.com/repos/rectorphp/rector/zipball/f4984ebd62b3613002869b0ddd6868261d62819e",
"reference": "f4984ebd62b3613002869b0ddd6868261d62819e",
"shasum": ""
},
"require": {
@ -4446,7 +4450,7 @@
"keywords": ["automation", "dev", "migration", "refactoring"],
"support": {
"issues": "https://github.com/rectorphp/rector/issues",
"source": "https://github.com/rectorphp/rector/tree/0.15.21"
"source": "https://github.com/rectorphp/rector/tree/0.15.23"
},
"funding": [
{
@ -4454,7 +4458,7 @@
"type": "github"
}
],
"time": "2023-03-06T11:44:29+00:00"
"time": "2023-03-22T15:22:45+00:00"
},
{
"name": "sebastian/cli-parser",
@ -4734,16 +4738,16 @@
},
{
"name": "sebastian/diff",
"version": "5.0.0",
"version": "5.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "70dd1b20bc198da394ad542e988381b44e64e39f"
"reference": "aae9a0a43bff37bd5d8d0311426c87bf36153f02"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/70dd1b20bc198da394ad542e988381b44e64e39f",
"reference": "70dd1b20bc198da394ad542e988381b44e64e39f",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/aae9a0a43bff37bd5d8d0311426c87bf36153f02",
"reference": "aae9a0a43bff37bd5d8d0311426c87bf36153f02",
"shasum": ""
},
"require": {
@ -4779,7 +4783,8 @@
"keywords": ["diff", "udiff", "unidiff", "unified diff"],
"support": {
"issues": "https://github.com/sebastianbergmann/diff/issues",
"source": "https://github.com/sebastianbergmann/diff/tree/5.0.0"
"security": "https://github.com/sebastianbergmann/diff/security/policy",
"source": "https://github.com/sebastianbergmann/diff/tree/5.0.1"
},
"funding": [
{
@ -4787,7 +4792,7 @@
"type": "github"
}
],
"time": "2023-02-03T07:00:31+00:00"
"time": "2023-03-23T05:12:41+00:00"
},
{
"name": "sebastian/environment",
@ -6430,16 +6435,16 @@
},
{
"name": "symplify/easy-coding-standard",
"version": "11.2.10",
"version": "11.3.2",
"source": {
"type": "git",
"url": "https://github.com/easy-coding-standard/easy-coding-standard.git",
"reference": "5fc343df9b86e154516ddf506f7fe0b421d7d5ef"
"reference": "d4159e06c0970e71a2a58d350160241e7cb3994b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/5fc343df9b86e154516ddf506f7fe0b421d7d5ef",
"reference": "5fc343df9b86e154516ddf506f7fe0b421d7d5ef",
"url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/d4159e06c0970e71a2a58d350160241e7cb3994b",
"reference": "d4159e06c0970e71a2a58d350160241e7cb3994b",
"shasum": ""
},
"require": {
@ -6447,7 +6452,8 @@
},
"conflict": {
"friendsofphp/php-cs-fixer": "<3.0",
"squizlabs/php_codesniffer": "<3.6"
"squizlabs/php_codesniffer": "<3.6",
"symplify/coding-standard": "<11.3"
},
"bin": ["bin/ecs"],
"type": "library",
@ -6457,9 +6463,10 @@
"notification-url": "https://packagist.org/downloads/",
"license": ["MIT"],
"description": "Use Coding Standard with 0-knowledge of PHP-CS-Fixer and PHP_CodeSniffer",
"keywords": ["Code style", "automation", "fixer", "static analysis"],
"support": {
"issues": "https://github.com/easy-coding-standard/easy-coding-standard/issues",
"source": "https://github.com/easy-coding-standard/easy-coding-standard/tree/11.2.10"
"source": "https://github.com/easy-coding-standard/easy-coding-standard/tree/11.3.2"
},
"funding": [
{
@ -6471,7 +6478,7 @@
"type": "github"
}
],
"time": "2023-02-27T10:00:30+00:00"
"time": "2023-03-22T15:28:51+00:00"
},
{
"name": "symplify/rule-doc-generator-contracts",

View File

@ -72,6 +72,7 @@ services:
image: adobe/s3mock:latest
container_name: castopod_s3
environment:
- initialBuckets=castopod
- debug=true
- root=/data
ports:

View File

@ -75,7 +75,7 @@ to help you kickstart your contribution.
#media.fileManager="s3"
#media.s3.bucket="castopod"
#media.s3.endpoint="http://172.20.0.6:9090/"
#media.s3.path_style_endpoint=true
#media.s3.pathStyleEndpoint=true
```
> _NB._ You can tweak your environment by setting more environment variables

View File

@ -26,21 +26,6 @@ class S3 implements FileManagerInterface
'debug' => $config->s3['debug'],
'use_path_style_endpoint' => $config->s3['pathStyleEndpoint'],
]);
try {
// create bucket if it does not already exist
if (! $this->s3->doesBucketExist((string) $this->config->s3['bucket'])) {
try {
$this->s3->createBucket([
'Bucket' => $this->config->s3['bucket'],
]);
} catch (Exception $exception) {
log_message('critical', $exception->getMessage());
}
}
} catch (Exception $exception) {
throw new Exception($exception->getMessage(), $exception->getCode(), $exception);
}
}
public function save(File $file, string $key): string|false
@ -210,6 +195,11 @@ class S3 implements FileManagerInterface
public function isHealthy(): bool
{
// check that bucket exists
if (! $this->s3->doesBucketExist((string) $this->config->s3['bucket'])) {
return false;
}
try {
// ok if bucket exists and you have permission to access it
$this->s3->headBucket([

View File

@ -27,14 +27,14 @@
"prepare": "is-ci || husky install"
},
"dependencies": {
"@amcharts/amcharts4": "^4.10.34",
"@amcharts/amcharts4": "^4.10.35",
"@amcharts/amcharts4-geodata": "^4.1.26",
"@codemirror/commands": "^6.2.2",
"@codemirror/lang-xml": "^6.0.2",
"@codemirror/language": "^6.6.0",
"@codemirror/state": "^6.2.0",
"@codemirror/view": "^6.9.2",
"@floating-ui/dom": "^1.2.4",
"@codemirror/view": "^6.9.3",
"@floating-ui/dom": "^1.2.5",
"@github/clipboard-copy-element": "^1.1.2",
"@github/hotkey": "^2.0.1",
"@github/markdown-toolbar-element": "^2.1.1",
@ -46,13 +46,13 @@
"flatpickr": "^4.6.13",
"leaflet": "^1.9.3",
"leaflet.markercluster": "^1.5.3",
"lit": "^2.6.1",
"marked": "^4.2.12",
"wavesurfer.js": "^6.5.2",
"lit": "^2.7.0",
"marked": "^4.3.0",
"wavesurfer.js": "^6.6.1",
"xml-formatter": "^3.3.2"
},
"devDependencies": {
"@commitlint/cli": "^17.4.4",
"@commitlint/cli": "^17.5.0",
"@commitlint/config-conventional": "^17.4.4",
"@semantic-release/changelog": "^6.0.2",
"@semantic-release/exec": "^6.0.3",
@ -61,18 +61,18 @@
"@tailwindcss/forms": "^0.5.3",
"@tailwindcss/line-clamp": "^0.4.2",
"@tailwindcss/typography": "^0.5.9",
"@types/leaflet": "^1.9.2",
"@types/leaflet": "^1.9.3",
"@types/marked": "^4.0.8",
"@types/wavesurfer.js": "^6.0.3",
"@typescript-eslint/eslint-plugin": "^5.55.0",
"@typescript-eslint/parser": "^5.55.0",
"@typescript-eslint/eslint-plugin": "^5.56.0",
"@typescript-eslint/parser": "^5.56.0",
"all-contributors-cli": "^6.24.0",
"commitizen": "^4.3.0",
"cross-env": "^7.0.3",
"cssnano": "^5.1.15",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.7.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.3",
"is-ci": "^3.0.1",
@ -82,16 +82,16 @@
"postcss-nesting": "^11.2.1",
"postcss-preset-env": "^8.0.1",
"postcss-reporter": "^7.0.5",
"prettier": "2.8.4",
"prettier": "2.8.6",
"prettier-plugin-organize-imports": "^3.2.2",
"semantic-release": "^20.1.1",
"stylelint": "^15.2.0",
"stylelint-config-standard": "^30.0.1",
"semantic-release": "^20.1.3",
"stylelint": "^15.3.0",
"stylelint-config-standard": "^31.0.0",
"svgo": "^3.0.2",
"tailwindcss": "^3.2.7",
"typescript": "^4.9.5",
"vite": "^4.1.4",
"vite-plugin-pwa": "^0.14.4",
"typescript": "^5.0.2",
"vite": "^4.2.1",
"vite-plugin-pwa": "^0.14.5",
"workbox-build": "^6.5.4",
"workbox-core": "^6.5.4",
"workbox-routing": "^6.5.4",

File diff suppressed because it is too large Load Diff