Skip to content

Commit

Permalink
D9 islandora (#809)
Browse files Browse the repository at this point in the history
* update messenger for d9

* fix dependency injection

* update info files

* stream_for updates for d9

* remove deprecated entity query

* replace deprecated functions

* use dependency injection for messenger and fix other deprecated functions for d9

* fix deprecations in tests

* fix test

* phpcs fixes

* fix toUrl method

* properly use StringTranslationTrait

* phpcs fixes and using dependency injection

* more deprecations with upgrade_status 3.x version and more phpcs fixes

* add defaultTheme per https://www.drupal.org/node/3083055

* replace deprecated context definition method - per https://www.drupal.org/node/2976400

* fix context definitions

* remove more deprecations

* fix deprecations in tests

* codesniffer fixes - dependencies must be prefixed with drupal: and missing variable doc comments

* replace more url() -> toUrl() and remove unused variables

* more code sniffer fixes

* some of these urls are necessary as strings

* d9 requires update to flysystem module

* update migrate_source_csv

* temporarily point crayfish-commons to branch with d9 dependencies

* another composer dependency adjustment

* point composer to d9 branch of jsonld

* remove hook_post_action for d9

* remove hook_post_action as a dependency - this does break multifile media FOR NOW

* update migration keys -> ids per https://www.drupal.org/node/3060246

* fix url method

* point jsonld back to dev since PR has been merged

* wrong branch name

* add update hook for change in migration source

* update travis.yml for php 7.4

* add doc comment

* build on php7.2, 7.3, 7.4

* use this instead of Drupal::

* just php 7.3 and 7.4

* swap back to dev-dev crayfish-commons since PR was merged

* perhaps this fixes the config thing

* trying to fix config

* ugh errant semicolon

* missing variable name

* maybe it would help if i named the variables consistently

* please work...

* i can't get the dependency injection of config correct

* sad panda

* thanks @seth-shaw-unlv for this magical fix

* fix dependency injection

* putting the config in the AbstractGenerateDerivativeMediaFile class instead

* already the system.file config

* update test module info file

* fix implode ordre of parameters

* remove unused use statement

* fix geminiclient tests

* phpcs fix

* check for fedora key in flysystem

* check for array not being null

* more null checks

* try on the downgrade-symfony branch

* set fedora url to null if it isn't in the settings

* testing the crayfish-commons version fix

* fixes for new classes in newer version of guzzlehttp but still needing to support old methods

* update phpunit.xml?

* transform 1 response from preg_match to a boolean

* reorder crayfish-commons version fix

* code sniffer fixes

* abstract awaying the shared constructor so that phpcpd is happy about less duplicated code

* attempt to reduce shared code in the FedoraAdapterTest

* remove unused use statement

* code sniffer fixes...not sure how i missed these...

* remove reliance on branch of crayfish-commons since PR has been merged
  • Loading branch information
elizoller authored Dec 18, 2020
1 parent 792b3d3 commit 7f0d54e
Show file tree
Hide file tree
Showing 82 changed files with 716 additions and 628 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
sudo: true
language: php
php:
- 7.2
- 7.3
- 7.4

env:
- TESTSUITE=kernel
Expand All @@ -11,8 +11,6 @@ env:

matrix:
fast_finish: true
allow_failures:
- php: 7.3

services:
- mysql
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
],
"require": {
"drupal/context": "^4.0",
"drupal/context": "^4.0@beta",
"drupal/search_api": "~1.8",
"islandora/jsonld": "dev-8.x-1.x",
"stomp-php/stomp-php": "4.*",
Expand All @@ -25,9 +25,9 @@
"drupal/features" : "^3.7",
"drupal/migrate_plus" : "^5.1",
"drupal/migrate_tools" : "^5.0",
"drupal/migrate_source_csv" : "^2.1",
"drupal/migrate_source_csv" : "^3.4",
"drupal/token" : "^1.3",
"drupal/flysystem" : "^1.0",
"drupal/flysystem" : "^2.0@alpha",
"islandora/crayfish-commons": "dev-dev",
"drupal/file_replace": "^1.1"

Expand Down
1 change: 1 addition & 0 deletions drush.services.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
services:
islandora.commands:
class: \Drupal\islandora\Commands\IslandoraCommands
arguments: ['@entity_type.manager', '@current_user', '@account_switcher']
tags:
- { name: drush.command }
53 changes: 27 additions & 26 deletions islandora.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,31 @@ description: "Islandora Core"
type: module
package: Islandora
core: 8.x
core_version_requirement: ^8 || ^9
dependencies:
- block
- node
- path
- text
- options
- link
- jsonld
- search_api
- jwt
- rest
- filehash
- basic_auth
- context_ui
- action
- eva
- taxonomy
- views_ui
- media
- prepopulate
- features_ui
- migrate_tools
- migrate_source_csv
- content_translation
- flysystem
- token
- file_replace
- drupal:block
- drupal:node
- drupal:path
- drupal:text
- drupal:options
- drupal:link
- drupal:jsonld
- drupal:search_api
- drupal:jwt
- drupal:rest
- drupal:filehash
- drupal:basic_auth
- drupal:context_ui
- drupal:action
- drupal:eva
- drupal:taxonomy
- drupal:views_ui
- drupal:media
- drupal:prepopulate
- drupal:features_ui
- drupal:migrate_tools
- drupal:migrate_source_csv
- drupal:content_translation
- drupal:flysystem
- drupal:token
- drupal:file_replace
15 changes: 15 additions & 0 deletions islandora.install
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,18 @@ function islandora_update_8003(&$sandbox) {
->schema()
->dropTable('islandora_version_count');
}

/**
* Renames migration source keys -> ids.
*/
function islandora_update_8004() {
$config_factory = \Drupal::configFactory();
$config = $config_factory->getEditable('migrate_plus.migration.islandora__tags');
if ($config) {
if (!$config->get('source.ids')) {
$config->set('source.ids', $config->get('source.keys'));
$config->clear('source.keys');
$config->save(TRUE);
}
}
}
2 changes: 1 addition & 1 deletion islandora.module
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ function islandora_file_insert(FileInterface $file) {
*/
function islandora_file_update(FileInterface $file) {
// Exit early if unchanged.
if ($file->filehash['sha1'] == $file->original->filehash['sha1']) {
if ($file->filehash != NULL && $file->original->filehash != NULL && $file->filehash['sha1'] == $file->original->filehash['sha1']) {
return;
}

Expand Down
2 changes: 0 additions & 2 deletions islandora.routing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,3 @@ islandora.confirm_delete_media_and_file:
_form: 'Drupal\islandora\Form\ConfirmDeleteMediaAndFile'
requirements:
_permission: 'administer media+delete any media'


4 changes: 2 additions & 2 deletions islandora.services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ services:
- { name: 'context_provider' }
islandora.media_source_service:
class: Drupal\islandora\MediaSource\MediaSourceService
arguments: ['@entity_type.manager', '@current_user', '@language_manager', '@entity.query', '@file_system', '@islandora.utils']
arguments: ['@entity_type.manager', '@current_user', '@language_manager', '@file_system', '@islandora.utils']
islandora.utils:
class: Drupal\islandora\IslandoraUtils
arguments: ['@entity_type.manager', '@entity_field.manager', '@entity.query', '@context.manager', '@flysystem_factory', '@language_manager']
arguments: ['@entity_type.manager', '@entity_field.manager', '@context.manager', '@flysystem_factory', '@language_manager']
islandora.gemini.client:
class: Islandora\Crayfish\Commons\Client\GeminiClient
factory: ['Drupal\islandora\GeminiClientFactory', create]
Expand Down
3 changes: 2 additions & 1 deletion modules/islandora_audio/islandora_audio.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ description: 'Islandora audio derivative actions'
type: module
package: Islandora
core: 8.x
core_version_requirement: ^8 || ^9
dependencies:
- islandora
- drupal:islandora
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public function defaultConfiguration() {
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
$form['mimetype']['#description'] = t('Mimetype to convert to (e.g. audio/mpeg, audio/m4a, etc...)');
$form['args']['#description'] = t('Additional command line parameters for FFMpeg');
$form['mimetype']['#description'] = $this->t('Mimetype to convert to (e.g. audio/mpeg, audio/m4a, etc...)');
$form['args']['#description'] = $this->t('Additional command line parameters for FFMpeg');
return $form;
}

Expand All @@ -48,7 +48,7 @@ public function validateConfigurationForm(array &$form, FormStateInterface $form
if ($exploded_mime[0] != 'audio') {
$form_state->setErrorByName(
'mimetype',
t('Please enter a audio mimetype (e.g. audio/mpeg, audio/m4a, etc...)')
$this->t('Please enter a audio mimetype (e.g. audio/mpeg, audio/m4a, etc...)')
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function testGenerateAudioDerivativeFromScratch() {
// Create an action to generate a audio derivative.
$this->drupalGet('admin/config/system/actions');
$this->getSession()->getPage()->findById("edit-action")->selectOption("Generate a audio derivative");
$this->getSession()->getPage()->pressButton(t('Create'));
$this->getSession()->getPage()->pressButton($this->t('Create'));
$this->assertSession()->statusCodeEquals(200);

$this->getSession()->getPage()->fillField('edit-label', "Generate audio test derivative");
Expand All @@ -53,7 +53,7 @@ public function testGenerateAudioDerivativeFromScratch() {
$this->getSession()->getPage()->fillField('edit-args', "-f mp3");
$this->getSession()->getPage()->fillField('edit-scheme', "public");
$this->getSession()->getPage()->fillField('edit-path', "derp.mov");
$this->getSession()->getPage()->pressButton(t('Save'));
$this->getSession()->getPage()->pressButton($this->t('Save'));
$this->assertSession()->statusCodeEquals(200);

// Create a context and add the action as a derivative reaction.
Expand All @@ -68,7 +68,7 @@ public function testGenerateAudioDerivativeFromScratch() {
'field_media_of[0][target_id]' => 'Test Node',
'field_tags[0][target_id]' => 'Preservation Master',
];
$this->drupalPostForm('media/add/' . $this->testMediaType->id(), $values, t('Save'));
$this->drupalPostForm('media/add/' . $this->testMediaType->id(), $values, $this->t('Save'));

$expected = [
'source_uri' => 'test_file.txt',
Expand Down
3 changes: 2 additions & 1 deletion modules/islandora_breadcrumbs/islandora_breadcrumbs.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: 'Islandora Breadcrumbs'
type: module
description: 'Builds breadcrumbs based on field_member_of relationships.'
core: 8.x
core_version_requirement: ^8 || ^9
package: Islandora
dependencies:
- islandora
- drupal:islandora
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ source:
plugin: csv
path: modules/contrib/islandora/migrate/tags.csv
header_row_count: 1
keys:
ids:
- external_uri
process:
name: name
Expand Down
45 changes: 23 additions & 22 deletions modules/islandora_core_feature/islandora_core_feature.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@ name: 'Islandora Core Feature'
description: 'Minimum configuration required for Islandora.'
type: module
core: 8.x
core_version_requirement: ^8 || ^9
dependencies:
- basic_auth
- content_translation
- eva
- features
- field
- file
- filehash
- image
- islandora
- jsonld
- jwt
- language
- link
- media
- migrate_plus
- node
- rest
- serialization
- system
- taxonomy
- user
- views
- drupal:basic_auth
- drupal:content_translation
- drupal:eva
- drupal:features
- drupal:field
- drupal:file
- drupal:filehash
- drupal:image
- drupal:islandora
- drupal:jsonld
- drupal:jwt
- drupal:language
- drupal:link
- drupal:media
- drupal:migrate_plus
- drupal:node
- drupal:rest
- drupal:serialization
- drupal:system
- drupal:taxonomy
- drupal:user
- drupal:views
package: Islandora
3 changes: 2 additions & 1 deletion modules/islandora_iiif/islandora_iiif.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: 'Islandora IIIF'
type: module
description: 'IIIF support for Islandora'
core: 8.x
core_version_requirement: ^8 || ^9
package: Islandora
dependencies:
- islandora
- drupal:islandora
36 changes: 34 additions & 2 deletions modules/islandora_iiif/src/Form/IslandoraIIIFConfigForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,49 @@

namespace Drupal\islandora_iiif\Form;

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Component\Utility\UrlHelper;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ClientException;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* Form to configure IslandoraIIIF.
*/
class IslandoraIIIFConfigForm extends ConfigFormBase {

/**
* The HTTP client to fetch the files with.
*
* @var \GuzzleHttp\ClientInterface
*/
protected $httpClient;

/**
* IslandoraIIIFConfigForm constructor.
*
* @param \GuzzleHttp\ClientInterface $http_client
* A Guzzle client object.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory service.
*/
public function __construct(ClientInterface $http_client, ConfigFactoryInterface $config_factory) {
parent::__construct($config_factory);
$this->httpClient = $http_client;
}

/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('http_client'),
$container->get('config.factory')
);
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -78,9 +111,8 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
* True if server returns 200 on a HEAD request.
*/
private function validateIiifUrl($server_uri) {
$client = \Drupal::httpClient();
try {
$result = $client->head($server_uri);
$result = $this->httpClient->head($server_uri);
return ($result->getStatusCode() == 200);
}
catch (ClientException $e) {
Expand Down
Loading

0 comments on commit 7f0d54e

Please sign in to comment.