|
|
@ -3,6 +3,7 @@ |
|
|
|
namespace Drupal\islandora\Flysystem; |
|
|
|
namespace Drupal\islandora\Flysystem; |
|
|
|
|
|
|
|
|
|
|
|
use Drupal\Core\Language\LanguageManagerInterface; |
|
|
|
use Drupal\Core\Language\LanguageManagerInterface; |
|
|
|
|
|
|
|
use Drupal\Core\Logger\LoggerChannelInterface; |
|
|
|
use Drupal\Core\Logger\RfcLogLevel; |
|
|
|
use Drupal\Core\Logger\RfcLogLevel; |
|
|
|
use Drupal\Core\Plugin\ContainerFactoryPluginInterface; |
|
|
|
use Drupal\Core\Plugin\ContainerFactoryPluginInterface; |
|
|
|
use Drupal\Core\Url; |
|
|
|
use Drupal\Core\Url; |
|
|
@ -17,7 +18,7 @@ use Islandora\Chullo\IFedoraApi; |
|
|
|
use Islandora\Chullo\FedoraApi; |
|
|
|
use Islandora\Chullo\FedoraApi; |
|
|
|
use Psr\Http\Message\RequestInterface; |
|
|
|
use Psr\Http\Message\RequestInterface; |
|
|
|
use Symfony\Component\DependencyInjection\ContainerInterface; |
|
|
|
use Symfony\Component\DependencyInjection\ContainerInterface; |
|
|
|
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface; |
|
|
|
use Symfony\Component\Mime\MimeTypeGuesserInterface; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Drupal plugin for the Fedora Flysystem adapter. |
|
|
|
* Drupal plugin for the Fedora Flysystem adapter. |
|
|
@ -38,7 +39,7 @@ class Fedora implements FlysystemPluginInterface, ContainerFactoryPluginInterfac |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Mimetype guesser. |
|
|
|
* Mimetype guesser. |
|
|
|
* |
|
|
|
* |
|
|
|
* @var \Symfony\Component\HttpFoundation\File\Mimetype\MimeTypeGuesserInterface |
|
|
|
* @var \Symfony\Component\Mime\MimeTypeGuesserInterface |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected $mimeTypeGuesser; |
|
|
|
protected $mimeTypeGuesser; |
|
|
|
|
|
|
|
|
|
|
@ -49,24 +50,34 @@ class Fedora implements FlysystemPluginInterface, ContainerFactoryPluginInterfac |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected $languageManager; |
|
|
|
protected $languageManager; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Logger. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @var \Drupal\Core\Logger\LoggerChannelInterface |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
protected $logger; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Constructs a Fedora plugin for Flysystem. |
|
|
|
* Constructs a Fedora plugin for Flysystem. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param \Islandora\Chullo\IFedoraApi $fedora |
|
|
|
* @param \Islandora\Chullo\IFedoraApi $fedora |
|
|
|
* Fedora client. |
|
|
|
* Fedora client. |
|
|
|
* @param \Symfony\Component\HttpFoundation\File\Mimetype\MimeTypeGuesserInterface $mime_type_guesser |
|
|
|
* @param \Symfony\Component\Mime\MimeTypeGuesserInterface $mime_type_guesser |
|
|
|
* Mimetype guesser. |
|
|
|
* Mimetype guesser. |
|
|
|
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager |
|
|
|
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager |
|
|
|
* Language manager. |
|
|
|
* Language manager. |
|
|
|
|
|
|
|
* @param \Drupal\Core\Logger\LoggerChannelInterface $logger |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function __construct( |
|
|
|
public function __construct( |
|
|
|
IFedoraApi $fedora, |
|
|
|
IFedoraApi $fedora, |
|
|
|
MimeTypeGuesserInterface $mime_type_guesser, |
|
|
|
MimeTypeGuesserInterface $mime_type_guesser, |
|
|
|
LanguageManagerInterface $language_manager |
|
|
|
LanguageManagerInterface $language_manager, |
|
|
|
|
|
|
|
LoggerChannelInterface $logger |
|
|
|
) { |
|
|
|
) { |
|
|
|
$this->fedora = $fedora; |
|
|
|
$this->fedora = $fedora; |
|
|
|
$this->mimeTypeGuesser = $mime_type_guesser; |
|
|
|
$this->mimeTypeGuesser = $mime_type_guesser; |
|
|
|
$this->languageManager = $language_manager; |
|
|
|
$this->languageManager = $language_manager; |
|
|
|
|
|
|
|
$this->logger = $logger; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -87,7 +98,8 @@ class Fedora implements FlysystemPluginInterface, ContainerFactoryPluginInterfac |
|
|
|
return new static( |
|
|
|
return new static( |
|
|
|
$fedora, |
|
|
|
$fedora, |
|
|
|
$container->get('file.mime_type.guesser'), |
|
|
|
$container->get('file.mime_type.guesser'), |
|
|
|
$container->get('language_manager') |
|
|
|
$container->get('language_manager'), |
|
|
|
|
|
|
|
$container->get('logger.channel.fedora_flysystem') |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -116,7 +128,7 @@ class Fedora implements FlysystemPluginInterface, ContainerFactoryPluginInterfac |
|
|
|
* {@inheritdoc} |
|
|
|
* {@inheritdoc} |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function getAdapter() { |
|
|
|
public function getAdapter() { |
|
|
|
return new FedoraAdapter($this->fedora, $this->mimeTypeGuesser); |
|
|
|
return new FedoraAdapter($this->fedora, $this->mimeTypeGuesser, $this->logger); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|