|
|
@ -7,7 +7,6 @@ use Drupal\Core\Config\ConfigFactoryInterface; |
|
|
|
use Drupal\Core\Entity\EntityInterface; |
|
|
|
use Drupal\Core\Entity\EntityInterface; |
|
|
|
use Drupal\Core\Entity\EntityTypeManagerInterface; |
|
|
|
use Drupal\Core\Entity\EntityTypeManagerInterface; |
|
|
|
use Drupal\Core\Link; |
|
|
|
use Drupal\Core\Link; |
|
|
|
use Drupal\Core\Mail\MailManagerInterface; |
|
|
|
|
|
|
|
use Drupal\Core\StringTranslation\StringTranslationTrait; |
|
|
|
use Drupal\Core\StringTranslation\StringTranslationTrait; |
|
|
|
use Drupal\Core\StringTranslation\TranslationInterface; |
|
|
|
use Drupal\Core\StringTranslation\TranslationInterface; |
|
|
|
use Drupal\dgi_fixity\Entity\FixityCheck; |
|
|
|
use Drupal\dgi_fixity\Entity\FixityCheck; |
|
|
@ -19,6 +18,7 @@ use Drupal\media\MediaInterface; |
|
|
|
use Drupal\views\ViewExecutable; |
|
|
|
use Drupal\views\ViewExecutable; |
|
|
|
use Drupal\views\Views; |
|
|
|
use Drupal\views\Views; |
|
|
|
use Psr\Log\LoggerInterface; |
|
|
|
use Psr\Log\LoggerInterface; |
|
|
|
|
|
|
|
use Drupal\Core\Logger\LoggerChannelFactoryInterface; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Decorates the FileHash services adding additional functionality. |
|
|
|
* Decorates the FileHash services adding additional functionality. |
|
|
@ -48,13 +48,6 @@ class FixityCheckService implements FixityCheckServiceInterface { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected $time; |
|
|
|
protected $time; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* The mail manager service. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @var \Drupal\Core\Mail\MailManagerInterface |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
protected $mailManager; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* The logger for this service. |
|
|
|
* The logger for this service. |
|
|
|
* |
|
|
|
* |
|
|
@ -69,19 +62,53 @@ class FixityCheckService implements FixityCheckServiceInterface { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected $filehash; |
|
|
|
protected $filehash; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* The logger factory. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @var \Drupal\Core\Logger\LoggerChannelFactoryInterface |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
protected LoggerChannelFactoryInterface $loggerFactory; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Constructor. |
|
|
|
* Constructor. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function __construct(TranslationInterface $string_translation, ConfigFactoryInterface $config, EntityTypeManagerInterface $entity_type_manager, TimeInterface $time, MailManagerInterface $mail_manager, LoggerInterface $logger, FileHash $filehash) { |
|
|
|
public function __construct( |
|
|
|
|
|
|
|
TranslationInterface $string_translation, |
|
|
|
|
|
|
|
ConfigFactoryInterface $config, |
|
|
|
|
|
|
|
EntityTypeManagerInterface $entity_type_manager, |
|
|
|
|
|
|
|
TimeInterface $time, |
|
|
|
|
|
|
|
FileHash $filehash |
|
|
|
|
|
|
|
) { |
|
|
|
$this->stringTranslation = $string_translation; |
|
|
|
$this->stringTranslation = $string_translation; |
|
|
|
$this->config = $config; |
|
|
|
$this->config = $config; |
|
|
|
$this->entityTypeManager = $entity_type_manager; |
|
|
|
$this->entityTypeManager = $entity_type_manager; |
|
|
|
$this->time = $time; |
|
|
|
$this->time = $time; |
|
|
|
$this->mailManager = $mail_manager; |
|
|
|
|
|
|
|
$this->logger = $logger; |
|
|
|
|
|
|
|
$this->filehash = $filehash; |
|
|
|
$this->filehash = $filehash; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Sets the logger factory. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $loggerFactory |
|
|
|
|
|
|
|
* The logger factory. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public function setLoggerFactory(LoggerChannelFactoryInterface $loggerFactory) { |
|
|
|
|
|
|
|
$this->loggerFactory = $loggerFactory; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Gets the logger channel. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return \Psr\Log\LoggerInterface |
|
|
|
|
|
|
|
* The logger channel. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
protected function getLogger() { |
|
|
|
|
|
|
|
if (!isset($this->logger)) { |
|
|
|
|
|
|
|
$this->logger = $this->loggerFactory->get('dgi_fixity'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return $this->logger; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* {@inheritdoc} |
|
|
|
* {@inheritdoc} |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -272,10 +299,10 @@ class FixityCheckService implements FixityCheckServiceInterface { |
|
|
|
)->toString(), |
|
|
|
)->toString(), |
|
|
|
]; |
|
|
|
]; |
|
|
|
if ($check->passed()) { |
|
|
|
if ($check->passed()) { |
|
|
|
$this->logger->info($message, $args); |
|
|
|
$this->getLogger()->info($message, $args); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
$this->logger->error($message, $args); |
|
|
|
$this->getLogger()->error($message, $args); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $check; |
|
|
|
return $check; |
|
|
|