Browse Source

Merge pull request #960 from rosiel/drupal10

Drupal 10 Compatibility from Upgrade Status
pull/966/head 2.8.2
Alexander O'Neill 1 year ago committed by GitHub
parent
commit
8f1537670d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      .github/workflows/build-2.x.yml
  2. 6
      composer.json
  3. 37
      islandora.info.yml
  4. 2
      modules/islandora_advanced_search/islandora_advanced_search.info.yml
  5. 2
      modules/islandora_advanced_search/src/Form/AdvancedSearchForm.php
  6. 2
      modules/islandora_advanced_search/src/Plugin/Block/AdvancedSearchBlock.php
  7. 2
      modules/islandora_advanced_search/src/Plugin/Block/SearchResultsPagerBlock.php
  8. 3
      modules/islandora_audio/islandora_audio.info.yml
  9. 3
      modules/islandora_breadcrumbs/islandora_breadcrumbs.info.yml
  10. 3
      modules/islandora_core_feature/islandora_core_feature.info.yml
  11. 3
      modules/islandora_iiif/islandora_iiif.info.yml
  12. 3
      modules/islandora_image/islandora_image.info.yml
  13. 3
      modules/islandora_text_extraction/islandora_text_extraction.info.yml
  14. 3
      modules/islandora_text_extraction_defaults/islandora_text_extraction_defaults.info.yml
  15. 3
      modules/islandora_video/islandora_video.info.yml
  16. 1
      src/EventGenerator/EventGenerator.php
  17. 16
      src/Flysystem/Adapter/FedoraAdapter.php
  18. 6
      src/Form/ConfirmDeleteMediaAndFile.php
  19. 1
      src/Plugin/Condition/NodeReferencedByNode.php
  20. 2
      tests/modules/integer_weight_test_views/integer_weight_test_views.info.yml
  21. 9
      tests/src/Functional/DeleteMediaTest.php
  22. 12
      tests/src/Kernel/FedoraAdapterTest.php
  23. 3
      tests/src/Kernel/FedoraPluginTest.php

6
.github/workflows/build-2.x.yml

@ -23,12 +23,10 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
# PHP 8.1 fails - see https://github.com/Islandora/islandora/issues/887 php-versions: ["8.1"]
php-versions: ["7.4", "8.0", "8.1"]
# test-suite functional-javascript will appear to pass but will skip tests; missing chromedriver. # test-suite functional-javascript will appear to pass but will skip tests; missing chromedriver.
test-suite: ["kernel", "functional", "functional-javascript"] test-suite: ["kernel", "functional", "functional-javascript"]
# Not yet Drupal 10 ready - see https://github.com/Islandora/islandora/issues/888 drupal-version: ["9.5.x", "10.0.x", "10.1.x"]
drupal-version: ["9.4.x", "9.5.x"]
mysql: ["8.0"] mysql: ["8.0"]
allowed_failure: [false] allowed_failure: [false]

6
composer.json

@ -14,10 +14,10 @@
} }
], ],
"require": { "require": {
"drupal/context": "^4", "drupal/context": "^4 || ^5@RC",
"drupal/ctools": "^3.8 || ^4", "drupal/ctools": "^3.8 || ^4",
"drupal/eva" : "^3.0", "drupal/eva" : "^3.0",
"drupal/features" : "^3.7", "drupal/features" : "^3.13",
"drupal/file_replace": "^1.1", "drupal/file_replace": "^1.1",
"drupal/filehash": "^2", "drupal/filehash": "^2",
"drupal/flysystem" : "^2.0@alpha", "drupal/flysystem" : "^2.0@alpha",
@ -29,7 +29,7 @@
"drupal/token" : "^1.3", "drupal/token" : "^1.3",
"islandora/chullo": "^2.0", "islandora/chullo": "^2.0",
"islandora/fedora-entity-mapper": "^1.0", "islandora/fedora-entity-mapper": "^1.0",
"islandora/jsonld": "^2", "islandora/jsonld": "^2 || ^3",
"stomp-php/stomp-php": "4.* || ^5" "stomp-php/stomp-php": "4.* || ^5"
}, },
"require-dev": { "require-dev": {

37
islandora.info.yml

@ -4,32 +4,31 @@ name: 'islandora'
description: "Islandora Core" description: "Islandora Core"
type: module type: module
package: Islandora package: Islandora
core: 8.x core_version_requirement: ^9 || ^10
core_version_requirement: ^8 || ^9
dependencies: dependencies:
- context:context_ui
- ctools:ctools
- drupal:action
- drupal:basic_auth
- drupal:block - drupal:block
- drupal:content_translation
- drupal:link
- drupal:media
- drupal:node - drupal:node
- drupal:path
- drupal:text
- drupal:options - drupal:options
- drupal:link - drupal:path
- jsonld:jsonld
- search_api:search_api
- jwt:jwt
- drupal:rest - drupal:rest
- filehash:filehash
- drupal:basic_auth
- context:context_ui
- drupal:action
- eva:eva
- drupal:taxonomy - drupal:taxonomy
- drupal:text
- drupal:views_ui - drupal:views_ui
- drupal:media - eva:eva
- prepopulate:prepopulate
- features:features_ui - features:features_ui
- migrate_source_csv:migrate_source_csv - file_replace:file_replace
- drupal:content_translation - filehash:filehash
- flysystem:flysystem - flysystem:flysystem
- jsonld:jsonld
- jwt:jwt
- migrate_source_csv:migrate_source_csv
- prepopulate:prepopulate
- search_api:search_api
- token:token - token:token
- file_replace:file_replace
- ctools:ctools

2
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." description: "Creates an Advanced Search block and other enhancements to search."
type: module type: module
package: Islandora package: Islandora
core_version_requirement: ^8 || ^9 core_version_requirement: ^9 || ^10
dependencies: dependencies:
- drupal:facets - drupal:facets
- drupal:facets_summary - drupal:facets_summary

2
modules/islandora_advanced_search/src/Form/AdvancedSearchForm.php

@ -71,7 +71,7 @@ class AdvancedSearchForm extends FormBase {
*/ */
public static function create(ContainerInterface $container) { public static function create(ContainerInterface $container) {
return new static( return new static(
$container->get('request_stack')->getMasterRequest(), $container->get('request_stack')->getMainRequest(),
$container->get('current_route_match') $container->get('current_route_match')
); );
} }

2
modules/islandora_advanced_search/src/Plugin/Block/AdvancedSearchBlock.php

@ -108,7 +108,7 @@ class AdvancedSearchBlock extends BlockBase implements ContainerFactoryPluginInt
$plugin_definition, $plugin_definition,
$container->get('plugin.manager.search_api.display'), $container->get('plugin.manager.search_api.display'),
$container->get('form_builder'), $container->get('form_builder'),
$container->get('request_stack')->getMasterRequest() $container->get('request_stack')->getMainRequest()
); );
} }

2
modules/islandora_advanced_search/src/Plugin/Block/SearchResultsPagerBlock.php

@ -58,7 +58,7 @@ class SearchResultsPagerBlock extends BlockBase implements ContainerFactoryPlugi
$configuration, $configuration,
$plugin_id, $plugin_id,
$plugin_definition, $plugin_definition,
$container->get('request_stack')->getMasterRequest() $container->get('request_stack')->getMainRequest()
); );
} }

3
modules/islandora_audio/islandora_audio.info.yml

@ -2,7 +2,6 @@ name: 'Islandora Audio'
description: 'Islandora audio derivative actions' description: 'Islandora audio derivative actions'
type: module type: module
package: Islandora package: Islandora
core: 8.x core_version_requirement: ^9 || ^10
core_version_requirement: ^8 || ^9
dependencies: dependencies:
- drupal:islandora - drupal:islandora

3
modules/islandora_breadcrumbs/islandora_breadcrumbs.info.yml

@ -1,8 +1,7 @@
name: 'Islandora Breadcrumbs' name: 'Islandora Breadcrumbs'
type: module type: module
description: 'Builds breadcrumbs based on field_member_of relationships.' description: 'Builds breadcrumbs based on field_member_of relationships.'
core: 8.x core_version_requirement: ^9 || ^10
core_version_requirement: ^8 || ^9
package: Islandora package: Islandora
dependencies: dependencies:
- islandora:islandora - islandora:islandora

3
modules/islandora_core_feature/islandora_core_feature.info.yml

@ -1,8 +1,7 @@
name: 'Islandora Core Feature' name: 'Islandora Core Feature'
description: 'Minimum configuration required for Islandora.' description: 'Minimum configuration required for Islandora.'
type: module type: module
core: 8.x core_version_requirement: ^9 || ^10
core_version_requirement: ^8 || ^9
dependencies: dependencies:
- drupal:basic_auth - drupal:basic_auth
- drupal:content_translation - drupal:content_translation

3
modules/islandora_iiif/islandora_iiif.info.yml

@ -1,8 +1,7 @@
name: 'Islandora IIIF' name: 'Islandora IIIF'
type: module type: module
description: 'IIIF support for Islandora' description: 'IIIF support for Islandora'
core: 8.x core_version_requirement: ^9 || ^10
core_version_requirement: ^8 || ^9
package: Islandora package: Islandora
dependencies: dependencies:
- drupal:islandora - drupal:islandora

3
modules/islandora_image/islandora_image.info.yml

@ -1,8 +1,7 @@
name: 'Islandora Image' name: 'Islandora Image'
type: module type: module
description: 'Islandora Image derivative actions' description: 'Islandora Image derivative actions'
core: 8.x core_version_requirement: ^9 || ^10
core_version_requirement: ^8 || ^9
package: Islandora package: Islandora
dependencies: dependencies:
- drupal:islandora - drupal:islandora

3
modules/islandora_text_extraction/islandora_text_extraction.info.yml

@ -1,8 +1,7 @@
name: 'Islandora Text Extraction' name: 'Islandora Text Extraction'
type: module type: module
description: 'Islandora 8 module to connect to Hypercube microservice, and to get text from PDF ingest' description: 'Islandora 8 module to connect to Hypercube microservice, and to get text from PDF ingest'
core: 8.x core_version_requirement: ^9 || ^10
core_version_requirement: ^8 || ^9
package: 'Islandora' package: 'Islandora'
dependencies: dependencies:
- drupal:islandora - drupal:islandora

3
modules/islandora_text_extraction_defaults/islandora_text_extraction_defaults.info.yml

@ -1,8 +1,7 @@
name: 'Islandora Text Extraction Defaults' name: 'Islandora Text Extraction Defaults'
type: module type: module
description: 'Default config for the Islandora Text Extraction module.' description: 'Default config for the Islandora Text Extraction module.'
core: 8.x core_version_requirement: ^9 || ^10
core_version_requirement: ^8 || ^9
package: Islandora package: Islandora
dependencies: dependencies:
- drupal:field - drupal:field

3
modules/islandora_video/islandora_video.info.yml

@ -2,7 +2,6 @@ name: 'Islandora Video'
description: 'Islandora video derivative actions' description: 'Islandora video derivative actions'
type: module type: module
package: Islandora package: Islandora
core: 8.x core_version_requirement: ^9 || ^10
core_version_requirement: ^8 || ^9
dependencies: dependencies:
- drupal:islandora - drupal:islandora

1
src/EventGenerator/EventGenerator.php

@ -192,6 +192,7 @@ class EventGenerator implements EventGeneratorInterface {
protected function getRevisionIds(Media $media, EntityStorageInterface $media_storage) { protected function getRevisionIds(Media $media, EntityStorageInterface $media_storage) {
$result = $media_storage->getQuery() $result = $media_storage->getQuery()
->allRevisions() ->allRevisions()
->accessCheck(TRUE)
->condition($media->getEntityType()->getKey('id'), $media->id()) ->condition($media->getEntityType()->getKey('id'), $media->id())
->sort($media->getEntityType()->getKey('revision'), 'DESC') ->sort($media->getEntityType()->getKey('revision'), 'DESC')
->execute(); ->execute();

16
src/Flysystem/Adapter/FedoraAdapter.php

@ -3,7 +3,6 @@
namespace Drupal\islandora\Flysystem\Adapter; namespace Drupal\islandora\Flysystem\Adapter;
use GuzzleHttp\Psr7\Header; use GuzzleHttp\Psr7\Header;
use function GuzzleHttp\Psr7\parse_header;
use Drupal\Core\Logger\LoggerChannelInterface; use Drupal\Core\Logger\LoggerChannelInterface;
use Islandora\Chullo\IFedoraApi; use Islandora\Chullo\IFedoraApi;
use League\Flysystem\AdapterInterface; use League\Flysystem\AdapterInterface;
@ -160,14 +159,8 @@ class FedoraAdapter implements AdapterInterface {
// NonRDFSource's are considered files. Everything else is a // NonRDFSource's are considered files. Everything else is a
// directory. // directory.
$type = 'dir'; $type = 'dir';
// phpcs:disable
if (class_exists(Header::class)) {
$links = Header::parse($response->getHeader('Link')); $links = Header::parse($response->getHeader('Link'));
}
else {
$links = parse_header($response->getHeader('Link'));
}
// phpcs:enable
foreach ($links as $link) { foreach ($links as $link) {
if ($link['rel'] == 'type' && $link[0] == '<http://www.w3.org/ns/ldp#NonRDFSource>') { if ($link['rel'] == 'type' && $link[0] == '<http://www.w3.org/ns/ldp#NonRDFSource>') {
$type = 'file'; $type = 'file';
@ -403,14 +396,7 @@ class FedoraAdapter implements AdapterInterface {
$return = NULL; $return = NULL;
if ($response->getStatusCode() == 410) { if ($response->getStatusCode() == 410) {
$return = FALSE; $return = FALSE;
// phpcs:disable
if (class_exists(Header::class)) {
$link_headers = Header::parse($response->getHeader('Link')); $link_headers = Header::parse($response->getHeader('Link'));
}
else {
$link_headers = parse_header($response->getHeader('Link'));
}
// phpcs:enable
if ($link_headers) { if ($link_headers) {
$tombstones = array_filter($link_headers, function ($o) { $tombstones = array_filter($link_headers, function ($o) {
return (isset($o['rel']) && $o['rel'] == 'hasTombstone'); return (isset($o['rel']) && $o['rel'] == 'hasTombstone');

6
src/Form/ConfirmDeleteMediaAndFile.php

@ -128,6 +128,9 @@ class ConfirmDeleteMediaAndFile extends DeleteMultipleForm {
// Check for files. // Check for files.
$fields = $this->entityFieldManager->getFieldDefinitions('media', $entity->bundle()); $fields = $this->entityFieldManager->getFieldDefinitions('media', $entity->bundle());
foreach ($fields as $field) { foreach ($fields as $field) {
if ($field->getName() == 'thumbnail') {
continue;
}
$type = $field->getType(); $type = $field->getType();
if ($type == 'file' || $type == 'image') { if ($type == 'file' || $type == 'image') {
$target_id = $entity->get($field->getName())->target_id; $target_id = $entity->get($field->getName())->target_id;
@ -137,9 +140,12 @@ class ConfirmDeleteMediaAndFile extends DeleteMultipleForm {
$inaccessible_entities[] = $file; $inaccessible_entities[] = $file;
continue; continue;
} }
if (!array_key_exists($file->id(), $delete_files)) {
$delete_files[$file->id()] = $file; $delete_files[$file->id()] = $file;
$total_count++; $total_count++;
} }
}
} }
} }

1
src/Plugin/Condition/NodeReferencedByNode.php

@ -128,6 +128,7 @@ class NodeReferencedByNode extends ConditionPluginBase implements ContainerFacto
$config = FieldStorageConfig::loadByName('node', $reference_field); $config = FieldStorageConfig::loadByName('node', $reference_field);
if ($config) { if ($config) {
$id_count = \Drupal::entityQuery('node') $id_count = \Drupal::entityQuery('node')
->accessCheck(TRUE)
->condition($reference_field, $entity->id()) ->condition($reference_field, $entity->id())
->count() ->count()
->execute(); ->execute();

2
tests/modules/integer_weight_test_views/integer_weight_test_views.info.yml

@ -2,7 +2,7 @@ name: 'Integer weight test views'
type: module type: module
description: 'Provides default views for integer weight views tests.' description: 'Provides default views for integer weight views tests.'
package: Testing package: Testing
core_version_requirement: ^8 || ^9 core_version_requirement: ^8 || ^9 || ^10
dependencies: dependencies:
- drupal:node - drupal:node
- drupal:views - drupal:views

9
tests/src/Functional/DeleteMediaTest.php

@ -50,8 +50,15 @@ class DeleteMediaTest extends IslandoraFunctionalTestBase {
public function setUp(): void { public function setUp(): void {
parent::setUp(); parent::setUp();
if (version_compare(\Drupal::VERSION, '10.1', '>=')) {
$permissions = ['create media', 'delete any media', 'delete any file'];
}
else {
$permissions = ['create media', 'delete any media'];
}
// Create a test user. // 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); list($this->file, $this->media) = $this->makeMediaAndFile($this->account);
} }

12
tests/src/Kernel/FedoraAdapterTest.php

@ -4,7 +4,6 @@ namespace Drupal\Tests\islandora\Kernel;
use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\PhpUnit\ProphecyTrait;
use GuzzleHttp\Psr7\Utils; use GuzzleHttp\Psr7\Utils;
use function GuzzleHttp\Psr7\stream_for;
use Drupal\Core\Logger\LoggerChannelInterface; use Drupal\Core\Logger\LoggerChannelInterface;
use Drupal\islandora\Flysystem\Adapter\FedoraAdapter; use Drupal\islandora\Flysystem\Adapter\FedoraAdapter;
use GuzzleHttp\Psr7\Response; use GuzzleHttp\Psr7\Response;
@ -61,13 +60,8 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
]); ]);
$prophecy->getHeader('Content-Type')->willReturn(['text/plain']); $prophecy->getHeader('Content-Type')->willReturn(['text/plain']);
$prophecy->getHeader('Content-Length')->willReturn([strlen("DERP")]); $prophecy->getHeader('Content-Length')->willReturn([strlen("DERP")]);
// phpcs:disable
if (class_exists(Utils::class)) {
$prophecy->getBody()->willReturn(Utils::streamFor("DERP")); $prophecy->getBody()->willReturn(Utils::streamFor("DERP"));
} else {
$prophecy->getBody()->willReturn(stream_for("DERP"));
}
// phpcs:enable
return $prophecy; return $prophecy;
} }
@ -241,7 +235,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
$head_prophecy = $this->prophesize(Response::class); $head_prophecy = $this->prophesize(Response::class);
$head_prophecy->getStatusCode()->willReturn(410); $head_prophecy->getStatusCode()->willReturn(410);
$head_prophecy->getHeader('Link') $head_prophecy->getHeader('Link')
->willReturn('<some-path-to-a-tombstone>; rel="hasTombstone"'); ->willReturn(['<some-path-to-a-tombstone>; rel="hasTombstone"']);
$tombstone_prophecy = $this->prophesize(Response::class); $tombstone_prophecy = $this->prophesize(Response::class);
$tombstone_prophecy->getStatusCode()->willReturn(204); $tombstone_prophecy->getStatusCode()->willReturn(204);
@ -269,7 +263,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
$head_prophecy = $this->prophesize(Response::class); $head_prophecy = $this->prophesize(Response::class);
$head_prophecy->getStatusCode()->willReturn(410); $head_prophecy->getStatusCode()->willReturn(410);
$head_prophecy->getHeader('Link') $head_prophecy->getHeader('Link')
->willReturn('<some-path-to-a-tombstone>; rel="hasTombstone"'); ->willReturn(['<some-path-to-a-tombstone>; rel="hasTombstone"']);
$tombstone_prophecy = $this->prophesize(Response::class); $tombstone_prophecy = $this->prophesize(Response::class);
$tombstone_prophecy->getStatusCode()->willReturn(500); $tombstone_prophecy->getStatusCode()->willReturn(500);

3
tests/src/Kernel/FedoraPluginTest.php

@ -6,6 +6,7 @@ use Drupal\Core\Logger\LoggerChannelInterface;
use Drupal\islandora\Flysystem\Fedora; use Drupal\islandora\Flysystem\Fedora;
use Islandora\Chullo\IFedoraApi; use Islandora\Chullo\IFedoraApi;
use League\Flysystem\AdapterInterface; use League\Flysystem\AdapterInterface;
use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Symfony\Component\Mime\MimeTypeGuesserInterface; use Symfony\Component\Mime\MimeTypeGuesserInterface;
@ -17,6 +18,8 @@ use Symfony\Component\Mime\MimeTypeGuesserInterface;
*/ */
class FedoraPluginTest extends IslandoraKernelTestBase { class FedoraPluginTest extends IslandoraKernelTestBase {
use ProphecyTrait;
/** /**
* Mocks up a plugin. * Mocks up a plugin.
*/ */

Loading…
Cancel
Save