Browse Source

multifile media d9 fixes (#820)

* multifile media d9 fixes

* phpcs fixes
pull/828/head
Eli Zoller 4 years ago committed by GitHub
parent
commit
5e3233f914
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/MediaSource/MediaSourceService.php
  2. 17
      src/Plugin/Action/AbstractGenerateDerivativeBase.php

2
src/MediaSource/MediaSourceService.php

@ -363,7 +363,7 @@ class MediaSourceService {
}
$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");
}

17
src/Plugin/Action/AbstractGenerateDerivativeBase.php

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

Loading…
Cancel
Save