Skip to content

Commit

Permalink
Merge branch 'master' into fix-metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-meyer authored Sep 20, 2024
2 parents c16820e + 2e61841 commit 25169dd
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 11 deletions.
Binary file not shown.
4 changes: 2 additions & 2 deletions Classes/Common/Solr/SolrSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ private function getSort() : array
'score' => 'desc',
'year_sorting' => 'asc',
'title_sorting' => 'asc',
'volume' => 'asc'
'volume_sorting' => 'asc'
];
}

Expand Down Expand Up @@ -860,7 +860,7 @@ private function getDocument(Document $record, array $highlighting, array $field
*/
private function translateLanguageCode(&$doc): void
{
if (array_key_exists('language', $doc['metadata'])) {
if (is_array($doc['metadata']) && array_key_exists('language', $doc['metadata'])) {
foreach($doc['metadata']['language'] as $indexName => $language) {
$doc['metadata']['language'][$indexName] = Helper::getLanguageName($language);
}
Expand Down
8 changes: 7 additions & 1 deletion Classes/Controller/AbstractController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Psr\Log\LoggerAwareTrait;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Log\LogManager;
use TYPO3\CMS\Core\Pagination\PaginationInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
Expand Down Expand Up @@ -111,6 +112,8 @@ protected function initialize(): void
// Get extension configuration.
$this->extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('dlf');

$this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__);

$this->viewData = [
'pageUid' => $this->pageUid,
'uniqueId' => uniqid(),
Expand All @@ -129,6 +132,9 @@ protected function initialize(): void
*/
protected function loadDocument(int $documentId = 0): void
{
// Sanitize FlexForm settings to avoid later casting.
$this->sanitizeSettings();

// Get document ID from request data if not passed as parameter.
if ($documentId === 0 && !empty($this->requestData['id'])) {
$documentId = $this->requestData['id'];
Expand Down Expand Up @@ -317,7 +323,7 @@ protected function sanitizeSettings(): void
*/
protected function setDefaultIntSetting(string $setting, int $value): void
{
if (empty($this->settings[$setting])) {
if (!array_key_exists($setting, $this->settings) || empty($this->settings[$setting])) {
$this->settings[$setting] = $value;
$this->logger->warning('Setting "' . $setting . '" not set, using default value "' . $value . '". Probably FlexForm for controller "' . get_class($this) . '" is not read.');
} else {
Expand Down
6 changes: 4 additions & 2 deletions Classes/Controller/OaiPmhController.php
Original file line number Diff line number Diff line change
Expand Up @@ -785,11 +785,13 @@ private function checkGranularity(): void
*/
protected function generateOutputForDocumentList(array $documentListSet)
{
$documentsToProcess = array_splice($documentListSet['elements'], 0, $this->settings['limit']);
if (empty($documentsToProcess)) {
// check whether any result elements are available
if (empty($documentListSet) || empty($documentListSet['elements'])) {
$this->error = 'noRecordsMatch';
return [];
}
// consume result elements from list to implement pagination logic of resumptionToken
$documentsToProcess = array_splice($documentListSet['elements'], 0, $this->settings['limit']);
$verb = $this->parameters['verb'];

$documents = $this->documentRepository->getOaiDocumentList($documentsToProcess);
Expand Down
6 changes: 5 additions & 1 deletion Classes/Middleware/Embedded3dViewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Configuration\Loader\YamlFileLoader;
use TYPO3\CMS\Core\Exception;
use TYPO3\CMS\Core\Http\HtmlResponse;
use TYPO3\CMS\Core\Log\LogManager;
use TYPO3\CMS\Core\Resource\Folder;
use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\Resource\StorageRepository;
Expand All @@ -35,7 +37,7 @@
* @subpackage dlf
* @access public
*/
class Embedded3dViewer implements MiddlewareInterface
class Embedded3dViewer implements LoggerAwareInterface, MiddlewareInterface
{
use LoggerAwareTrait;

Expand Down Expand Up @@ -63,6 +65,8 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
return $response;
}

$this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__);

if (empty($parameters['model'])) {
return $this->warningResponse('Model url is missing.', $request);
}
Expand Down
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 25169dd

Please sign in to comment.