From 354341988bf2d2f2a0cb3579b1246f58e6faeb81 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Mon, 3 Jul 2023 20:04:57 -0300 Subject: [PATCH 01/14] Drupal 10 Compatibility from Upgrade Status --- .github/workflows/build-2.x.yml | 6 +-- islandora.info.yml | 37 +++++++++---------- .../islandora_advanced_search.info.yml | 2 +- .../src/Form/AdvancedSearchForm.php | 2 +- .../src/Plugin/Block/AdvancedSearchBlock.php | 2 +- .../Plugin/Block/SearchResultsPagerBlock.php | 2 +- .../islandora_audio/islandora_audio.info.yml | 3 +- .../islandora_breadcrumbs.info.yml | 3 +- .../islandora_core_feature.info.yml | 3 +- .../islandora_iiif/islandora_iiif.info.yml | 3 +- .../islandora_image/islandora_image.info.yml | 3 +- .../islandora_text_extraction.info.yml | 3 +- ...slandora_text_extraction_defaults.info.yml | 3 +- .../islandora_video/islandora_video.info.yml | 3 +- src/EventGenerator/EventGenerator.php | 1 + src/Flysystem/Adapter/FedoraAdapter.php | 19 ++-------- src/Plugin/Condition/NodeReferencedByNode.php | 1 + tests/src/Kernel/FedoraAdapterTest.php | 9 +---- tests/src/Kernel/FedoraPluginTest.php | 3 ++ 19 files changed, 42 insertions(+), 66 deletions(-) diff --git a/.github/workflows/build-2.x.yml b/.github/workflows/build-2.x.yml index 27506495e..6c78bcf9c 100644 --- a/.github/workflows/build-2.x.yml +++ b/.github/workflows/build-2.x.yml @@ -23,12 +23,10 @@ jobs: strategy: fail-fast: false matrix: - # PHP 8.1 fails - see https://github.com/Islandora/islandora/issues/887 - php-versions: ["7.4", "8.0", "8.1"] + php-versions: ["8.1"] # test-suite functional-javascript will appear to pass but will skip tests; missing chromedriver. test-suite: ["kernel", "functional", "functional-javascript"] - # Not yet Drupal 10 ready - see https://github.com/Islandora/islandora/issues/888 - drupal-version: ["9.4.x", "9.5.x"] + drupal-version: ["9.5.x", "10.0.x", "10.1.x"] mysql: ["8.0"] allowed_failure: [false] diff --git a/islandora.info.yml b/islandora.info.yml index 0336d89d3..34e8118ac 100644 --- a/islandora.info.yml +++ b/islandora.info.yml @@ -4,32 +4,31 @@ name: 'islandora' description: "Islandora Core" type: module package: Islandora -core: 8.x -core_version_requirement: ^8 || ^9 +core_version_requirement: ^9 || ^10 dependencies: + - context:context_ui + - ctools:ctools + - drupal:action + - drupal:basic_auth - drupal:block + - drupal:content_translation + - drupal:link + - drupal:media - drupal:node - - drupal:path - - drupal:text - drupal:options - - drupal:link - - jsonld:jsonld - - search_api:search_api - - jwt:jwt + - drupal:path - drupal:rest - - filehash:filehash - - drupal:basic_auth - - context:context_ui - - drupal:action - - eva:eva - drupal:taxonomy + - drupal:text - drupal:views_ui - - drupal:media - - prepopulate:prepopulate + - eva:eva - features:features_ui - - migrate_source_csv:migrate_source_csv - - drupal:content_translation + - file_replace:file_replace + - filehash:filehash - flysystem:flysystem + - jsonld:jsonld + - jwt:jwt + - migrate_source_csv:migrate_source_csv + - prepopulate:prepopulate + - search_api:search_api - token:token - - file_replace:file_replace - - ctools:ctools diff --git a/modules/islandora_advanced_search/islandora_advanced_search.info.yml b/modules/islandora_advanced_search/islandora_advanced_search.info.yml index 524e9dc74..19fae53a5 100644 --- a/modules/islandora_advanced_search/islandora_advanced_search.info.yml +++ b/modules/islandora_advanced_search/islandora_advanced_search.info.yml @@ -4,7 +4,7 @@ name: 'Islandora Advanced Search' description: "Creates an Advanced Search block and other enhancements to search." type: module package: Islandora -core_version_requirement: ^8 || ^9 +core_version_requirement: ^9 || ^10 dependencies: - drupal:facets - drupal:facets_summary diff --git a/modules/islandora_advanced_search/src/Form/AdvancedSearchForm.php b/modules/islandora_advanced_search/src/Form/AdvancedSearchForm.php index c00ce5665..09dd1646d 100644 --- a/modules/islandora_advanced_search/src/Form/AdvancedSearchForm.php +++ b/modules/islandora_advanced_search/src/Form/AdvancedSearchForm.php @@ -71,7 +71,7 @@ public function __construct(Request $request, RouteMatchInterface $current_route */ public static function create(ContainerInterface $container) { return new static( - $container->get('request_stack')->getMasterRequest(), + $container->get('request_stack')->getMainRequest(), $container->get('current_route_match') ); } diff --git a/modules/islandora_advanced_search/src/Plugin/Block/AdvancedSearchBlock.php b/modules/islandora_advanced_search/src/Plugin/Block/AdvancedSearchBlock.php index c5f5adb8c..2aa77f124 100644 --- a/modules/islandora_advanced_search/src/Plugin/Block/AdvancedSearchBlock.php +++ b/modules/islandora_advanced_search/src/Plugin/Block/AdvancedSearchBlock.php @@ -108,7 +108,7 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_definition, $container->get('plugin.manager.search_api.display'), $container->get('form_builder'), - $container->get('request_stack')->getMasterRequest() + $container->get('request_stack')->getMainRequest() ); } diff --git a/modules/islandora_advanced_search/src/Plugin/Block/SearchResultsPagerBlock.php b/modules/islandora_advanced_search/src/Plugin/Block/SearchResultsPagerBlock.php index f2e4a1703..e1e477d83 100644 --- a/modules/islandora_advanced_search/src/Plugin/Block/SearchResultsPagerBlock.php +++ b/modules/islandora_advanced_search/src/Plugin/Block/SearchResultsPagerBlock.php @@ -58,7 +58,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('request_stack')->getMasterRequest() + $container->get('request_stack')->getMainRequest() ); } diff --git a/modules/islandora_audio/islandora_audio.info.yml b/modules/islandora_audio/islandora_audio.info.yml index 998590f57..5e6beb5ae 100644 --- a/modules/islandora_audio/islandora_audio.info.yml +++ b/modules/islandora_audio/islandora_audio.info.yml @@ -2,7 +2,6 @@ name: 'Islandora Audio' description: 'Islandora audio derivative actions' type: module package: Islandora -core: 8.x -core_version_requirement: ^8 || ^9 +core_version_requirement: ^9 || ^10 dependencies: - drupal:islandora diff --git a/modules/islandora_breadcrumbs/islandora_breadcrumbs.info.yml b/modules/islandora_breadcrumbs/islandora_breadcrumbs.info.yml index c76020cb6..661ec70a2 100644 --- a/modules/islandora_breadcrumbs/islandora_breadcrumbs.info.yml +++ b/modules/islandora_breadcrumbs/islandora_breadcrumbs.info.yml @@ -1,8 +1,7 @@ name: 'Islandora Breadcrumbs' type: module description: 'Builds breadcrumbs based on field_member_of relationships.' -core: 8.x -core_version_requirement: ^8 || ^9 +core_version_requirement: ^9 || ^10 package: Islandora dependencies: - islandora:islandora diff --git a/modules/islandora_core_feature/islandora_core_feature.info.yml b/modules/islandora_core_feature/islandora_core_feature.info.yml index bf4f8d7a6..6976eb8ca 100755 --- a/modules/islandora_core_feature/islandora_core_feature.info.yml +++ b/modules/islandora_core_feature/islandora_core_feature.info.yml @@ -1,8 +1,7 @@ name: 'Islandora Core Feature' description: 'Minimum configuration required for Islandora.' type: module -core: 8.x -core_version_requirement: ^8 || ^9 +core_version_requirement: ^9 || ^10 dependencies: - drupal:basic_auth - drupal:content_translation diff --git a/modules/islandora_iiif/islandora_iiif.info.yml b/modules/islandora_iiif/islandora_iiif.info.yml index 0492158a2..39b835c09 100644 --- a/modules/islandora_iiif/islandora_iiif.info.yml +++ b/modules/islandora_iiif/islandora_iiif.info.yml @@ -1,8 +1,7 @@ name: 'Islandora IIIF' type: module description: 'IIIF support for Islandora' -core: 8.x -core_version_requirement: ^8 || ^9 +core_version_requirement: ^9 || ^10 package: Islandora dependencies: - drupal:islandora diff --git a/modules/islandora_image/islandora_image.info.yml b/modules/islandora_image/islandora_image.info.yml index 87076462c..277966f38 100644 --- a/modules/islandora_image/islandora_image.info.yml +++ b/modules/islandora_image/islandora_image.info.yml @@ -1,8 +1,7 @@ name: 'Islandora Image' type: module description: 'Islandora Image derivative actions' -core: 8.x -core_version_requirement: ^8 || ^9 +core_version_requirement: ^9 || ^10 package: Islandora dependencies: - drupal:islandora diff --git a/modules/islandora_text_extraction/islandora_text_extraction.info.yml b/modules/islandora_text_extraction/islandora_text_extraction.info.yml index 67687f901..fb768e2ab 100644 --- a/modules/islandora_text_extraction/islandora_text_extraction.info.yml +++ b/modules/islandora_text_extraction/islandora_text_extraction.info.yml @@ -1,8 +1,7 @@ name: 'Islandora Text Extraction' type: module description: 'Islandora 8 module to connect to Hypercube microservice, and to get text from PDF ingest' -core: 8.x -core_version_requirement: ^8 || ^9 +core_version_requirement: ^9 || ^10 package: 'Islandora' dependencies: - drupal:islandora diff --git a/modules/islandora_text_extraction_defaults/islandora_text_extraction_defaults.info.yml b/modules/islandora_text_extraction_defaults/islandora_text_extraction_defaults.info.yml index 5b9aa14f7..8596dbd32 100644 --- a/modules/islandora_text_extraction_defaults/islandora_text_extraction_defaults.info.yml +++ b/modules/islandora_text_extraction_defaults/islandora_text_extraction_defaults.info.yml @@ -1,8 +1,7 @@ name: 'Islandora Text Extraction Defaults' type: module description: 'Default config for the Islandora Text Extraction module.' -core: 8.x -core_version_requirement: ^8 || ^9 +core_version_requirement: ^9 || ^10 package: Islandora dependencies: - drupal:field diff --git a/modules/islandora_video/islandora_video.info.yml b/modules/islandora_video/islandora_video.info.yml index 48eb82f2f..aa51af113 100644 --- a/modules/islandora_video/islandora_video.info.yml +++ b/modules/islandora_video/islandora_video.info.yml @@ -2,7 +2,6 @@ name: 'Islandora Video' description: 'Islandora video derivative actions' type: module package: Islandora -core: 8.x -core_version_requirement: ^8 || ^9 +core_version_requirement: ^9 || ^10 dependencies: - drupal:islandora diff --git a/src/EventGenerator/EventGenerator.php b/src/EventGenerator/EventGenerator.php index 6b3a4c5cf..b975f6083 100644 --- a/src/EventGenerator/EventGenerator.php +++ b/src/EventGenerator/EventGenerator.php @@ -192,6 +192,7 @@ protected function isNewRevision(EntityInterface $entity) { protected function getRevisionIds(Media $media, EntityStorageInterface $media_storage) { $result = $media_storage->getQuery() ->allRevisions() + ->accessCheck(TRUE) ->condition($media->getEntityType()->getKey('id'), $media->id()) ->sort($media->getEntityType()->getKey('revision'), 'DESC') ->execute(); diff --git a/src/Flysystem/Adapter/FedoraAdapter.php b/src/Flysystem/Adapter/FedoraAdapter.php index 55f8b11d3..cf24cb779 100644 --- a/src/Flysystem/Adapter/FedoraAdapter.php +++ b/src/Flysystem/Adapter/FedoraAdapter.php @@ -160,14 +160,8 @@ protected function getMetadataFromHeaders(Response $response) { // NonRDFSource's are considered files. Everything else is a // directory. $type = 'dir'; - // phpcs:disable - if (class_exists(Header::class)) { - $links = Header::parse($response->getHeader('Link')); - } - else { - $links = parse_header($response->getHeader('Link')); - } - // phpcs:enable + $links = Header::parse($response->getHeader('Link')); + foreach ($links as $link) { if ($link['rel'] == 'type' && $link[0] == '') { $type = 'file'; @@ -403,14 +397,7 @@ private function deleteTombstone($path) { $return = NULL; if ($response->getStatusCode() == 410) { $return = FALSE; - // phpcs:disable - if (class_exists(Header::class)) { - $link_headers = Header::parse($response->getHeader('Link')); - } - else { - $link_headers = parse_header($response->getHeader('Link')); - } - // phpcs:enable + $link_headers = Header::parse($response->getHeader('Link')); if ($link_headers) { $tombstones = array_filter($link_headers, function ($o) { return (isset($o['rel']) && $o['rel'] == 'hasTombstone'); diff --git a/src/Plugin/Condition/NodeReferencedByNode.php b/src/Plugin/Condition/NodeReferencedByNode.php index c5611a3ee..d6db01ea0 100644 --- a/src/Plugin/Condition/NodeReferencedByNode.php +++ b/src/Plugin/Condition/NodeReferencedByNode.php @@ -128,6 +128,7 @@ protected function evaluateEntity(EntityInterface $entity) { $config = FieldStorageConfig::loadByName('node', $reference_field); if ($config) { $id_count = \Drupal::entityQuery('node') + ->accessCheck(TRUE) ->condition($reference_field, $entity->id()) ->count() ->execute(); diff --git a/tests/src/Kernel/FedoraAdapterTest.php b/tests/src/Kernel/FedoraAdapterTest.php index d6adecbbd..4a9d45b5a 100644 --- a/tests/src/Kernel/FedoraAdapterTest.php +++ b/tests/src/Kernel/FedoraAdapterTest.php @@ -61,13 +61,8 @@ protected function createAdapterBase() { ]); $prophecy->getHeader('Content-Type')->willReturn(['text/plain']); $prophecy->getHeader('Content-Length')->willReturn([strlen("DERP")]); - // phpcs:disable - if (class_exists(Utils::class)) { - $prophecy->getBody()->willReturn(Utils::streamFor("DERP")); - } else { - $prophecy->getBody()->willReturn(stream_for("DERP")); - } - // phpcs:enable + $prophecy->getBody()->willReturn(Utils::streamFor("DERP")); + return $prophecy; } diff --git a/tests/src/Kernel/FedoraPluginTest.php b/tests/src/Kernel/FedoraPluginTest.php index cd1c83256..92a8137ca 100644 --- a/tests/src/Kernel/FedoraPluginTest.php +++ b/tests/src/Kernel/FedoraPluginTest.php @@ -6,6 +6,7 @@ use Drupal\islandora\Flysystem\Fedora; use Islandora\Chullo\IFedoraApi; use League\Flysystem\AdapterInterface; +use Prophecy\PhpUnit\ProphecyTrait; use Psr\Http\Message\ResponseInterface; use Symfony\Component\Mime\MimeTypeGuesserInterface; @@ -17,6 +18,8 @@ */ class FedoraPluginTest extends IslandoraKernelTestBase { + use ProphecyTrait; + /** * Mocks up a plugin. */ From bf17ed9bbc39456c1c8d70e897bd1e40943fd349 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Mon, 3 Jul 2023 20:18:03 -0300 Subject: [PATCH 02/14] Allow contexts module in RC. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index bf274cd1d..48ee9a4a7 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "drupal/context": "^4", + "drupal/context": "^4 || ^5@RC", "drupal/ctools": "^3.8 || ^4", "drupal/eva" : "^3.0", "drupal/features" : "^3.7", From 0665310346b0deae8b4032438c5f098c6abc12ce Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Mon, 3 Jul 2023 20:20:04 -0300 Subject: [PATCH 03/14] Remove unused use statements. --- src/Flysystem/Adapter/FedoraAdapter.php | 1 - tests/src/Kernel/FedoraAdapterTest.php | 1 - 2 files changed, 2 deletions(-) diff --git a/src/Flysystem/Adapter/FedoraAdapter.php b/src/Flysystem/Adapter/FedoraAdapter.php index cf24cb779..0871827e1 100644 --- a/src/Flysystem/Adapter/FedoraAdapter.php +++ b/src/Flysystem/Adapter/FedoraAdapter.php @@ -3,7 +3,6 @@ namespace Drupal\islandora\Flysystem\Adapter; use GuzzleHttp\Psr7\Header; -use function GuzzleHttp\Psr7\parse_header; use Drupal\Core\Logger\LoggerChannelInterface; use Islandora\Chullo\IFedoraApi; use League\Flysystem\AdapterInterface; diff --git a/tests/src/Kernel/FedoraAdapterTest.php b/tests/src/Kernel/FedoraAdapterTest.php index 4a9d45b5a..08db253c5 100644 --- a/tests/src/Kernel/FedoraAdapterTest.php +++ b/tests/src/Kernel/FedoraAdapterTest.php @@ -4,7 +4,6 @@ use Prophecy\PhpUnit\ProphecyTrait; use GuzzleHttp\Psr7\Utils; -use function GuzzleHttp\Psr7\stream_for; use Drupal\Core\Logger\LoggerChannelInterface; use Drupal\islandora\Flysystem\Adapter\FedoraAdapter; use GuzzleHttp\Psr7\Response; From 8f77733c84b441a97dcb5a5e3f670664d5fc843c Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Mon, 3 Jul 2023 20:28:43 -0300 Subject: [PATCH 04/14] Allow jsonld 3.x. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 48ee9a4a7..1cc5f74d9 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "drupal/token" : "^1.3", "islandora/chullo": "^2.0", "islandora/fedora-entity-mapper": "^1.0", - "islandora/jsonld": "^2", + "islandora/jsonld": "^2 || ^3", "stomp-php/stomp-php": "4.* || ^5" }, "require-dev": { From 2040952740d571ff7eb5e95339914dd7ac95c289 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Tue, 4 Jul 2023 09:17:48 -0300 Subject: [PATCH 05/14] Integer weight selector test module to D10. --- .../integer_weight_test_views.info.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/modules/integer_weight_test_views/integer_weight_test_views.info.yml b/tests/modules/integer_weight_test_views/integer_weight_test_views.info.yml index 7e2981427..77b12ec37 100644 --- a/tests/modules/integer_weight_test_views/integer_weight_test_views.info.yml +++ b/tests/modules/integer_weight_test_views/integer_weight_test_views.info.yml @@ -2,7 +2,7 @@ name: 'Integer weight test views' type: module description: 'Provides default views for integer weight views tests.' package: Testing -core_version_requirement: ^8 || ^9 +core_version_requirement: ^8 || ^9 || ^10 dependencies: - drupal:node - drupal:views From cb2e1c4809c76c4f6fe6812c0dbcee7d96aeab17 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Tue, 4 Jul 2023 09:23:38 -0300 Subject: [PATCH 06/14] Remove 8 for consistency. --- .../integer_weight_test_views.info.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/modules/integer_weight_test_views/integer_weight_test_views.info.yml b/tests/modules/integer_weight_test_views/integer_weight_test_views.info.yml index 77b12ec37..013c7dd86 100644 --- a/tests/modules/integer_weight_test_views/integer_weight_test_views.info.yml +++ b/tests/modules/integer_weight_test_views/integer_weight_test_views.info.yml @@ -2,7 +2,7 @@ name: 'Integer weight test views' type: module description: 'Provides default views for integer weight views tests.' package: Testing -core_version_requirement: ^8 || ^9 || ^10 +core_version_requirement: ^9 || ^10 dependencies: - drupal:node - drupal:views From a77bd2d949157c2590df9bf14634747725ce8b33 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Tue, 4 Jul 2023 15:57:30 -0300 Subject: [PATCH 07/14] Return array not string. --- .../integer_weight_test_views.info.yml | 2 +- tests/src/Kernel/FedoraAdapterTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/modules/integer_weight_test_views/integer_weight_test_views.info.yml b/tests/modules/integer_weight_test_views/integer_weight_test_views.info.yml index 013c7dd86..77b12ec37 100644 --- a/tests/modules/integer_weight_test_views/integer_weight_test_views.info.yml +++ b/tests/modules/integer_weight_test_views/integer_weight_test_views.info.yml @@ -2,7 +2,7 @@ name: 'Integer weight test views' type: module description: 'Provides default views for integer weight views tests.' package: Testing -core_version_requirement: ^9 || ^10 +core_version_requirement: ^8 || ^9 || ^10 dependencies: - drupal:node - drupal:views diff --git a/tests/src/Kernel/FedoraAdapterTest.php b/tests/src/Kernel/FedoraAdapterTest.php index 08db253c5..9067d369e 100644 --- a/tests/src/Kernel/FedoraAdapterTest.php +++ b/tests/src/Kernel/FedoraAdapterTest.php @@ -235,7 +235,7 @@ protected function createAdapterForDeleteWithTombstone() { $head_prophecy = $this->prophesize(Response::class); $head_prophecy->getStatusCode()->willReturn(410); $head_prophecy->getHeader('Link') - ->willReturn('; rel="hasTombstone"'); + ->willReturn(['; rel="hasTombstone"']); $tombstone_prophecy = $this->prophesize(Response::class); $tombstone_prophecy->getStatusCode()->willReturn(204); @@ -263,7 +263,7 @@ protected function createAdapterForDeleteWithTombstoneFail() { $head_prophecy = $this->prophesize(Response::class); $head_prophecy->getStatusCode()->willReturn(410); $head_prophecy->getHeader('Link') - ->willReturn('; rel="hasTombstone"'); + ->willReturn(['; rel="hasTombstone"']); $tombstone_prophecy = $this->prophesize(Response::class); $tombstone_prophecy->getStatusCode()->willReturn(500); From 8686dbf74b29f0e18e2e142255a12604f50ee4f5 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Tue, 4 Jul 2023 19:01:09 -0300 Subject: [PATCH 08/14] Avoid duplicate counts of the same file being deleted. --- src/Form/ConfirmDeleteMediaAndFile.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Form/ConfirmDeleteMediaAndFile.php b/src/Form/ConfirmDeleteMediaAndFile.php index 64c1bff3c..d5dc9750b 100644 --- a/src/Form/ConfirmDeleteMediaAndFile.php +++ b/src/Form/ConfirmDeleteMediaAndFile.php @@ -137,8 +137,11 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $inaccessible_entities[] = $file; continue; } - $delete_files[$file->id()] = $file; - $total_count++; + if (!array_key_exists($file->id(), $delete_files)) { + $delete_files[$file->id()] = $file; + $total_count++; + } + } } } From 91016fd2379ac3cd6a0517c8331909603e0a0808 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Thu, 6 Jul 2023 14:51:23 -0300 Subject: [PATCH 09/14] Don't delete files in the thumbnail field. --- src/Form/ConfirmDeleteMediaAndFile.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Form/ConfirmDeleteMediaAndFile.php b/src/Form/ConfirmDeleteMediaAndFile.php index d5dc9750b..a9613871f 100644 --- a/src/Form/ConfirmDeleteMediaAndFile.php +++ b/src/Form/ConfirmDeleteMediaAndFile.php @@ -128,6 +128,9 @@ public function submitForm(array &$form, FormStateInterface $form_state) { // Check for files. $fields = $this->entityFieldManager->getFieldDefinitions('media', $entity->bundle()); foreach ($fields as $field) { + if ($field->getName() == 'thumbnail') { + continue; + } $type = $field->getType(); if ($type == 'file' || $type == 'image') { $target_id = $entity->get($field->getName())->target_id; From 6d59c526d3d6eac8096319d5ed63e75eb2be155c Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Thu, 6 Jul 2023 14:51:50 -0300 Subject: [PATCH 10/14] In Drupal 10.1, include new file delete permission. --- tests/src/Functional/DeleteMediaTest.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/src/Functional/DeleteMediaTest.php b/tests/src/Functional/DeleteMediaTest.php index 86895dbbc..4328d92da 100644 --- a/tests/src/Functional/DeleteMediaTest.php +++ b/tests/src/Functional/DeleteMediaTest.php @@ -50,8 +50,14 @@ class DeleteMediaTest extends IslandoraFunctionalTestBase { public function setUp(): void { parent::setUp(); + if (floatval(\Drupal::VERSION) >= 10.1) { + $permissions = ['create media', 'delete any media', 'delete any files']; + } else { + $permissions = ['create media', 'delete any media']; + } + // Create a test user. - $this->account = $this->createUser(['create media', 'delete any media']); + $this->account = $this->createUser($permissions); list($this->file, $this->media) = $this->makeMediaAndFile($this->account); } From 5c09a1e3f4312f7333b711ae88304656733b1c00 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Thu, 6 Jul 2023 14:54:17 -0300 Subject: [PATCH 11/14] Use a better version compare call. --- tests/src/Functional/DeleteMediaTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/Functional/DeleteMediaTest.php b/tests/src/Functional/DeleteMediaTest.php index 4328d92da..586250cc8 100644 --- a/tests/src/Functional/DeleteMediaTest.php +++ b/tests/src/Functional/DeleteMediaTest.php @@ -50,7 +50,7 @@ class DeleteMediaTest extends IslandoraFunctionalTestBase { public function setUp(): void { parent::setUp(); - if (floatval(\Drupal::VERSION) >= 10.1) { + if (version_compare(\Drupal::VERSION, '10.1', '>=')){ $permissions = ['create media', 'delete any media', 'delete any files']; } else { $permissions = ['create media', 'delete any media']; From 6b05ff5f99b77d4300a36b32ce7e18bd55e796e8 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Thu, 6 Jul 2023 14:58:53 -0300 Subject: [PATCH 12/14] typo in permission name. --- tests/src/Functional/DeleteMediaTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/Functional/DeleteMediaTest.php b/tests/src/Functional/DeleteMediaTest.php index 586250cc8..7ca809222 100644 --- a/tests/src/Functional/DeleteMediaTest.php +++ b/tests/src/Functional/DeleteMediaTest.php @@ -51,7 +51,7 @@ public function setUp(): void { parent::setUp(); if (version_compare(\Drupal::VERSION, '10.1', '>=')){ - $permissions = ['create media', 'delete any media', 'delete any files']; + $permissions = ['create media', 'delete any media', 'delete any file']; } else { $permissions = ['create media', 'delete any media']; } From 408776437b38f780942f300534539f9336e6af96 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Thu, 6 Jul 2023 15:04:48 -0300 Subject: [PATCH 13/14] phpcs. --- tests/src/Functional/DeleteMediaTest.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/src/Functional/DeleteMediaTest.php b/tests/src/Functional/DeleteMediaTest.php index 7ca809222..c52eca31f 100644 --- a/tests/src/Functional/DeleteMediaTest.php +++ b/tests/src/Functional/DeleteMediaTest.php @@ -50,9 +50,10 @@ class DeleteMediaTest extends IslandoraFunctionalTestBase { public function setUp(): void { parent::setUp(); - if (version_compare(\Drupal::VERSION, '10.1', '>=')){ + if (version_compare(\Drupal::VERSION, '10.1', '>=')) { $permissions = ['create media', 'delete any media', 'delete any file']; - } else { + } + else { $permissions = ['create media', 'delete any media']; } From 0fe2a8f559ccf32533d327c78f6f2422bc072c64 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Tue, 11 Jul 2023 13:42:42 -0300 Subject: [PATCH 14/14] Update features spec. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1cc5f74d9..7706ec74b 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "drupal/context": "^4 || ^5@RC", "drupal/ctools": "^3.8 || ^4", "drupal/eva" : "^3.0", - "drupal/features" : "^3.7", + "drupal/features" : "^3.13", "drupal/file_replace": "^1.1", "drupal/filehash": "^2", "drupal/flysystem" : "^2.0@alpha",