From 77094253584bde34058fecfa0d838be7b7c9fadb Mon Sep 17 00:00:00 2001 From: Alexander O'Neill Date: Wed, 2 Feb 2022 17:03:22 +0000 Subject: [PATCH 1/8] Add check for cache tags in JSON-LD alter hook. --- islandora.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/islandora.module b/islandora.module index 738be5b43..85abaf0d0 100644 --- a/islandora.module +++ b/islandora.module @@ -251,7 +251,7 @@ function islandora_jsonld_alter_normalized_array(EntityInterface $entity, array $reaction->execute($entity, $normalized, $context); foreach ($context_manager->getActiveContexts() as $context_config) { try { - if ($context_config->getReaction($reaction->getPluginId())) { + if ($context_config->getReaction($reaction->getPluginId()) && isset($context['cacheability'])) { $context['cacheability']->addCacheTags($context_config->getCacheTags()); }; } From 2199336446580ca76f2ba043445c364be81a85d2 Mon Sep 17 00:00:00 2001 From: Alexander O'Neill Date: Mon, 28 Feb 2022 17:49:25 +0000 Subject: [PATCH 2/8] Add further check to jsonld context cacheability to avoid white screen. --- islandora.module | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/islandora.module b/islandora.module index 85abaf0d0..dd8f363f2 100644 --- a/islandora.module +++ b/islandora.module @@ -251,7 +251,8 @@ function islandora_jsonld_alter_normalized_array(EntityInterface $entity, array $reaction->execute($entity, $normalized, $context); foreach ($context_manager->getActiveContexts() as $context_config) { try { - if ($context_config->getReaction($reaction->getPluginId()) && isset($context['cacheability'])) { + if ($context_config->getReaction($reaction->getPluginId()) && isset($context['cacheability']) + && method_exists($context['cacheability'], 'addCacheTags')) { $context['cacheability']->addCacheTags($context_config->getCacheTags()); }; } From 1a61b178754e2f44db42e427ebfc4a60add43e06 Mon Sep 17 00:00:00 2001 From: Alexander O'Neill Date: Wed, 23 Mar 2022 12:50:09 +0000 Subject: [PATCH 3/8] Update to File Hash 2.x due to failing tests. See https://www.drupal.org/project/filehash/issues/3271137 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 46bede3f2..2993244dd 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "islandora/jsonld": "^2", "stomp-php/stomp-php": "4.*", "drupal/jwt": "^1.0.0-beta5", - "drupal/filehash": "^1.1", + "drupal/filehash": "^2", "drupal/prepopulate" : "^2.2", "drupal/eva" : "^2.0", "drupal/features" : "^3.7", From 20f7ebb3328c57abc8062a16b027e8e4922fcbb9 Mon Sep 17 00:00:00 2001 From: Alexander O'Neill Date: Wed, 23 Mar 2022 18:26:13 +0000 Subject: [PATCH 4/8] Maintain backward compatibility with File Hash v. 1.x Use valid license string per composer validate. --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 2993244dd..c783e12be 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "islandora/jsonld": "^2", "stomp-php/stomp-php": "4.*", "drupal/jwt": "^1.0.0-beta5", - "drupal/filehash": "^2", + "drupal/filehash": "^1.1 || ^2", "drupal/prepopulate" : "^2.2", "drupal/eva" : "^2.0", "drupal/features" : "^3.7", @@ -39,7 +39,7 @@ "suggest": { "drupal/transliterate_filenames": "Sanitizes filenames when they are uploaded so they don't break your repository." }, - "license": "GPL-2.0+", + "license": "GPL-2.0-or-later", "authors": [ { "name": "Islandora Foundation", From 9c8193b75a79e90c59acbc13cfd322635f645fcc Mon Sep 17 00:00:00 2001 From: Alexander O'Neill Date: Thu, 24 Mar 2022 14:26:10 -0300 Subject: [PATCH 5/8] islandora:862 Incorporate PR review suggestion Co-authored-by: Jordan Dukart --- islandora.module | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/islandora.module b/islandora.module index dd8f363f2..f81693d33 100644 --- a/islandora.module +++ b/islandora.module @@ -251,9 +251,9 @@ function islandora_jsonld_alter_normalized_array(EntityInterface $entity, array $reaction->execute($entity, $normalized, $context); foreach ($context_manager->getActiveContexts() as $context_config) { try { - if ($context_config->getReaction($reaction->getPluginId()) && isset($context['cacheability']) - && method_exists($context['cacheability'], 'addCacheTags')) { - $context['cacheability']->addCacheTags($context_config->getCacheTags()); + if ($context_config->getReaction($reaction->getPluginId()) && isset($context[CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY])) { + $context[CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY]->addCacheableDependency($context_config); + }; }; } catch (PluginNotFoundException $e) { From f7287be0125e90bf7a5904ebac6a8c7c896e1a63 Mon Sep 17 00:00:00 2001 From: Alexander O'Neill Date: Thu, 24 Mar 2022 18:04:31 +0000 Subject: [PATCH 6/8] islandora:862 Add Use statement to go with last commit. --- islandora.module | 1 + 1 file changed, 1 insertion(+) diff --git a/islandora.module b/islandora.module index f81693d33..8cff7884e 100644 --- a/islandora.module +++ b/islandora.module @@ -26,6 +26,7 @@ use Drupal\media\MediaInterface; use Drupal\file\FileInterface; use Drupal\taxonomy\TermInterface; use Drupal\Core\Routing\RouteMatchInterface; +use Drupal\serialization\Normalizer\CacheableNormalizerInterface; /** * Implements hook_help(). From ac749ce3b59526bc26af545c25e0ded423a97991 Mon Sep 17 00:00:00 2001 From: Alexander O'Neill Date: Thu, 24 Mar 2022 18:18:48 +0000 Subject: [PATCH 7/8] Fix syntax error. --- islandora.module | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/islandora.module b/islandora.module index 8cff7884e..d7f1ceb64 100644 --- a/islandora.module +++ b/islandora.module @@ -253,8 +253,7 @@ function islandora_jsonld_alter_normalized_array(EntityInterface $entity, array foreach ($context_manager->getActiveContexts() as $context_config) { try { if ($context_config->getReaction($reaction->getPluginId()) && isset($context[CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY])) { - $context[CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY]->addCacheableDependency($context_config); - }; + $context[CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY]->addCacheableDependency($context_config); }; } catch (PluginNotFoundException $e) { From 4c08d5a274b1ac313cc523aa2df67d6f5d640429 Mon Sep 17 00:00:00 2001 From: Alexander O'Neill Date: Thu, 24 Mar 2022 19:10:17 +0000 Subject: [PATCH 8/8] islandora:862 Remove white space at end of line causing failing tests. --- islandora.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/islandora.module b/islandora.module index d7f1ceb64..e26888674 100644 --- a/islandora.module +++ b/islandora.module @@ -253,7 +253,7 @@ function islandora_jsonld_alter_normalized_array(EntityInterface $entity, array foreach ($context_manager->getActiveContexts() as $context_config) { try { if ($context_config->getReaction($reaction->getPluginId()) && isset($context[CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY])) { - $context[CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY]->addCacheableDependency($context_config); + $context[CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY]->addCacheableDependency($context_config); }; } catch (PluginNotFoundException $e) {