Browse Source

Merge branch '8.x-1.x' of https://github.com/Islandora/islandora into no-gemini

pull/822/head
dannylamb 5 years ago
parent
commit
3c03101b05
  1. 115
      .github/workflows/build-8.x-1.x.yml
  2. 53
      .travis.yml
  3. 20
      islandora.install
  4. 3
      modules/islandora_core_feature/config/install/migrate_plus.migration.islandora_tags.yml
  5. 2
      src/MediaSource/MediaSourceService.php
  6. 17
      src/Plugin/Action/AbstractGenerateDerivativeBase.php
  7. 5
      src/Plugin/Condition/NodeHasTerm.php

115
.github/workflows/build-8.x-1.x.yml

@ -0,0 +1,115 @@
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the 7.x branch
push:
branches: [ 8.x-1.x ]
pull_request:
branches: [ 8.x-1.x ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ["7.3", "7.4"]
test-suite: ["kernel", "functional", "functional-javascript"]
drupal-version: ["8.9.11", "9.1.1"]
name: PHP ${{ matrix.php-versions }} drupal ${{ matrix.drupal-version }} test-suite ${{ matrix.test-suite }}
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: drupal
ports:
- 3306:3306
activemq:
image: webcenter/activemq:5.14.3
ports:
- 8161:8161
- 61616:61616
- 61613:61613
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v2
with:
path: build_dir
- name: Checkout islandora_ci
uses: actions/checkout@v2
with:
repository: islandora/islandora_ci
ref: github-actions
path: islandora_ci
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: composer:v2
- name: Setup Mysql client
run: |
sudo apt-get update
sudo apt-get install -y mysql-client
- name: Set environment variables
run: |
echo "DRUPAL_VERSION=${{ matrix.drupal-version }}" >> $GITHUB_ENV
echo "SCRIPT_DIR=$GITHUB_WORKSPACE/islandora_ci" >> $GITHUB_ENV
echo "DRUPAL_DIR=/opt/drupal" >> $GITHUB_ENV
echo "PHPUNIT_FILE=$GITHUB_WORKSPACE/build_dir/phpunit.xml" >> $GITHUB_ENV
- name: Cache Composer dependencies
uses: actions/cache@v2
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
- name: Setup Drupal
run: |
mkdir $DRUPAL_DIR
$SCRIPT_DIR/travis_setup_drupal.sh
cd $DRUPAL_DIR
chmod -R u+w web/sites/default
mkdir -p web/sites/simpletest/browser_output
- name: Setup composer paths
run: |
git -C "$GITHUB_WORKSPACE/build_dir" checkout -b travis-testing
cd $DRUPAL_DIR
composer config repositories.local path "$GITHUB_WORKSPACE/build_dir"
composer require "islandora/islandora:dev-travis-testing as dev-8.x-1.x" --prefer-source --update-with-all-dependencies
- name: Install modules
run: |
cd $DRUPAL_DIR/web
drush --uri=127.0.0.1:8282 en -y islandora_audio islandora_breadcrumbs islandora_iiif islandora_image islandora_video islandora_text_extraction_defaults
drush --uri=127.0.0.1:8282 fim -y islandora_core_feature,islandora_text_extraction_defaults
- name: Copy PHPunit file
run: cp $PHPUNIT_FILE $DRUPAL_DIR/web/core/phpunit.xml
- name: Test scripts
run: $SCRIPT_DIR/travis_scripts.sh
- name: PHPUNIT tests
run: |
cd $DRUPAL_DIR/web/core
$DRUPAL_DIR/vendor/bin/phpunit --verbose --testsuite "${{ matrix.test-suite }}"

53
.travis.yml

@ -1,53 +0,0 @@
sudo: true
language: php
php:
- 7.3
- 7.4
env:
- TESTSUITE=kernel
- TESTSUITE=functional
- TESTSUITE=functional-javascript
matrix:
fast_finish: true
services:
- mysql
branches:
only:
- /^8.x/
- /master/
before_install:
- export SCRIPT_DIR=$HOME/islandora_ci
- export DRUPAL_DIR=/opt/drupal
- export PHPUNIT_FILE=$TRAVIS_BUILD_DIR/phpunit.xml
- export COMPOSER_PATH="/home/travis/.phpenv/versions/$TRAVIS_PHP_VERSION/bin/composer"
- phpenv config-rm xdebug.ini
install:
- git clone https://github.com/Islandora/islandora_ci.git $HOME/islandora_ci
- $SCRIPT_DIR/travis_setup_drupal.sh
- git -C "$TRAVIS_BUILD_DIR" checkout -b travis-testing
- cd $DRUPAL_DIR;
- chmod -R u+w web/sites/default
- COMPOSER_MEMORY_LIMIT=-1 php -d memory_limit=-1 $COMPOSER_PATH config repositories.local path "$TRAVIS_BUILD_DIR"
- COMPOSER_MEMORY_LIMIT=-1 php -d memory_limit=-1 $COMPOSER_PATH require "islandora/islandora:dev-travis-testing as dev-8.x-1.x" --prefer-source --update-with-all-dependencies
- cd web
- drush --uri=127.0.0.1:8282 en -y islandora_audio islandora_breadcrumbs islandora_iiif islandora_image islandora_video islandora_text_extraction_defaults
- drush --uri=127.0.0.1:8282 fim -y islandora_core_feature,islandora_text_extraction_defaults
- mkdir -p $DRUPAL_DIR/web/sites/simpletest/browser_output
- cp $PHPUNIT_FILE $DRUPAL_DIR/web/core/phpunit.xml
script:
- $SCRIPT_DIR/travis_scripts.sh
- cd $DRUPAL_DIR/web/core
- $DRUPAL_DIR/vendor/bin/phpunit --verbose --testsuite "$TESTSUITE"
notifications:
slack:
on_success: change
on_failure: always
secure: $SLACK_NOTIFICATION_KEY

20
islandora.install

@ -70,3 +70,23 @@ function islandora_update_8004() {
} }
} }
} }
/**
* Makes migrate_tags an array.
*/
function islandora_update_8005() {
$config_factory = \Drupal::configFactory();
$config_factory->getEditable('migrate_plus.migration.islandora__tags')->delete();
$config = $config_factory->getEditable('migrate_plus.migration.islandora_tags');
if ($config) {
if (!is_array($config->get('migration_tags'))) {
$config->set('migration_tags', [$config->get('migration_tags')]);
$config->save(TRUE);
}
if (!$config->get('source.ids')) {
$config->set('source.ids', $config->get('source.keys'));
$config->clear('source.keys');
$config->save(TRUE);
}
}
}

3
modules/islandora_core_feature/config/install/migrate_plus.migration.islandora_tags.yml

@ -8,7 +8,8 @@ id: islandora_tags
class: null class: null
field_plugin_method: null field_plugin_method: null
cck_plugin_method: null cck_plugin_method: null
migration_tags: islandora_tags migration_tags:
- islandora_tags
migration_group: islandora migration_group: islandora
label: 'Tags migration from CSV' label: 'Tags migration from CSV'
source: source:

2
src/MediaSource/MediaSourceService.php

@ -363,7 +363,7 @@ class MediaSourceService {
} }
$directory = $this->fileSystem->dirname($content_location); $directory = $this->fileSystem->dirname($content_location);
if (!file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) { if (!$this->fileSystem->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS)) {
throw new HttpException(500, "The destination directory does not exist, could not be created, or is not writable"); throw new HttpException(500, "The destination directory does not exist, could not be created, or is not writable");
} }

17
src/Plugin/Action/AbstractGenerateDerivativeBase.php

@ -3,6 +3,7 @@
namespace Drupal\islandora\Plugin\Action; namespace Drupal\islandora\Plugin\Action;
use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityFieldManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Messenger\MessengerInterface;
use Drupal\Core\Session\AccountInterface; use Drupal\Core\Session\AccountInterface;
@ -55,6 +56,13 @@ class AbstractGenerateDerivativeBase extends EmitEvent {
*/ */
protected $config; protected $config;
/**
* The entity field manager.
*
* @var \Drupal\Core\Entity\EntityFieldManager
*/
protected $entityFieldManager;
/** /**
* Constructs a EmitEvent action. * Constructs a EmitEvent action.
* *
@ -84,6 +92,8 @@ class AbstractGenerateDerivativeBase extends EmitEvent {
* The messenger. * The messenger.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config * @param \Drupal\Core\Config\ConfigFactoryInterface $config
* The system file config. * The system file config.
* @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager
* Field Manager service.
*/ */
public function __construct( public function __construct(
array $configuration, array $configuration,
@ -98,13 +108,15 @@ class AbstractGenerateDerivativeBase extends EmitEvent {
MediaSourceService $media_source, MediaSourceService $media_source,
TokenInterface $token, TokenInterface $token,
MessengerInterface $messenger, MessengerInterface $messenger,
ConfigFactoryInterface $config ConfigFactoryInterface $config,
EntityFieldManagerInterface $entity_field_manager
) { ) {
$this->utils = $utils; $this->utils = $utils;
$this->mediaSource = $media_source; $this->mediaSource = $media_source;
$this->token = $token; $this->token = $token;
$this->messenger = $messenger; $this->messenger = $messenger;
$this->config = $config->get('system.file'); $this->config = $config->get('system.file');
$this->entityFieldManager = $entity_field_manager;
parent::__construct( parent::__construct(
$configuration, $configuration,
$plugin_id, $plugin_id,
@ -135,7 +147,8 @@ class AbstractGenerateDerivativeBase extends EmitEvent {
$container->get('islandora.media_source_service'), $container->get('islandora.media_source_service'),
$container->get('token'), $container->get('token'),
$container->get('messenger'), $container->get('messenger'),
$container->get('config.factory') $container->get('config.factory'),
$container->get('entity_field.manager')
); );
} }

5
src/Plugin/Condition/NodeHasTerm.php

@ -84,7 +84,10 @@ class NodeHasTerm extends ConditionPluginBase implements ContainerFactoryPluginI
*/ */
public function defaultConfiguration() { public function defaultConfiguration() {
return array_merge( return array_merge(
['logic' => 'and'], [
'logic' => 'and',
'uri' => NULL,
],
parent::defaultConfiguration() parent::defaultConfiguration()
); );
} }

Loading…
Cancel
Save