Skip to content

Commit

Permalink
multifile media d9 fixes (#820)
Browse files Browse the repository at this point in the history
* multifile media d9 fixes

* phpcs fixes
  • Loading branch information
elizoller authored Jan 13, 2021
1 parent 76fea69 commit 5e3233f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/MediaSource/MediaSourceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ public function putToMedia(
}

$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");
}

Expand Down
17 changes: 15 additions & 2 deletions src/Plugin/Action/AbstractGenerateDerivativeBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -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,
Expand All @@ -98,13 +108,15 @@ public function __construct(
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,
Expand Down Expand Up @@ -135,7 +147,8 @@ public static function create(ContainerInterface $container, array $configuratio
$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')
);
}

Expand Down

0 comments on commit 5e3233f

Please sign in to comment.