diff --git a/PATCHES/core-css-js-aggregation-3376927.patch b/PATCHES/core-css-js-aggregation-3376927.patch deleted file mode 100644 index c2f3ca7e9..000000000 --- a/PATCHES/core-css-js-aggregation-3376927.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/core/modules/system/src/Controller/AssetControllerBase.php b/core/modules/system/src/Controller/AssetControllerBase.php -index 620b2ecccf..cce4c397cc 100644 ---- a/core/modules/system/src/Controller/AssetControllerBase.php -+++ b/core/modules/system/src/Controller/AssetControllerBase.php -@@ -191,10 +191,6 @@ public function deliver(Request $request, string $file_name) { - // referenced in cached HTML. - if (hash_equals($generated_hash, $received_hash)) { - $uri = $this->dumper->dumpToUri($data, $this->assetType, $uri); -- $state_key = 'drupal_' . $this->assetType . '_cache_files'; -- $files = $this->state()->get($state_key, []); -- $files[] = $uri; -- $this->state()->set($state_key, $files); - } - return new Response($data, 200, [ - 'Cache-control' => static::CACHE_CONTROL, diff --git a/composer.lock b/composer.lock index cea4599d7..9aa5cc483 100644 --- a/composer.lock +++ b/composer.lock @@ -2429,17 +2429,17 @@ }, { "name": "drupal/config_filter", - "version": "2.5.0", + "version": "2.6.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/config_filter.git", - "reference": "8.x-2.5" + "reference": "8.x-2.6" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/config_filter-8.x-2.5.zip", - "reference": "8.x-2.5", - "shasum": "a509ec432b0560fbba853b52e74d71cede5f6bdf" + "url": "https://ftp.drupal.org/files/projects/config_filter-8.x-2.6.zip", + "reference": "8.x-2.6", + "shasum": "fd1a057a402436fc906c63bf0a74722f73b9b155" }, "require": { "drupal/core": "^8.8 || ^9 || ^10" @@ -2453,8 +2453,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-2.5", - "datestamp": "1698096457", + "version": "8.x-2.6", + "datestamp": "1698308577", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -2498,17 +2498,17 @@ }, { "name": "drupal/config_split", - "version": "2.0.0-rc4", + "version": "2.0.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/config_split.git", - "reference": "2.0.0-rc4" + "reference": "2.0.0" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/config_split-2.0.0-rc4.zip", - "reference": "2.0.0-rc4", - "shasum": "d4c06efbadd34793b0c9b71772162057afa58111" + "url": "https://ftp.drupal.org/files/projects/config_split-2.0.0.zip", + "reference": "2.0.0", + "shasum": "be9fd0aba1206e0f19e8448f69d4210e53dae069" }, "require": { "drupal/core": "^8.8 || ^9 || ^10" @@ -2526,11 +2526,11 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "2.0.0-rc4", - "datestamp": "1662235380", + "version": "2.0.0", + "datestamp": "1699259254", "security-coverage": { - "status": "not-covered", - "message": "RC releases are not covered by Drupal security advisories." + "status": "covered", + "message": "Covered by Drupal's security advisory policy" } }, "drush": { @@ -2621,16 +2621,16 @@ }, { "name": "drupal/core", - "version": "10.1.5", + "version": "10.1.6", "source": { "type": "git", "url": "https://github.com/drupal/core.git", - "reference": "1272c35d547e844e7ebf3fe5513542291cda8cec" + "reference": "33695caf467e3e1e8c75d42215df57bee31be9ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core/zipball/1272c35d547e844e7ebf3fe5513542291cda8cec", - "reference": "1272c35d547e844e7ebf3fe5513542291cda8cec", + "url": "https://api.github.com/repos/drupal/core/zipball/33695caf467e3e1e8c75d42215df57bee31be9ec", + "reference": "33695caf467e3e1e8c75d42215df57bee31be9ec", "shasum": "" }, "require": { @@ -2775,13 +2775,13 @@ ], "description": "Drupal is an open source content management platform powering millions of websites and applications.", "support": { - "source": "https://github.com/drupal/core/tree/10.1.5" + "source": "https://github.com/drupal/core/tree/10.1.6" }, - "time": "2023-10-04T21:37:59+00:00" + "time": "2023-11-01T11:59:20+00:00" }, { "name": "drupal/core-composer-scaffold", - "version": "10.1.5", + "version": "10.1.6", "source": { "type": "git", "url": "https://github.com/drupal/core-composer-scaffold.git", @@ -2825,22 +2825,22 @@ "drupal" ], "support": { - "source": "https://github.com/drupal/core-composer-scaffold/tree/10.1.5" + "source": "https://github.com/drupal/core-composer-scaffold/tree/10.1.6" }, "time": "2023-04-30T16:15:32+00:00" }, { "name": "drupal/core-dev", - "version": "10.1.5", + "version": "10.1.6", "source": { "type": "git", "url": "https://github.com/drupal/core-dev.git", - "reference": "e11a86bc8c037e67c7c5c974fbabe051bbcdcc81" + "reference": "5d02df4f05f5033e7d8bf4098efa55cc0847e2b9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core-dev/zipball/e11a86bc8c037e67c7c5c974fbabe051bbcdcc81", - "reference": "e11a86bc8c037e67c7c5c974fbabe051bbcdcc81", + "url": "https://api.github.com/repos/drupal/core-dev/zipball/5d02df4f05f5033e7d8bf4098efa55cc0847e2b9", + "reference": "5d02df4f05f5033e7d8bf4098efa55cc0847e2b9", "shasum": "" }, "require": { @@ -2848,7 +2848,7 @@ "behat/mink-browserkit-driver": "^2.1", "behat/mink-selenium2-driver": "^1.4", "colinodell/psr-testlogger": "^1.2", - "composer/composer": "^2.4", + "composer/composer": "^2.6.4", "drupal/coder": "^8.3.10", "instaclick/php-webdriver": "^1.4.1", "justinrainbow/json-schema": "^5.2", @@ -2879,22 +2879,22 @@ ], "description": "require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.", "support": { - "source": "https://github.com/drupal/core-dev/tree/10.1.5" + "source": "https://github.com/drupal/core-dev/tree/10.1.6" }, - "time": "2023-05-25T11:39:24+00:00" + "time": "2023-10-05T21:10:12+00:00" }, { "name": "drupal/core-recommended", - "version": "10.1.5", + "version": "10.1.6", "source": { "type": "git", "url": "https://github.com/drupal/core-recommended.git", - "reference": "2c5cf420ddb06f3e9b624d168b724ca1c7c326e2" + "reference": "13f5968854fe8bc02e659d8a4facc04a1a576ce5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core-recommended/zipball/2c5cf420ddb06f3e9b624d168b724ca1c7c326e2", - "reference": "2c5cf420ddb06f3e9b624d168b724ca1c7c326e2", + "url": "https://api.github.com/repos/drupal/core-recommended/zipball/13f5968854fe8bc02e659d8a4facc04a1a576ce5", + "reference": "13f5968854fe8bc02e659d8a4facc04a1a576ce5", "shasum": "" }, "require": { @@ -2903,7 +2903,7 @@ "doctrine/annotations": "~1.14.3", "doctrine/deprecations": "~v1.1.1", "doctrine/lexer": "~2.1.0", - "drupal/core": "10.1.5", + "drupal/core": "10.1.6", "egulias/email-validator": "~4.0.1", "guzzlehttp/guzzle": "~7.7.0", "guzzlehttp/psr7": "~2.5.0", @@ -2960,9 +2960,9 @@ ], "description": "Core and its dependencies with known-compatible minor versions. Require this project INSTEAD OF drupal/core.", "support": { - "source": "https://github.com/drupal/core-recommended/tree/10.1.5" + "source": "https://github.com/drupal/core-recommended/tree/10.1.6" }, - "time": "2023-10-04T21:37:59+00:00" + "time": "2023-11-01T11:59:20+00:00" }, { "name": "drupal/ctools", @@ -4494,17 +4494,17 @@ }, { "name": "drupal/svg_image", - "version": "3.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://git.drupalcode.org/project/svg_image.git", - "reference": "3.0.1" + "reference": "3.0.2" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/svg_image-3.0.1.zip", - "reference": "3.0.1", - "shasum": "6e0f1f305e0db535257780e647f6163cfdda8263" + "url": "https://ftp.drupal.org/files/projects/svg_image-3.0.2.zip", + "reference": "3.0.2", + "shasum": "77906ae731878b68a181f82b073617b798e5f110" }, "require": { "drupal/core": "^10", @@ -4513,8 +4513,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "3.0.1", - "datestamp": "1676292042", + "version": "3.0.2", + "datestamp": "1698471266", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -5727,16 +5727,16 @@ }, { "name": "google/protobuf", - "version": "v3.24.4", + "version": "v3.25.0", "source": { "type": "git", "url": "https://github.com/protocolbuffers/protobuf-php.git", - "reference": "672d69e25f71b9364fdf1810eb8a8573defdc404" + "reference": "e5a021e653ee3a7a78760caefa605b4ec31bba80" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/672d69e25f71b9364fdf1810eb8a8573defdc404", - "reference": "672d69e25f71b9364fdf1810eb8a8573defdc404", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/e5a021e653ee3a7a78760caefa605b4ec31bba80", + "reference": "e5a021e653ee3a7a78760caefa605b4ec31bba80", "shasum": "" }, "require": { @@ -5765,9 +5765,9 @@ "proto" ], "support": { - "source": "https://github.com/protocolbuffers/protobuf-php/tree/v3.24.4" + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v3.25.0" }, - "time": "2023-10-04T17:22:47+00:00" + "time": "2023-11-01T22:12:38+00:00" }, { "name": "grasmash/expander", @@ -6981,16 +6981,16 @@ }, { "name": "mglaman/phpstan-drupal", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/mglaman/phpstan-drupal.git", - "reference": "d721420086f146640acecebb7a678661a66e97d5" + "reference": "920c6b972a832046327f66dc6ff7448e3b5d6e4c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mglaman/phpstan-drupal/zipball/d721420086f146640acecebb7a678661a66e97d5", - "reference": "d721420086f146640acecebb7a678661a66e97d5", + "url": "https://api.github.com/repos/mglaman/phpstan-drupal/zipball/920c6b972a832046327f66dc6ff7448e3b5d6e4c", + "reference": "920c6b972a832046327f66dc6ff7448e3b5d6e4c", "shasum": "" }, "require": { @@ -7065,7 +7065,7 @@ "description": "Drupal extension and rules for PHPStan", "support": { "issues": "https://github.com/mglaman/phpstan-drupal/issues", - "source": "https://github.com/mglaman/phpstan-drupal/tree/1.2.0" + "source": "https://github.com/mglaman/phpstan-drupal/tree/1.2.1" }, "funding": [ { @@ -7081,7 +7081,7 @@ "type": "tidelift" } ], - "time": "2023-08-24T20:32:56+00:00" + "time": "2023-11-03T13:17:28+00:00" }, { "name": "mikey179/vfsstream", @@ -7257,16 +7257,16 @@ }, { "name": "nette/utils", - "version": "v4.0.2", + "version": "v4.0.3", "source": { "type": "git", "url": "https://github.com/nette/utils.git", - "reference": "cead6637226456b35e1175cc53797dd585d85545" + "reference": "a9d127dd6a203ce6d255b2e2db49759f7506e015" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/utils/zipball/cead6637226456b35e1175cc53797dd585d85545", - "reference": "cead6637226456b35e1175cc53797dd585d85545", + "url": "https://api.github.com/repos/nette/utils/zipball/a9d127dd6a203ce6d255b2e2db49759f7506e015", + "reference": "a9d127dd6a203ce6d255b2e2db49759f7506e015", "shasum": "" }, "require": { @@ -7337,9 +7337,9 @@ ], "support": { "issues": "https://github.com/nette/utils/issues", - "source": "https://github.com/nette/utils/tree/v4.0.2" + "source": "https://github.com/nette/utils/tree/v4.0.3" }, - "time": "2023-09-19T11:58:07+00:00" + "time": "2023-10-29T21:02:13+00:00" }, { "name": "nikic/php-parser", @@ -8498,16 +8498,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.39", + "version": "1.10.41", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "d9dedb0413f678b4d03cbc2279a48f91592c97c4" + "reference": "c6174523c2a69231df55bdc65b61655e72876d76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d9dedb0413f678b4d03cbc2279a48f91592c97c4", - "reference": "d9dedb0413f678b4d03cbc2279a48f91592c97c4", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c6174523c2a69231df55bdc65b61655e72876d76", + "reference": "c6174523c2a69231df55bdc65b61655e72876d76", "shasum": "" }, "require": { @@ -8556,7 +8556,7 @@ "type": "tidelift" } ], - "time": "2023-10-17T15:46:26+00:00" + "time": "2023-11-05T12:57:57+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -11915,16 +11915,16 @@ }, { "name": "symfony/http-foundation", - "version": "v6.3.6", + "version": "v6.3.7", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "c186627f52febe09c6d5270b04f8462687a250a6" + "reference": "59d1837d5d992d16c2628cd0d6b76acf8d69b33e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/c186627f52febe09c6d5270b04f8462687a250a6", - "reference": "c186627f52febe09c6d5270b04f8462687a250a6", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/59d1837d5d992d16c2628cd0d6b76acf8d69b33e", + "reference": "59d1837d5d992d16c2628cd0d6b76acf8d69b33e", "shasum": "" }, "require": { @@ -11972,7 +11972,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v6.3.6" + "source": "https://github.com/symfony/http-foundation/tree/v6.3.7" }, "funding": [ { @@ -11988,20 +11988,20 @@ "type": "tidelift" } ], - "time": "2023-10-17T11:32:53+00:00" + "time": "2023-10-28T23:55:27+00:00" }, { "name": "symfony/http-kernel", - "version": "v6.3.6", + "version": "v6.3.7", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "4945f5001b06ff9080cd3d8f1f9f069094c0d156" + "reference": "6d4098095f93279d9536a0e9124439560cc764d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/4945f5001b06ff9080cd3d8f1f9f069094c0d156", - "reference": "4945f5001b06ff9080cd3d8f1f9f069094c0d156", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/6d4098095f93279d9536a0e9124439560cc764d0", + "reference": "6d4098095f93279d9536a0e9124439560cc764d0", "shasum": "" }, "require": { @@ -12085,7 +12085,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v6.3.6" + "source": "https://github.com/symfony/http-kernel/tree/v6.3.7" }, "funding": [ { @@ -12101,20 +12101,20 @@ "type": "tidelift" } ], - "time": "2023-10-21T13:12:51+00:00" + "time": "2023-10-29T14:31:45+00:00" }, { "name": "symfony/lock", - "version": "v6.3.6", + "version": "v6.3.7", "source": { "type": "git", "url": "https://github.com/symfony/lock.git", - "reference": "714c52173dd3720ae63e564c4ec7fd03eb8a635a" + "reference": "7e5d1412827aa97e90f9af9495d452f0b9465a85" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/lock/zipball/714c52173dd3720ae63e564c4ec7fd03eb8a635a", - "reference": "714c52173dd3720ae63e564c4ec7fd03eb8a635a", + "url": "https://api.github.com/repos/symfony/lock/zipball/7e5d1412827aa97e90f9af9495d452f0b9465a85", + "reference": "7e5d1412827aa97e90f9af9495d452f0b9465a85", "shasum": "" }, "require": { @@ -12164,7 +12164,7 @@ "semaphore" ], "support": { - "source": "https://github.com/symfony/lock/tree/v6.3.6" + "source": "https://github.com/symfony/lock/tree/v6.3.7" }, "funding": [ { @@ -12180,7 +12180,7 @@ "type": "tidelift" } ], - "time": "2023-10-12T15:02:41+00:00" + "time": "2023-10-28T23:55:27+00:00" }, { "name": "symfony/mime", @@ -13557,16 +13557,16 @@ }, { "name": "symfony/serializer", - "version": "v6.3.6", + "version": "v6.3.7", "source": { "type": "git", "url": "https://github.com/symfony/serializer.git", - "reference": "8c5fb7144889839751ad9680cf4f183f60f8fbce" + "reference": "641472dd3d6dc3c4d0fdd1496ebd1b55c72e43d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/serializer/zipball/8c5fb7144889839751ad9680cf4f183f60f8fbce", - "reference": "8c5fb7144889839751ad9680cf4f183f60f8fbce", + "url": "https://api.github.com/repos/symfony/serializer/zipball/641472dd3d6dc3c4d0fdd1496ebd1b55c72e43d9", + "reference": "641472dd3d6dc3c4d0fdd1496ebd1b55c72e43d9", "shasum": "" }, "require": { @@ -13631,7 +13631,7 @@ "description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/serializer/tree/v6.3.6" + "source": "https://github.com/symfony/serializer/tree/v6.3.7" }, "funding": [ { @@ -13647,7 +13647,7 @@ "type": "tidelift" } ], - "time": "2023-10-17T11:32:53+00:00" + "time": "2023-10-26T18:15:14+00:00" }, { "name": "symfony/service-contracts", @@ -13971,16 +13971,16 @@ }, { "name": "symfony/validator", - "version": "v6.3.6", + "version": "v6.3.7", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "254290aa13d591883eb36327cbe80689cee38ffb" + "reference": "9cc736663fa5839b9710ac2c303bb0b951014fc1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/254290aa13d591883eb36327cbe80689cee38ffb", - "reference": "254290aa13d591883eb36327cbe80689cee38ffb", + "url": "https://api.github.com/repos/symfony/validator/zipball/9cc736663fa5839b9710ac2c303bb0b951014fc1", + "reference": "9cc736663fa5839b9710ac2c303bb0b951014fc1", "shasum": "" }, "require": { @@ -14047,7 +14047,7 @@ "description": "Provides tools to validate values", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/validator/tree/v6.3.6" + "source": "https://github.com/symfony/validator/tree/v6.3.7" }, "funding": [ { @@ -14063,7 +14063,7 @@ "type": "tidelift" } ], - "time": "2023-10-20T16:20:17+00:00" + "time": "2023-10-28T23:11:45+00:00" }, { "name": "symfony/var-dumper", @@ -14225,16 +14225,16 @@ }, { "name": "symfony/yaml", - "version": "v6.3.3", + "version": "v6.3.7", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "e23292e8c07c85b971b44c1c4b87af52133e2add" + "reference": "9758b6c69d179936435d0ffb577c3708d57e38a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/e23292e8c07c85b971b44c1c4b87af52133e2add", - "reference": "e23292e8c07c85b971b44c1c4b87af52133e2add", + "url": "https://api.github.com/repos/symfony/yaml/zipball/9758b6c69d179936435d0ffb577c3708d57e38a8", + "reference": "9758b6c69d179936435d0ffb577c3708d57e38a8", "shasum": "" }, "require": { @@ -14277,7 +14277,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.3.3" + "source": "https://github.com/symfony/yaml/tree/v6.3.7" }, "funding": [ { @@ -14293,7 +14293,7 @@ "type": "tidelift" } ], - "time": "2023-07-31T07:08:24+00:00" + "time": "2023-10-28T23:31:00+00:00" }, { "name": "theseer/tokenizer", @@ -15422,5 +15422,5 @@ "php": ">=8.2" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/composer.patches.json b/composer.patches.json index 6e7eb86db..eaa372897 100644 --- a/composer.patches.json +++ b/composer.patches.json @@ -3,8 +3,7 @@ "drupal/core" : { "https://www.drupal.org/project/drupal/issues/3047110": "PATCHES/core--drupal--3047110-taxonomy-term-moderation-class.patch", "https://www.drupal.org/project/drupal/issues/3008292": "PATCHES/core--drupal--3008292-image-upload-validators.patch", - "https://www.drupal.org/project/drupal/issues/3143617": "PATCHES/core--drupal--3143617-pager-parameter.patch", - "https://www.drupal.org/project/drupal/issues/3376927": "PATCHES/core-css-js-aggregation-3376927.patch" + "https://www.drupal.org/project/drupal/issues/3143617": "PATCHES/core--drupal--3143617-pager-parameter.patch" }, "drupal/guidelines": { "Drupal 10 compatibility": "PATCHES/guidelines-drupal-10-compatibility.patch" diff --git a/html/modules/custom/reliefweb_entities/src/DocumentTrait.php b/html/modules/custom/reliefweb_entities/src/DocumentTrait.php index 6bb8da3f5..0af0b30ab 100644 --- a/html/modules/custom/reliefweb_entities/src/DocumentTrait.php +++ b/html/modules/custom/reliefweb_entities/src/DocumentTrait.php @@ -3,9 +3,11 @@ namespace Drupal\reliefweb_entities; use Drupal\Component\Utility\Unicode; +use Drupal\Core\Entity\EntityPublishedInterface; use Drupal\Core\Field\EntityReferenceFieldItemList; use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\Url; +use Drupal\reliefweb_entities\Entity\Source; use Drupal\reliefweb_moderation\EntityModeratedInterface; use Drupal\reliefweb_rivers\RiverServiceBase; use Drupal\reliefweb_utility\Helpers\HtmlSummarizer; @@ -358,4 +360,35 @@ public function createDate($date) { return new \DateTime($date, new \DateTimeZone('UTC')); } + /** + * Update the status of the sources when publishing an opportunity. + */ + protected function updateSourceModerationStatus() { + if (!$this->hasField('field_source') || $this->field_source->isEmpty()) { + return; + } + + if (!($this instanceof EntityPublishedInterface) || !$this->isPublished()) { + return; + } + + // Make the inactive or archive sources active when the node is published. + foreach ($this->field_source as $item) { + $source = $item->entity; + if (empty($source) || !($source instanceof Source)) { + continue; + } + + if (in_array($source->getModerationStatus(), ['inactive', 'archive'])) { + $source->notifications_content_disable = TRUE; + $source->setModerationStatus('active'); + $source->setNewRevision(TRUE); + $source->setRevisionLogMessage('Automatic status update due to publication of node ' . $this->id()); + $source->setRevisionUserId(2); + $source->setRevisionCreationTime(time()); + $source->save(); + } + } + } + } diff --git a/html/modules/custom/reliefweb_entities/src/Entity/Report.php b/html/modules/custom/reliefweb_entities/src/Entity/Report.php index 0f24e4782..5e115009e 100644 --- a/html/modules/custom/reliefweb_entities/src/Entity/Report.php +++ b/html/modules/custom/reliefweb_entities/src/Entity/Report.php @@ -257,6 +257,9 @@ public function preSave(EntityStorageInterface $storage) { public function postSave(EntityStorageInterface $storage, $update = TRUE) { parent::postSave($storage, $update); + // Make the sources active. + $this->updateSourceModerationStatus(); + $this->sendPublicationNotification(); } diff --git a/html/modules/custom/reliefweb_entities/src/OpportunityDocumentTrait.php b/html/modules/custom/reliefweb_entities/src/OpportunityDocumentTrait.php index d946ca5b3..44ed15aa7 100644 --- a/html/modules/custom/reliefweb_entities/src/OpportunityDocumentTrait.php +++ b/html/modules/custom/reliefweb_entities/src/OpportunityDocumentTrait.php @@ -2,7 +2,6 @@ namespace Drupal\reliefweb_entities; -use Drupal\Core\Entity\EntityPublishedInterface; use Drupal\Core\Entity\RevisionLogInterface; use Drupal\reliefweb_entities\Entity\Source; use Drupal\reliefweb_moderation\Helpers\UserPostingRightsHelper; @@ -169,36 +168,4 @@ protected function updateDateWhenPublished() { } } - /** - * Update the status of the sources when publishing an opportunity. - */ - protected function updateSourceModerationStatus() { - if (!$this->hasField('field_source') || $this->field_source->isEmpty()) { - return; - } - - if (!($this instanceof EntityPublishedInterface) || !$this->isPublished()) { - return; - } - - // Make the inactive or archive sources active when an apportunity is - // published. - foreach ($this->field_source as $item) { - $source = $item->entity; - if (empty($source) || !($source instanceof Source)) { - continue; - } - - if (in_array($source->getModerationStatus(), ['inactive', 'archive'])) { - $source->notifications_content_disable = TRUE; - $source->setModerationStatus('active'); - $source->setNewRevision(TRUE); - $source->setRevisionLogMessage('Automatic status update due to publication of node ' . $this->id()); - $source->setRevisionUserId(2); - $source->setRevisionCreationTime(time()); - $source->save(); - } - } - } - } diff --git a/html/modules/custom/reliefweb_moderation/src/Commands/ReliefWebModerationCommands.php b/html/modules/custom/reliefweb_moderation/src/Commands/ReliefWebModerationCommands.php index e37242180..43814b265 100644 --- a/html/modules/custom/reliefweb_moderation/src/Commands/ReliefWebModerationCommands.php +++ b/html/modules/custom/reliefweb_moderation/src/Commands/ReliefWebModerationCommands.php @@ -80,40 +80,81 @@ public function updateInactiveSources(array $options = [ return TRUE; } + // Retrieve sources with status to update. $sources = $this->database->query(" - SELECT query.id, query.status + SELECT + query.id AS id, + query.status AS status FROM ( - SELECT subquery.id, - CASE - WHEN subquery.published > 0 THEN 'active' - WHEN subquery.recent > 0 THEN 'inactive' - ELSE 'archive' - END AS status + SELECT + subquery.id, + CASE + WHEN subquery.active > 0 THEN 'active' + WHEN subquery.inactive > 0 THEN 'inactive' + ELSE 'archive' + END AS status, + subquery.current_status AS current_status FROM ( - SELECT fs.field_source_target_id AS id, - SUM(CASE - WHEN n.type = 'job' AND UNIX_TIMESTAMP(fjcd.field_job_closing_date_value) > UNIX_TIMESTAMP(NOW() - INTERVAL 1 YEAR) THEN 1 - WHEN n.type = 'training' AND UNIX_TIMESTAMP(frd.field_registration_deadline_value) > UNIX_TIMESTAMP(NOW() - INTERVAL 1 YEAR) THEN 1 - ELSE 0 - END) AS recent, - SUM(IF(n.moderation_status = 'published', 1, 0)) AS published - FROM node__field_source AS fs - INNER JOIN node_field_data AS n + SELECT + tfd.tid AS id, + tfd.moderation_status AS current_status, + SUM(CASE + # Published jobs or training. + WHEN n.type IN ('job', 'training') AND n.status = 1 THEN 1 + # Jobs that were open during the past 2 months. + WHEN n.type = 'job' AND UNIX_TIMESTAMP(fjcd.field_job_closing_date_value) > UNIX_TIMESTAMP(NOW() - INTERVAL 2 MONTH) THEN 1 + # Training that were open during the past 2 months. + WHEN n.type = 'training' AND UNIX_TIMESTAMP(frd.field_registration_deadline_value) > UNIX_TIMESTAMP(NOW() - INTERVAL 2 MONTH) THEN 1 + # Reports created during the past 3 years. + WHEN n.type = 'report' AND n.created > UNIX_TIMESTAMP(NOW() - INTERVAL 3 YEAR) THEN 1 + # Ongoing training that were published during the past 2 months. + WHEN n.type = 'training' AND frd.field_registration_deadline_value IS NULL AND ( + SELECT MAX(tnr.revision_timestamp) + FROM node_field_revision AS tnfr + INNER JOIN node_revision AS tnr + ON tnr.vid = tnfr.vid + WHERE tnfr.moderation_status = 'published' + AND tnfr.nid = n.nid + ) > UNIX_TIMESTAMP(NOW() - INTERVAL 2 MONTH) THEN 1 + ELSE 0 + END) AS active, + SUM(CASE + # Jobs that were open during the past 1 year. + WHEN n.type = 'job' AND UNIX_TIMESTAMP(fjcd.field_job_closing_date_value) > UNIX_TIMESTAMP(NOW() - INTERVAL 1 YEAR) THEN 1 + # Training that were open during the past 1 year. + WHEN n.type = 'training' AND UNIX_TIMESTAMP(frd.field_registration_deadline_value) > UNIX_TIMESTAMP(NOW() - INTERVAL 1 YEAR) THEN 1 + # Published reports. + WHEN n.type = 'report' AND n.status = 1 THEN 1 + # Ongoing training that were published during the past year. + WHEN n.type = 'training' AND frd.field_registration_deadline_value IS NULL AND ( + SELECT MAX(tnr.revision_timestamp) + FROM node_field_revision AS tnfr + INNER JOIN node_revision AS tnr + ON tnr.vid = tnfr.vid + WHERE tnfr.moderation_status = 'published' + AND tnfr.nid = n.nid + ) > UNIX_TIMESTAMP(NOW() - INTERVAL 1 YEAR) THEN 1 + ELSE 0 + END) AS inactive + FROM taxonomy_term_field_data AS tfd + LEFT JOIN node__field_source AS fs + ON fs.field_source_target_id = tfd.tid + LEFT JOIN node_field_data AS n ON n.nid = fs.entity_id - AND n.type IN ('job', 'training') + AND n.type IN ('job', 'training', 'report') LEFT JOIN node__field_job_closing_date AS fjcd ON fjcd.entity_id = fs.entity_id LEFT JOIN node__field_registration_deadline AS frd ON frd.entity_id = fs.entity_id - WHERE fs.field_source_target_id NOT IN (SELECT field_source_target_id FROM node__field_source WHERE bundle = 'report') - GROUP BY fs.field_source_target_id + WHERE tfd.vid = 'source' + # Skip blocked or duplicate sources. + AND tfd.moderation_status IN ('active', 'inactive', 'archive') + # Skip recently created organizations. + AND tfd.created < UNIX_TIMESTAMP(NOW() - INTERVAL 2 WEEK) + GROUP BY tfd.tid ) AS subquery ) AS query - INNER JOIN taxonomy_term_field_data AS tfd - ON tfd.tid = query.id - AND tfd.vid = 'source' - AND tfd.moderation_status NOT IN ('duplicate', 'blocked', query.status) - WHERE query.status <> 'active' + WHERE query.status IN ('inactive', 'archive') AND query.status <> query.current_status ")?->fetchAllKeyed(0, 1) ?? []; if (empty($sources)) { diff --git a/html/themes/custom/common_design_subtheme/package-lock.json b/html/themes/custom/common_design_subtheme/package-lock.json index eda2c74cc..7637e2d32 100644 --- a/html/themes/custom/common_design_subtheme/package-lock.json +++ b/html/themes/custom/common_design_subtheme/package-lock.json @@ -11,7 +11,7 @@ "devDependencies": { "@babel/preset-env": "^7.16.4", "@xmldom/xmldom": "^0.8.4", - "axios": ">=0.21.2", + "axios": ">=1.6.0", "babel-jest": "^26.6.3", "core-js": "^3.20.0", "css-what": ">=5.0.1", @@ -3423,6 +3423,12 @@ "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==", "dev": true }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true + }, "node_modules/atob": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", @@ -3436,12 +3442,14 @@ } }, "node_modules/axios": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz", - "integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.0.tgz", + "integrity": "sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==", "dev": true, "dependencies": { - "follow-redirects": "^1.14.4" + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" } }, "node_modules/babel-jest": { @@ -4125,6 +4133,18 @@ "text-hex": "1.0.x" } }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/commander": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", @@ -4503,6 +4523,15 @@ "node": ">=0.10.0" } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -5524,9 +5553,9 @@ "dev": true }, "node_modules/follow-redirects": { - "version": "1.14.9", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz", - "integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==", + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", + "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", "dev": true, "funding": [ { @@ -5564,6 +5593,20 @@ "node": ">=0.10.0" } }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dev": true, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", @@ -9033,6 +9076,27 @@ "node": ">=8.6" } }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", @@ -14754,6 +14818,12 @@ "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==", "dev": true }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true + }, "atob": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", @@ -14761,12 +14831,14 @@ "dev": true }, "axios": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz", - "integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.0.tgz", + "integrity": "sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==", "dev": true, "requires": { - "follow-redirects": "^1.14.4" + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" } }, "babel-jest": { @@ -15363,6 +15435,15 @@ "text-hex": "1.0.x" } }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, "commander": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", @@ -15657,6 +15738,12 @@ } } }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true + }, "detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -16467,9 +16554,9 @@ "dev": true }, "follow-redirects": { - "version": "1.14.9", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz", - "integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==", + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", + "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", "dev": true }, "for-in": { @@ -16487,6 +16574,17 @@ "for-in": "^1.0.1" } }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, "fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", @@ -19196,6 +19294,21 @@ "picomatch": "^2.3.1" } }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "requires": { + "mime-db": "1.52.0" + } + }, "mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", diff --git a/html/themes/custom/common_design_subtheme/package.json b/html/themes/custom/common_design_subtheme/package.json index e64040e9a..00e971182 100644 --- a/html/themes/custom/common_design_subtheme/package.json +++ b/html/themes/custom/common_design_subtheme/package.json @@ -23,7 +23,7 @@ "devDependencies": { "@babel/preset-env": "^7.16.4", "@xmldom/xmldom": "^0.8.4", - "axios": ">=0.21.2", + "axios": ">=1.6.0", "babel-jest": "^26.6.3", "core-js": "^3.20.0", "css-what": ">=5.0.1", diff --git a/scripts/retagging/RW-829.php b/scripts/retagging/RW-829.php new file mode 100644 index 000000000..e14b2d9bd --- /dev/null +++ b/scripts/retagging/RW-829.php @@ -0,0 +1,61 @@ + 2929, +]; + +$nids = \Drupal::database()->query(" + SELECT DISTINCT n.nid + FROM {node_field_data} AS n + INNER JOIN {node__field_source} AS fs + ON fs.entity_id = n.nid + WHERE fs.field_source_target_id IN (:sources[]) + ORDER BY nid ASC +", [ + ":sources[]" => array_keys($sources), +])->fetchCol(); + +$total = count($nids); + +echo "Found " . $total . " nodes to update" . PHP_EOL; + +if (!empty($proceed)) { + $storage = \Drupal::entityTypeManager()->getStorage("node"); + $chunk_size = 100; + $now = time(); + $progress = 1; + + $results = []; + foreach (array_chunk($nids, $chunk_size) as $chunk) { + foreach ($storage->loadMultiple($chunk) as $node) { + foreach ($node->field_source as $item) { + if (isset($sources[$item->target_id])) { + $results[$node->bundle()][$item->target_id] = ($results[$node->bundle()][$item->target_id] ?? 0) + 1; + $item->target_id = $sources[$item->target_id]; + } + } + + $node->notifications_content_disable = TRUE; + $node->setRevisionLogMessage("Automatic retagging of source (Ref: RW-829)."); + $node->setRevisionUserId(2); + $node->setRevisionCreationTime($now); + $node->setNewRevision(TRUE); + if ($save) { + $node->save(); + } + + echo "Progress: $progress / $total..." . PHP_EOL; + $progress++; + } + } + + print_r($results); +}