diff --git a/.github/phpstan.neon b/.github/phpstan.neon deleted file mode 100644 index 9d2e14f8af..0000000000 --- a/.github/phpstan.neon +++ /dev/null @@ -1,11 +0,0 @@ -parameters: - ignoreErrors: - - '#Call to an undefined method Psr\\Http\\Message\\RequestFactoryInterface::request\(\)\.#' - - '#Call to an undefined method Ubl\\Iiif\\Presentation\\Common\\Model\\Resources\\ManifestInterface::getOriginalJsonArray\(\)\.#' - - '#Call to an undefined method Ubl\\Iiif\\Presentation\\Common\\Model\\Resources\\RangeInterface::getMemberRangesAndRanges\(\)\.#' - level: 5 - paths: - - ../Classes/ - excludePaths: - - ../Classes/Controller/OaiPmhController.php - treatPhpDocTypesAsCertain: false diff --git a/.github/phpstan_12.4.neon b/.github/phpstan_12.4.neon new file mode 100644 index 0000000000..d5e27f3605 --- /dev/null +++ b/.github/phpstan_12.4.neon @@ -0,0 +1,27 @@ +parameters: + ignoreErrors: + - '#Call to an undefined method Psr\\Http\\Message\\RequestFactoryInterface::request\(\)\.#' + - '#Call to an undefined method Ubl\\Iiif\\Presentation\\Common\\Model\\Resources\\ManifestInterface::getOriginalJsonArray\(\)\.#' + - '#Call to an undefined method Ubl\\Iiif\\Presentation\\Common\\Model\\Resources\\RangeInterface::getMemberRangesAndRanges\(\)\.#' + - + message: '#Class TYPO3\\CMS\\Core\\TypoScript\\FrontendTypoScriptFactory not found\.#' + path: ../Classes/Common/TypoScriptHelper.php + - + message: '#Call to method createSettingsAndSetupConditions\(\) on an unknown class TYPO3\\CMS\\Core\\TypoScript\\FrontendTypoScriptFactory\.#' + path: ../Classes/Common/TypoScriptHelper.php + - + message: '#Call to method createSetupConfigOrFullSetup\(\) on an unknown class TYPO3\\CMS\\Core\\TypoScript\\FrontendTypoScriptFactory\.#' + path: ../Classes/Common/TypoScriptHelper.php + - + message: '#PHPDoc tag @var for variable \$action contains unknown class TYPO3\\CMS\\Scheduler\\SchedulerManagementAction\.#' + path: ../Classes/Task/BaseAdditionalFieldProvider.php + - + message: '#Access to constant EDIT on an unknown class TYPO3\\CMS\\Scheduler\\SchedulerManagementAction\.#' + path: ../Classes/Task/BaseAdditionalFieldProvider.php + level: 5 + paths: + - ../Classes/ + excludePaths: + - ../Classes/Controller/OaiPmhController.php + - ../Classes/Command/DbDocs/Generator.php # dbdocs command is not supported in Typo3 v12 + treatPhpDocTypesAsCertain: false diff --git a/.github/phpstan_13.4.neon b/.github/phpstan_13.4.neon new file mode 100644 index 0000000000..cd760e5a80 --- /dev/null +++ b/.github/phpstan_13.4.neon @@ -0,0 +1,26 @@ +parameters: + ignoreErrors: + - '#Call to an undefined method Psr\\Http\\Message\\RequestFactoryInterface::request\(\)\.#' + - '#Call to an undefined method Ubl\\Iiif\\Presentation\\Common\\Model\\Resources\\ManifestInterface::getOriginalJsonArray\(\)\.#' + - '#Call to an undefined method Ubl\\Iiif\\Presentation\\Common\\Model\\Resources\\RangeInterface::getMemberRangesAndRanges\(\)\.#' + - + message: '#Call to an undefined method TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController::getFromCache\(\)\.#' + path: ../Classes/Common/TypoScriptHelper.php + - + message: '#Call to an undefined method TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController::releaseLocks\(\)\.#' + path: ../Classes/Common/TypoScriptHelper.php + - + message: '#PHPDoc tag @var for variable \$action contains unknown class TYPO3\\CMS\\Scheduler\\Task\\Enumeration\\Action\.#' + path: ../Classes/Task/BaseAdditionalFieldProvider.php + - + message: '#Access to constant EDIT on an unknown class TYPO3\\CMS\\Scheduler\\Task\\Enumeration\\Action\.#' + path: ../Classes/Task/BaseAdditionalFieldProvider.php + - + message: '#Call to method equals\(\) on an unknown class TYPO3\\CMS\\Scheduler\\Task\\Enumeration\\Action\.#' + path: ../Classes/Task/BaseAdditionalFieldProvider.php + level: 5 + paths: + - ../Classes/ + excludePaths: + - ../Classes/Controller/OaiPmhController.php + treatPhpDocTypesAsCertain: false diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 54949d27a2..89d0fc72f6 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -10,6 +10,9 @@ jobs: phpstan: name: Static Code Analysis runs-on: ubuntu-latest + strategy: + matrix: + variants: [ {typo3: 12.4, php: 8.1}, {typo3: 13.4, php: 8.4} ] steps: - name: Checkout code uses: actions/checkout@v4 @@ -18,9 +21,11 @@ jobs: uses: php-actions/composer@v6 with: command: update + php_version: ${{ matrix.variants.php }} + args: --ignore-platform-reqs --with=typo3/cms-core:^${{ matrix.variants.typo3 }} - name: PHPStan Static Analysis uses: php-actions/phpstan@v3 with: - configuration: ./.github/phpstan.neon + configuration: ./.github/phpstan_${{ matrix.variants.typo3 }}.neon path: '' diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b9d3e3cb86..4ff1473f6a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - variants: [ {typo3: 11.5, php: 8.1}, {typo3: 12.4, php: 8.1}, {typo3: 11.5, php: 8.3}, {typo3: 12.4, php: 8.4} ] + variants: [ {typo3: 12.4, php: 8.1}, {typo3: 12.4, php: 8.4}, {typo3: 13.4, php: 8.2}, {typo3: 13.4, php: 8.4} ] steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/Build/Test/FunctionalTests.xml b/Build/Test/FunctionalTests.xml index 4e08bf0f23..157ad88860 100644 --- a/Build/Test/FunctionalTests.xml +++ b/Build/Test/FunctionalTests.xml @@ -1,23 +1,20 @@ + diff --git a/Build/Test/UnitTests.xml b/Build/Test/UnitTests.xml index e9811e4a58..f766379178 100644 --- a/Build/Test/UnitTests.xml +++ b/Build/Test/UnitTests.xml @@ -1,23 +1,21 @@ + diff --git a/Classes/Command/BaseCommand.php b/Classes/Command/BaseCommand.php index 71429ef47d..0b033161b3 100644 --- a/Classes/Command/BaseCommand.php +++ b/Classes/Command/BaseCommand.php @@ -25,6 +25,8 @@ use Kitodo\Dlf\Validation\DocumentValidator; use Symfony\Component\Console\Command\Command; use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; +use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; +use TYPO3\CMS\Core\Http\ServerRequest; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\MathUtility; use TYPO3\CMS\Core\Database\ConnectionPool; @@ -128,6 +130,8 @@ public function __construct( */ protected function initializeRepositories(int $storagePid): void { + $request = (new ServerRequest())->withAttribute("applicationType", SystemEnvironmentBuilder::REQUESTTYPE_BE); + $this->configurationManager->setRequest($request); $frameworkConfiguration = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); $frameworkConfiguration['persistence']['storagePid'] = MathUtility::forceIntegerInRange($storagePid, 0); $this->configurationManager->setConfiguration($frameworkConfiguration); @@ -180,7 +184,7 @@ protected function getSolrCores(int $pageId): array $queryBuilder->createNamedParameter($pageId, Connection::PARAM_INT) ) ) - ->execute(); + ->executeQuery(); while ($record = $result->fetchAssociative()) { $solrCores[$record['index_name']] = $record['uid']; @@ -222,7 +226,7 @@ protected function saveToDatabase(Document $document, bool $softCommit = false): $document->setMetsLabel($metadata['mets_label'][0] ?? ''); $document->setMetsOrderlabel($metadata['mets_orderlabel'][0] ?? ''); - $structure = $this->structureRepository->findOneByIndexName($metadata['type'][0]); + $structure = $this->structureRepository->findOneBy(['indexName' => $metadata['type'][0]]); if ($structure !== null) { $document->setStructure($structure); } @@ -297,7 +301,7 @@ protected function getParentDocumentUidForSaving(Document $document, bool $softC $parent = AbstractDocument::getInstance($doc->parentHref, ['storagePid' => $this->storagePid], true); if ($parent->recordId) { - $parentDocument = $this->documentRepository->findOneByRecordId($parent->recordId); + $parentDocument = $this->documentRepository->findOneBy(['recordId' => $parent->recordId]); if ($parentDocument === null) { // create new Document object @@ -335,7 +339,7 @@ protected function getParentDocumentUidForSaving(Document $document, bool $softC private function addCollections(Document &$document, array $collections): void { foreach ($collections as $collection) { - $documentCollection = $this->collectionRepository->findOneByIndexName($collection); + $documentCollection = $this->collectionRepository->findOneBy(['indexName' => $collection]); if (!$documentCollection) { // create new Collection object $documentCollection = GeneralUtility::makeInstance(Collection::class); @@ -428,7 +432,7 @@ private function setOwner($owner): void if (empty($this->owner)) { // owner is not set set but found by metadata --> take it or take default library $owner = $owner ? : 'default'; - $this->owner = $this->libraryRepository->findOneByIndexName($owner); + $this->owner = $this->libraryRepository->findOneBy(['indexName' => $owner]); if (empty($this->owner)) { // create library $this->owner = GeneralUtility::makeInstance(Library::class); diff --git a/Classes/Command/DbDocs/Generator.php b/Classes/Command/DbDocs/Generator.php index 5d3255ef07..17503e40d8 100644 --- a/Classes/Command/DbDocs/Generator.php +++ b/Classes/Command/DbDocs/Generator.php @@ -13,18 +13,18 @@ namespace Kitodo\Dlf\Command\DbDocs; use Doctrine\DBAL\Schema\Table; -use Kitodo\Dlf\Common\Helper; use ReflectionClass; use ReflectionProperty; +use RuntimeException; +use TYPO3\CMS\Core\Database\Schema\Parser\Lexer; use TYPO3\CMS\Core\Database\Schema\Parser\Parser; use TYPO3\CMS\Core\Database\Schema\SqlReader; +use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Localization\LanguageService; use TYPO3\CMS\Core\Localization\LanguageServiceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Configuration\ConfigurationManager; -use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; use TYPO3\CMS\Extbase\Persistence\ClassesConfiguration; -use TYPO3\CMS\Extbase\Persistence\ClassesConfigurationFactory; use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory; use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper; @@ -101,8 +101,8 @@ public function collectTables(): array $result = []; foreach ($createTableStatements as $statement) { - $parser = new Parser($statement); - list($table) = $parser->parse(); + $parser = new Parser(new Lexer()); + list($table) = $parser->parse($statement); $tableName = $table->getName(); if (!str_starts_with($tableName, 'tx_dlf_')) { diff --git a/Classes/Command/DbDocsCommand.php b/Classes/Command/DbDocsCommand.php index 55ad1339ae..ef092d3a60 100644 --- a/Classes/Command/DbDocsCommand.php +++ b/Classes/Command/DbDocsCommand.php @@ -12,18 +12,15 @@ namespace Kitodo\Dlf\Command; -use Kitodo\Dlf\Common\AbstractDocument; -use Kitodo\Dlf\Common\Indexer; use Kitodo\Dlf\Command\DbDocs\Generator; -use Kitodo\Dlf\Domain\Model\Document; +use RuntimeException; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\MathUtility; /** * CLI Command for generating the reStructuredText file containing documentation @@ -81,6 +78,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int $outputPath = $input->getArgument('outputPath'); } + $typo3Version = (new Typo3Version())->getMajorVersion(); + if ($typo3Version != 13) { + throw new RuntimeException(("dbdocs command can only be run with TYPO3 v13")); + } + $tables = $this->generator->collectTables(); $page = $this->generator->generatePage($tables); diff --git a/Classes/Command/DeleteCommand.php b/Classes/Command/DeleteCommand.php index 1e1c026d7a..eda5ba3805 100644 --- a/Classes/Command/DeleteCommand.php +++ b/Classes/Command/DeleteCommand.php @@ -220,9 +220,9 @@ private function getDocument($input): ?Document $doc = AbstractDocument::getInstance($input->getOption('doc'), ['storagePid' => $this->storagePid], true); if ($doc->recordId) { - $document = $this->documentRepository->findOneByRecordId($doc->recordId); + $document = $this->documentRepository->findOneBy(['recordId' => $doc->recordId]); } else { - $document = $this->documentRepository->findOneByLocation($input->getOption('doc')); + $document = $this->documentRepository->findOneBy(['location' => $input->getOption('doc')]); } } diff --git a/Classes/Command/HarvestCommand.php b/Classes/Command/HarvestCommand.php index f3bea2ece0..890fc252df 100644 --- a/Classes/Command/HarvestCommand.php +++ b/Classes/Command/HarvestCommand.php @@ -240,7 +240,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } if ($doc->recordId) { - $document = $this->documentRepository->findOneByRecordId($doc->recordId); + $document = $this->documentRepository->findOneBy(['recordId' => $doc->recordId]); } if ($document === null) { diff --git a/Classes/Command/IndexCommand.php b/Classes/Command/IndexCommand.php index 862a82b1bc..4e478dce08 100644 --- a/Classes/Command/IndexCommand.php +++ b/Classes/Command/IndexCommand.php @@ -150,7 +150,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if (MathUtility::canBeInterpretedAsInteger($input->getOption('owner'))) { $this->owner = $this->libraryRepository->findByUid(MathUtility::forceIntegerInRange((int) $input->getOption('owner'), 1)); } else { - $this->owner = $this->libraryRepository->findOneByIndexName((string) $input->getOption('owner')); + $this->owner = $this->libraryRepository->findOneBy(['indexName' => (string) $input->getOption('owner')]); } } else { $this->owner = null; @@ -232,9 +232,9 @@ private function getDocumentFromUrl($doc, string $url): Document $document = null; if ($doc->recordId ?? false) { - $document = $this->documentRepository->findOneByRecordId($doc->recordId); + $document = $this->documentRepository->findOneBy(['recordId' => $doc->recordId]); } else { - $document = $this->documentRepository->findOneByLocation($url); + $document = $this->documentRepository->findOneBy(['location' => $url]); } if ($document === null) { diff --git a/Classes/Command/ReindexCommand.php b/Classes/Command/ReindexCommand.php index 47e184324c..da60ef120a 100644 --- a/Classes/Command/ReindexCommand.php +++ b/Classes/Command/ReindexCommand.php @@ -155,7 +155,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if (MathUtility::canBeInterpretedAsInteger($input->getOption('owner'))) { $this->owner = $this->libraryRepository->findByUid(MathUtility::forceIntegerInRange((int) $input->getOption('owner'), 1)); } else { - $this->owner = $this->libraryRepository->findOneByIndexName((string) $input->getOption('owner')); + $this->owner = $this->libraryRepository->findOneBy(['indexName' => (string) $input->getOption('owner')]); } } else { $this->owner = null; diff --git a/Classes/Common/AbstractDocument.php b/Classes/Common/AbstractDocument.php index 521679af97..f2042a0bb9 100644 --- a/Classes/Common/AbstractDocument.php +++ b/Classes/Common/AbstractDocument.php @@ -644,7 +644,7 @@ public static function getTitle(int $uid, bool $recursive = false): string Helper::whereExpression('tx_dlf_documents') ) ->setMaxResults(1) - ->execute(); + ->executeQuery(); $resArray = $result->fetchAssociative(); if ($resArray) { @@ -761,7 +761,7 @@ protected function loadFormats(): void ->where( $queryBuilder->expr()->eq('pid', $this->configPid) ) - ->execute(); + ->executeQuery(); while ($resArray = $result->fetchAssociative()) { // Update format registry. diff --git a/Classes/Common/Helper.php b/Classes/Common/Helper.php index ef824c005f..81e46dc48d 100644 --- a/Classes/Common/Helper.php +++ b/Classes/Common/Helper.php @@ -27,6 +27,7 @@ use TYPO3\CMS\Core\Messaging\FlashMessageQueue; use TYPO3\CMS\Core\Resource\MimeTypeCollection; use TYPO3\CMS\Core\Resource\MimeTypeDetector; +use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; use TYPO3\CMS\Core\Utility\ArrayUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\MathUtility; @@ -76,6 +77,13 @@ class Helper */ protected static array $messages = []; + /** + * @access protected + * @static + * @var array A cache remembering which Solr core uid belongs to which index name + */ + protected static array $indexNameCache = []; + /** * Generates a flash message and adds it to a message queue. * @@ -85,13 +93,13 @@ class Helper * * @param string $message The body of the message * @param string $title The title of the message - * @param int $severity The message's severity + * @param ContextualFeedbackSeverity $severity The message's severity * @param bool $session Should the message be saved in the user's session? * @param string $queue The queue's unique identifier * * @return FlashMessageQueue The queue the message was added to */ - public static function addMessage(string $message, string $title, int $severity, bool $session = false, string $queue = 'kitodo.default.flashMessages'): FlashMessageQueue + public static function addMessage(string $message, string $title, ContextualFeedbackSeverity $severity, bool $session = false, string $queue = 'kitodo.default.flashMessages'): FlashMessageQueue { $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class); $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); @@ -406,7 +414,7 @@ public static function getCleanString(string $string): string public static function getHookObjects(string $scriptRelPath): array { $hookObjects = []; - if (is_array(self::getOptions()[self::$extKey . '/' . $scriptRelPath]['hookClass'])) { + if (is_array(self::getOptions()[self::$extKey . '/' . $scriptRelPath]['hookClass'] ?? null)) { foreach (self::getOptions()[self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) { $hookObjects[] = GeneralUtility::makeInstance($classRef); } @@ -444,8 +452,7 @@ public static function getIndexNameFromUid(int $uid, string $table, int $pid = - return $pid . '.' . $uid; }; - static $cache = []; - if (!isset($cache[$table])) { + if (!isset(self::$indexNameCache[$table])) { $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) ->getQueryBuilderForTable($table); @@ -456,19 +463,19 @@ public static function getIndexNameFromUid(int $uid, string $table, int $pid = - $table . '.pid AS pid', ) ->from($table) - ->execute(); + ->executeQuery(); - $cache[$table] = []; + self::$indexNameCache[$table] = []; while ($row = $result->fetchAssociative()) { - $cache[$table][$makeCacheKey($row['pid'], $row['uid'])] - = $cache[$table][$makeCacheKey(-1, $row['uid'])] + self::$indexNameCache[$table][$makeCacheKey($row['pid'], $row['uid'])] + = self::$indexNameCache[$table][$makeCacheKey(-1, $row['uid'])] = $row['index_name']; } } $cacheKey = $makeCacheKey($pid, $uid); - $result = $cache[$table][$cacheKey] ?? ''; + $result = self::$indexNameCache[$table][$cacheKey] ?? ''; if ($result === '') { self::warning('No "index_name" with UID ' . $uid . ' and PID ' . $pid . ' found in table "' . $table . '"'); @@ -477,6 +484,18 @@ public static function getIndexNameFromUid(int $uid, string $table, int $pid = - return $result; } + /** + * Reset the index name cache. + * + * @access public + * + * @static + */ + public static function resetIndexNameCache() + { + self::$indexNameCache = []; + } + /** * Get language name from ISO code * @@ -542,7 +561,7 @@ public static function getDocumentStructures(int $pid = -1): array ) ->from('tx_dlf_structures') ->where($where) - ->execute(); + ->executeQuery(); $allStructures = $kitodoStructures->fetchAllAssociative(); @@ -733,7 +752,7 @@ public static function translate(string $indexName, string $table, string $pid): self::whereExpression($table, true) ) ->setMaxResults(1) - ->execute(); + ->executeQuery(); $row = $result->fetchAssociative(); @@ -749,7 +768,7 @@ public static function translate(string $indexName, string $table, string $pid): self::whereExpression($table, true) ) ->setMaxResults(1) - ->execute(); + ->executeQuery(); $row = $result->fetchAssociative(); @@ -765,8 +784,8 @@ public static function translate(string $indexName, string $table, string $pid): if (in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_metadatasubentries', 'tx_dlf_structures'])) { $additionalWhere = $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]); if ($languageContentId > 0) { - $additionalWhere = $queryBuilder->expr()->andX( - $queryBuilder->expr()->orX( + $additionalWhere = $queryBuilder->expr()->and( + $queryBuilder->expr()->or( $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]), $queryBuilder->expr()->eq($table . '.sys_language_uid', (int) $languageContentId) ), @@ -784,13 +803,13 @@ public static function translate(string $indexName, string $table, string $pid): self::whereExpression($table, true) ) ->setMaxResults(10000) - ->execute(); + ->executeQuery(); if ($result->rowCount() > 0) { while ($resArray = $result->fetchAssociative()) { // Overlay localized labels if available. if ($languageContentId > 0) { - $resArray = $pageRepository->getRecordOverlay($table, $resArray, $languageContentId, $languageAspect->getLegacyOverlayType()); + $resArray = $pageRepository->getLanguageOverlay($table, $resArray, $languageAspect); } if ($resArray) { $labels[$table][$pid][$languageContentId][$resArray['index_name']] = $resArray['label']; diff --git a/Classes/Common/IiifManifest.php b/Classes/Common/IiifManifest.php index 8e63fa2db0..bacb062694 100644 --- a/Classes/Common/IiifManifest.php +++ b/Classes/Common/IiifManifest.php @@ -134,8 +134,8 @@ protected function establishRecordId(int $pid): void ->where( $queryBuilder->expr()->eq('tx_dlf_metadata.pid', (int) $pid), $queryBuilder->expr()->eq('tx_dlf_metadataformat.pid', (int) $pid), - $queryBuilder->expr()->orX( - $queryBuilder->expr()->andX( + $queryBuilder->expr()->or( + $queryBuilder->expr()->and( $queryBuilder->expr()->eq('tx_dlf_metadata.uid', 'tx_dlf_metadataformat.parent_id'), $queryBuilder->expr()->eq('tx_dlf_metadataformat.encoded', 'tx_dlf_formats.uid'), $queryBuilder->expr()->eq('tx_dlf_metadata.index_name', $queryBuilder->createNamedParameter('record_id')), @@ -144,7 +144,7 @@ protected function establishRecordId(int $pid): void $queryBuilder->expr()->eq('tx_dlf_metadata.format', 0) ) ) - ->execute(); + ->executeQuery(); while ($resArray = $result->fetchAssociative()) { $recordIdPath = $resArray['querypath']; if (!empty($recordIdPath)) { @@ -499,6 +499,7 @@ public function getManifestMetadata(string $id, bool $withDescription = true, bo if (!empty($this->originalMetadataArray[$id])) { return $this->originalMetadataArray[$id]; } + /** @var IiifResourceInterface $iiifResource */ $iiifResource = $this->iiif->getContainedResourceById($id); $result = []; if ($iiifResource != null) { @@ -565,8 +566,8 @@ public function getMetadata(string $id): array ->where( $queryBuilder->expr()->eq('tx_dlf_metadata.pid', $this->configPid), $queryBuilder->expr()->eq('tx_dlf_metadataformat.pid', $this->configPid), - $queryBuilder->expr()->orX( - $queryBuilder->expr()->andX( + $queryBuilder->expr()->or( + $queryBuilder->expr()->and( $queryBuilder->expr()->eq('tx_dlf_metadata.uid', 'tx_dlf_metadataformat.parent_id'), $queryBuilder->expr()->eq('tx_dlf_metadataformat.encoded', 'tx_dlf_formats.uid'), $queryBuilder->expr()->eq('tx_dlf_formats.type', $queryBuilder->createNamedParameter($this->getIiifVersion())) @@ -574,7 +575,7 @@ public function getMetadata(string $id): array $queryBuilder->expr()->eq('tx_dlf_metadata.format', 0) ) ) - ->execute(); + ->executeQuery(); $iiifResource = $this->iiif->getContainedResourceById($id); while ($resArray = $result->fetchAssociative()) { // Set metadata field's value(s). @@ -713,6 +714,7 @@ public function getFullText(string $id): string } } if ($this->getIndexAnnotations() == 1) { + /** @var IiifResourceInterface $iiifResource */ $iiifResource = $this->iiif->getContainedResourceById($id); // Get annotation containers $annotationContainerIds = $physicalStructureNode['annotationContainers']; diff --git a/Classes/Common/Indexer.php b/Classes/Common/Indexer.php index f466e967b0..bb0214ac70 100644 --- a/Classes/Common/Indexer.php +++ b/Classes/Common/Indexer.php @@ -21,7 +21,7 @@ use Symfony\Component\Console\Input\InputInterface; use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; use TYPO3\CMS\Core\Database\ConnectionPool; -use TYPO3\CMS\Core\Messaging\FlashMessage; +use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\MathUtility; use TYPO3\CMS\Core\Core\Environment; @@ -43,6 +43,11 @@ class Indexer */ public static string $extKey = 'dlf'; + /** + * Prefix for translation keys. + */ + const LANG_PREFIX = 'LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:'; + /** * @access protected * @static @@ -101,7 +106,6 @@ public static function add(Document $document, DocumentRepository $documentRepos return true; } elseif (self::solrConnect($document->getSolrcore(), $document->getPid())) { $success = true; - Helper::getLanguageService()->includeLLFile('EXT:dlf/Resources/Private/Language/locallang_be.xlf'); // Handle multi-volume documents. $parentId = $document->getPartof(); if ($parentId) { @@ -151,12 +155,22 @@ public static function add(Document $document, DocumentRepository $documentRepos if (!(Environment::isCli())) { if ($success) { self::addMessage( - sprintf(Helper::getLanguageService()->getLL('flash.documentIndexed'), $document->getTitle(), $document->getUid()), + sprintf( + Helper::getLanguageService()->sL(self::LANG_PREFIX . 'flash.documentIndexed'), + $document->getTitle(), + $document->getUid() + ), 'flash.done', - FlashMessage::OK + ContextualFeedbackSeverity::OK ); } else { - self::addErrorMessage(sprintf(Helper::getLanguageService()->getLL('flash.documentNotIndexed'), $document->getTitle(), $document->getUid())); + self::addErrorMessage( + sprintf( + Helper::getLanguageService()->sL(self::LANG_PREFIX . 'flash.documentNotIndexed'), + $document->getTitle(), + $document->getUid() + ) + ); } } return $success; @@ -167,9 +181,9 @@ public static function add(Document $document, DocumentRepository $documentRepos } else { if (!(Environment::isCli())) { self::addMessage( - Helper::getLanguageService()->getLL('flash.solrNoConnection'), + Helper::getLanguageService()->sL(self::LANG_PREFIX . 'flash.solrNoConnection'), 'flash.warning', - FlashMessage::WARNING + ContextualFeedbackSeverity::WARNING ); } Helper::error('Could not connect to Apache Solr server'); @@ -200,9 +214,9 @@ public static function delete(InputInterface $input, string $field, int $solrCor } catch (\Exception $e) { if (!(Environment::isCli())) { Helper::addMessage( - Helper::getLanguageService()->getLL('flash.solrException') . ' ' . htmlspecialchars($e->getMessage()), - Helper::getLanguageService()->getLL('flash.error'), - FlashMessage::ERROR, + Helper::getLanguageService()->sL(self::LANG_PREFIX . 'flash.solrException') . ' ' . htmlspecialchars($e->getMessage()), + Helper::getLanguageService()->sL(self::LANG_PREFIX . 'flash.error'), + ContextualFeedbackSeverity::ERROR, true, 'core.template.flashMessages' ); @@ -281,7 +295,7 @@ protected static function loadIndexConf(int $pid): void $queryBuilder->expr()->eq('pid', $pid), Helper::whereExpression('tx_dlf_metadata') ) - ->execute(); + ->executeQuery(); while ($indexing = $result->fetchAssociative()) { if ($indexing['index_tokenized']) { @@ -727,7 +741,7 @@ private static function removeAppendsFromAuthor(array|string $authors): array|st private static function handleException(string $errorMessage): void { if (!(Environment::isCli())) { - self::addErrorMessage(Helper::getLanguageService()->getLL('flash.solrException') . '
' . htmlspecialchars($errorMessage)); + self::addErrorMessage(Helper::getLanguageService()->sL(self::LANG_PREFIX . 'flash.solrException') . '
' . htmlspecialchars($errorMessage)); } Helper::error('Apache Solr threw exception: "' . $errorMessage . '"'); } @@ -748,7 +762,7 @@ private static function addErrorMessage(string $message): void self::addMessage( $message, 'flash.error', - FlashMessage::ERROR + ContextualFeedbackSeverity::ERROR ); } @@ -761,16 +775,16 @@ private static function addErrorMessage(string $message): void * * @param string $message * @param string $type - * @param int $status + * @param ContextualFeedbackSeverity $severity * * @return void */ - private static function addMessage(string $message, string $type, int $status): void + private static function addMessage(string $message, string $type, ContextualFeedbackSeverity $severity): void { Helper::addMessage( $message, - Helper::getLanguageService()->getLL($type), - $status, + Helper::getLanguageService()->sL(self::LANG_PREFIX . $type), + $severity, true, 'core.template.flashMessages' ); diff --git a/Classes/Common/KitodoFlashMessageRenderer.php b/Classes/Common/KitodoFlashMessageRenderer.php index d9acb0c819..4204d1caf2 100644 --- a/Classes/Common/KitodoFlashMessageRenderer.php +++ b/Classes/Common/KitodoFlashMessageRenderer.php @@ -14,6 +14,7 @@ use TYPO3\CMS\Core\Messaging\FlashMessage; use TYPO3\CMS\Core\Messaging\Renderer\FlashMessageRendererInterface; +use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; /** * A class representing a bootstrap flash messages. @@ -29,30 +30,6 @@ */ class KitodoFlashMessageRenderer implements FlashMessageRendererInterface { - /** - * @var array The message severity class names - */ - protected static array $classes = [ - // Todo: FlashMessage constants deprecated in v12, remove when dropping v11 support - FlashMessage::NOTICE => 'notice', - FlashMessage::INFO => 'info', - FlashMessage::OK => 'success', - FlashMessage::WARNING => 'warning', - FlashMessage::ERROR => 'danger' - ]; - - /** - * @var array The message severity icon names - */ - protected static array $icons = [ - // Todo: FlashMessage constants deprecated in v12, remove when dropping v11 support - FlashMessage::NOTICE => 'lightbulb-o', - FlashMessage::INFO => 'info', - FlashMessage::OK => 'check', - FlashMessage::WARNING => 'exclamation', - FlashMessage::ERROR => 'times' - ]; - /** * Render method * @@ -67,27 +44,6 @@ public function render(array $flashMessages): string return $this->getMessageAsMarkup($flashMessages); } - /** - * Gets the message severity as integer value for compatibility with Typo3 v12 - * - * @access public - * - * @param FlashMessage $flashMessage - * - * @return int The message severity as integer - */ - protected function getSeverityAsInt(FlashMessage $flashMessage): int - { - $severity = $flashMessage->getSeverity(); - if (is_int($severity)) { - // $severity is integer constant from FlashMessage in Typo3 v11 - return $severity; - } - // $severity is instance of ContextualFeedbackSeverity enum introduced in Typo3 v12 - // TODO: migrate message severity to ContextualFeedbackSeverity when dropping support for Typo3 v11 - return $severity->value; - } - /** * Gets the message severity class name * @@ -99,7 +55,7 @@ protected function getSeverityAsInt(FlashMessage $flashMessage): int */ protected function getClass(FlashMessage $flashMessage): string { - return 'alert-' . self::$classes[$this->getSeverityAsInt($flashMessage)]; + return 'alert-' . $flashMessage->getSeverity()->getCssClass(); } /** @@ -113,7 +69,7 @@ protected function getClass(FlashMessage $flashMessage): string */ protected function getIconName(FlashMessage $flashMessage): string { - return self::$icons[$this->getSeverityAsInt($flashMessage)]; + return $flashMessage->getSeverity()->getIconIdentifier(); } /** @@ -127,7 +83,7 @@ protected function getIconName(FlashMessage $flashMessage): string */ protected function getMessageAsMarkup(array $flashMessages): string { - // \TYPO3\CMS\Core\Messaging\FlashMessage::getMessageAsMarkup() uses htmlspecialchars() + // \TYPO3\CMS\Core\Messaging\Renderer\BootstrapRenderer::render() uses htmlspecialchars() // on all messages, but we have messages with HTML tags. Therefore we copy the official // implementation and remove the htmlspecialchars() call on the message body. $markup = []; @@ -135,16 +91,10 @@ protected function getMessageAsMarkup(array $flashMessages): string foreach ($flashMessages as $flashMessage) { $messageTitle = $flashMessage->getTitle(); $markup[] = '
'; - $markup[] = '
'; - $markup[] = '
'; - $markup[] = ' '; - $markup[] = ' '; - $markup[] = ' '; - $markup[] = ' '; - $markup[] = '
'; - $markup[] = '
'; + $markup[] = '
'; + $markup[] = '
'; if ($messageTitle !== '') { - $markup[] = '

' . htmlspecialchars($messageTitle) . '

'; + $markup[] = '
' . htmlspecialchars($messageTitle) . '
'; } $markup[] = '

' . $flashMessage->getMessage() . '

'; $markup[] = '
'; diff --git a/Classes/Common/MetsDocument.php b/Classes/Common/MetsDocument.php index 73d700c8b2..863eea53ad 100644 --- a/Classes/Common/MetsDocument.php +++ b/Classes/Common/MetsDocument.php @@ -226,18 +226,18 @@ protected function establishRecordId(int $pid): void public function getDownloadLocation(string $id): string { $file = $this->getFileInfo($id); - if ($file['mimeType'] === 'application/vnd.kitodo.iiif') { + if (!empty($file) && $file['mimeType'] === 'application/vnd.kitodo.iiif') { $file['location'] = (strrpos($file['location'], 'info.json') === strlen($file['location']) - 9) ? $file['location'] : (strrpos($file['location'], '/') === strlen($file['location']) ? $file['location'] . 'info.json' : $file['location'] . '/info.json'); $service = self::loadIiifResource($file['location']); if ($service instanceof AbstractImageService) { return $service->getImageUrl(); } - } elseif ($file['mimeType'] === 'application/vnd.netfpx') { + } elseif (!empty($file) && $file['mimeType'] === 'application/vnd.netfpx') { $baseURL = $file['location'] . (str_contains($file['location'], '?') ? '' : '?'); // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server' return $baseURL . '&CVT=jpeg'; } - return $file['location']; + return $file['location'] ?? null; } /** @@ -1028,7 +1028,7 @@ private function getAdditionalMetadataFromDatabase(string $dmdId): array $queryBuilder->expr()->eq('tx_dlf_metadataformat_joins.pid', $this->configPid), $queryBuilder->expr()->eq('tx_dlf_formats_joins.type', $queryBuilder->createNamedParameter($this->mdSec[$dmdId]['type'])) ) - ->execute(); + ->executeQuery(); // Get all metadata without a format, but with a default value next. $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) ->getQueryBuilderForTable('tx_dlf_metadata'); @@ -1050,7 +1050,7 @@ private function getAdditionalMetadataFromDatabase(string $dmdId): array $queryBuilder->expr()->eq('format', 0), $queryBuilder->expr()->neq('default_value', $queryBuilder->createNamedParameter('')) ) - ->execute(); + ->executeQuery(); // Merge both result sets. $allResults = array_merge($resultWithFormat->fetchAllAssociative(), $resultWithoutFormat->fetchAllAssociative()); @@ -1094,8 +1094,8 @@ private function getAdditionalMetadataFromDatabase(string $dmdId): array $queryBuilder->expr()->eq('tx_dlf_subentries_joins.pid', $this->configPid) ) ->orderBy('tx_dlf_subentries_joins.sorting') - ->execute(); - $subentriesResult = $subentries->fetchAll(); + ->executeQuery(); + $subentriesResult = $subentries->fetchAllAssociative(); return array_merge($allResults, ['subentries' => $subentriesResult]); } @@ -1173,7 +1173,7 @@ public function getFullText(string $id): string if ($this->hasFulltext) { $useGroups = $this->useGroupsConfiguration->getFulltext(); - $physicalStructureNode = $this->physicalStructureInfo[$id]; + $physicalStructureNode = $this->physicalStructureInfo[$id] ?? null; $fileLocations = []; if (!empty($physicalStructureNode)) { @@ -1637,7 +1637,7 @@ protected function magicGetThumbnail(): string Helper::whereExpression('tx_dlf_structures') ) ->setMaxResults(1) - ->execute(); + ->executeQUery(); $allResults = $result->fetchAllAssociative(); diff --git a/Classes/Common/Solr/Solr.php b/Classes/Common/Solr/Solr.php index 8fafb4457a..19916865ae 100644 --- a/Classes/Common/Solr/Solr.php +++ b/Classes/Common/Solr/Solr.php @@ -208,13 +208,13 @@ public static function escapeQueryKeepField(string $query, int $pid): string ->where( $queryBuilder->expr()->eq('index_indexed', 1), $queryBuilder->expr()->eq('pid', (int) $pid), - $queryBuilder->expr()->orX( + $queryBuilder->expr()->or( $queryBuilder->expr()->in('sys_language_uid', [-1, 0]), $queryBuilder->expr()->eq('l18n_parent', 0) ), Helper::whereExpression('tx_dlf_metadata') ) - ->execute(); + ->executeQuery(); while ($resArray = $result->fetchAssociative()) { $fields[] = $resArray['index_name'] . '_' . ($resArray['index_tokenized'] ? 't' : 'u') . ($resArray['index_stored'] ? 's' : 'u') . 'i'; @@ -256,7 +256,7 @@ public static function getFields(): array self::$fields['type'] = $solrFields['type']; self::$fields['title'] = $solrFields['title']; self::$fields['volume'] = $solrFields['volume']; - self::$fields['date'] = $solrFields['date']; + self::$fields['date'] = $solrFields['date'] ?? null; self::$fields['thumbnail'] = $solrFields['thumbnail']; self::$fields['default'] = $solrFields['default']; self::$fields['timestamp'] = $solrFields['timestamp']; @@ -356,19 +356,19 @@ protected function loadSolrConnectionInfo(): void // Derive Solr host name. $config['host'] = ($conf['host'] ? $conf['host'] : '127.0.0.1'); // Set username and password. - $config['username'] = $conf['user']; - $config['password'] = $conf['pass']; + $config['username'] = $conf['user'] ?? null; + $config['password'] = $conf['pass'] ?? null; // Set port if not set. - $config['port'] = MathUtility::forceIntegerInRange($conf['port'], 1, 65535, 8983); + $config['port'] = MathUtility::forceIntegerInRange($conf['port'] ?? null, 1, 65535, 8983); // Trim path of slashes and (re-)add trailing slash if path not empty. - $config['path'] = trim($conf['path'], '/'); + $config['path'] = trim($conf['path'] ?? '', '/'); if (!empty($config['path'])) { $config['path'] .= '/'; } // Set connection timeout lower than PHP's max_execution_time. $maxExecutionTime = (int) ini_get('max_execution_time') ? : 30; - $config['timeout'] = MathUtility::forceIntegerInRange($conf['timeout'], 1, $maxExecutionTime, 10); + $config['timeout'] = MathUtility::forceIntegerInRange($conf['timeout'] ?? null, 1, $maxExecutionTime, 10); $this->config = $config; } } diff --git a/Classes/Common/Solr/SolrSearch.php b/Classes/Common/Solr/SolrSearch.php index 8066582504..bb3ff083a7 100644 --- a/Classes/Common/Solr/SolrSearch.php +++ b/Classes/Common/Solr/SolrSearch.php @@ -57,15 +57,15 @@ class SolrSearch implements \Countable, \Iterator, \ArrayAccess, QueryResultInte /** * @access private - * @var QueryResult|null + * @var QueryResultInterface|null */ - private ?QueryResult $listedMetadata; + private ?QueryResultInterface $listedMetadata; /** * @access private - * @var QueryResult|null + * @var QueryResultInterface|null */ - private ?QueryResult $indexedMetadata; + private ?QueryResultInterface $indexedMetadata; /** * @access private @@ -94,13 +94,19 @@ class SolrSearch implements \Countable, \Iterator, \ArrayAccess, QueryResultInte * @param array|QueryResultInterface $collections can contain 0, 1 or many Collection objects * @param array $settings * @param array $searchParams - * @param QueryResult $listedMetadata - * @param QueryResult $indexedMetadata + * @param QueryResultInterface|null $listedMetadata + * @param QueryResultInterface|null $indexedMetadata * * @return void */ - public function __construct(DocumentRepository $documentRepository, $collections, array $settings, array $searchParams, ?QueryResult $listedMetadata = null, ?QueryResult $indexedMetadata = null) - { + public function __construct( + DocumentRepository $documentRepository, + array|QueryResultInterface $collections, + array $settings = [], + array $searchParams = [], + ?QueryResultInterface $listedMetadata = null, + ?QueryResultInterface $indexedMetadata = null + ) { $this->documentRepository = $documentRepository; $this->collections = $collections; $this->settings = $settings; @@ -206,7 +212,7 @@ public function valid(): bool */ public function offsetExists($offset): bool { - $idx = $this->result['document_keys'][$offset]; + $idx = $this->result['document_keys'][$offset] ?? null; return isset($this->result['documents'][$idx]); } @@ -222,7 +228,7 @@ public function offsetExists($offset): bool #[\ReturnTypeWillChange] public function offsetGet($offset) { - $idx = $this->result['document_keys'][$offset]; + $idx = $this->result['document_keys'][$offset] ?? null; $document = $this->result['documents'][$idx] ?? null; if ($document !== null) { @@ -485,6 +491,7 @@ public function prepare() if ($this->listedMetadata) { foreach ($this->listedMetadata as $metadata) { + /** @var \Kitodo\Dlf\Domain\Model\Metadata $metadata */ if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) { $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u'); $params['fields'] .= ',' . $listMetadataRecord; @@ -638,6 +645,7 @@ protected function fetchToplevelMetadataFromSolr(array $queryParams): array if ($this->listedMetadata) { foreach ($this->listedMetadata as $metadata) { + /** @var \Kitodo\Dlf\Domain\Model\Metadata $metadata */ if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) { $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u'); $params['fields'] .= ',' . $listMetadataRecord; @@ -653,7 +661,7 @@ protected function fetchToplevelMetadataFromSolr(array $queryParams): array foreach ($result['documents'] as $doc) { $this->translateLanguageCode($doc); - $metadataArray[$doc['uid']] = $doc['metadata']; + $metadataArray[$doc['uid']] = $doc['metadata'] ?? null; } return $metadataArray; @@ -708,6 +716,7 @@ protected function searchSolr($parameters = [], $enableCache = true) if ($this->indexedMetadata) { foreach ($this->indexedMetadata as $metadata) { + /** @var \Kitodo\Dlf\Domain\Model\Metadata $metadata */ if ($metadata->getIndexIndexed()) { $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . 'i'; $queryFields .= $listMetadataRecord . '^' . $metadata->getIndexBoost() . ' '; @@ -905,7 +914,7 @@ private function getDocument(Document $record, array $highlighting, array $field */ private function translateLanguageCode(&$doc): void { - if (is_array($doc['metadata']) && array_key_exists('language', $doc['metadata'])) { + if (is_array($doc['metadata'] ?? null) && array_key_exists('language', $doc['metadata'])) { foreach($doc['metadata']['language'] as $indexName => $language) { $doc['metadata']['language'][$indexName] = Helper::getLanguageName($language); } diff --git a/Classes/Common/Solr/SolrSearchQuery.php b/Classes/Common/Solr/SolrSearchQuery.php index f1da660785..c47d59678d 100644 --- a/Classes/Common/Solr/SolrSearchQuery.php +++ b/Classes/Common/Solr/SolrSearchQuery.php @@ -33,7 +33,7 @@ class SolrSearchQuery extends Query * * @return void */ - public function __construct($solrSearch) + public function __construct(SolrSearch $solrSearch) { $this->solrSearch = $solrSearch; @@ -51,7 +51,6 @@ public function __construct($solrSearch) * @return array */ // TODO: Return type (array) of method SolrSearchQuery::execute() should be compatible with return type (iterable&TYPO3\CMS\Extbase\Persistence\QueryResultInterface) of method TYPO3\CMS\Extbase\Persistence\QueryInterface::execute() - // @phpstan-ignore-next-line public function execute($returnRawQueryResult = false) { $this->solrSearch->submit($this->offset, $this->limit); diff --git a/Classes/Common/StdOutStream.php b/Classes/Common/StdOutStream.php index 2a12b674fd..3467d4f278 100644 --- a/Classes/Common/StdOutStream.php +++ b/Classes/Common/StdOutStream.php @@ -28,6 +28,13 @@ class StdOutStream implements StreamInterface, SelfEmittableStreamInterface { use StreamDecoratorTrait; + /** + * Constructor + */ + public function __construct(protected readonly StreamInterface $stream) + { + } + /** * @access public * diff --git a/Classes/Common/TypoScriptHelper.php b/Classes/Common/TypoScriptHelper.php new file mode 100644 index 0000000000..2a010e1a15 --- /dev/null +++ b/Classes/Common/TypoScriptHelper.php @@ -0,0 +1,149 @@ + + * + * This file is part of the Kitodo and TYPO3 projects. + * + * @license GNU General Public License version 3 or later. + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + */ + +namespace Kitodo\Dlf\Common; + +use Psr\Container\ContainerInterface; +use Psr\EventDispatcher\EventDispatcherInterface; +use TYPO3\CMS\Core\Context\Context; +use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\CMS\Core\Information\Typo3Version; +use TYPO3\CMS\Core\Routing\PageArguments; +use TYPO3\CMS\Core\Site\SiteFinder; +use TYPO3\CMS\Core\TypoScript\IncludeTree\SysTemplateRepository; +use TYPO3\CMS\Core\TypoScript\IncludeTree\SysTemplateTreeBuilder; +use TYPO3\CMS\Core\TypoScript\IncludeTree\Traverser\ConditionVerdictAwareIncludeTreeTraverser; +use TYPO3\CMS\Core\TypoScript\IncludeTree\Traverser\IncludeTreeTraverser; +use TYPO3\CMS\Core\TypoScript\Tokenizer\LossyTokenizer; +use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Core\Utility\RootlineUtility; +use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication; +use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; + +/** + * Helper class that allows to access TypoScript from backend. + */ +class TypoScriptHelper +{ + public function __construct( + private readonly ContainerInterface $container, + private readonly EventDispatcherInterface $eventDispatcher, + private readonly SysTemplateTreeBuilder $treeBuilder, + private readonly LossyTokenizer $tokenizer, + private readonly IncludeTreeTraverser $includeTreeTraverser, + private readonly ConditionVerdictAwareIncludeTreeTraverser $includeConditionVerdictAware, + private readonly SysTemplateRepository $sysTemplateRepository, + ) { + // empty + } + + /** + * Extract typoScript configuration from site root for Typo3 v13 + * + * @access public + * + * @param int $pid + * + * @return array + */ + public function getTyposcriptConfigV13(int $pid): array + { + $siteFinder = GeneralUtility::makeInstance(SiteFinder::class); + $site = $siteFinder->getSiteByPageId($pid); + + $rootLine = GeneralUtility::makeInstance(RootlineUtility::class, $pid)->get(); + $sysTemplateRows = $this->sysTemplateRepository->getSysTemplateRowsByRootline($rootLine); + + $frontendTypoScriptFactory = GeneralUtility::makeInstance( + \TYPO3\CMS\Core\TypoScript\FrontendTypoScriptFactory::class, + $this->container, + $this->eventDispatcher, + $this->treeBuilder, + $this->tokenizer, + $this->includeTreeTraverser, + $this->includeConditionVerdictAware, + ); + + $frontendTypoScript = $frontendTypoScriptFactory->createSettingsAndSetupConditions( + $site, + $sysTemplateRows, + [], + null, + ); + + $ts = $frontendTypoScriptFactory->createSetupConfigOrFullSetup( + true, + $frontendTypoScript, + $site, + $sysTemplateRows, + [], + '0', + null, + null, + ); + + return $ts->getSetupArray(); + } + + /** + * Extract typoScript configuration from site root for Typo3 v12 + * + * @access public + * + * @param int $pid page id + * + * @return array typoscript configuration of site root + */ + public static function getTyposcriptConfigV12(int $pid): array + { + $siteFinder = GeneralUtility::makeInstance(SiteFinder::class); + $site = $siteFinder->getSiteByPageId($pid); + $rootLine = GeneralUtility::makeInstance(RootlineUtility::class, $pid)->get(); + + $typoScriptFrontendController = GeneralUtility::makeInstance( + TypoScriptFrontendController::class, + GeneralUtility::makeInstance(Context::class), + $site, + $site->getDefaultLanguage(), + GeneralUtility::makeInstance(PageArguments::class, $pid, '', []), + GeneralUtility::makeInstance(FrontendUserAuthentication::class), + ); + + $typoScriptFrontendController->rootLine = $rootLine; + $request = new ServerRequest(); + $request = $typoScriptFrontendController->getFromCache($request); + $typoScriptFrontendController->releaseLocks(); + + return $request->getAttribute('frontend.typoscript')->getSetupArray(); + } + + /** + * Get TypoScript configuration from site root + * + * Note: When upgrading Typo3, maybe use site settings to store storagePid, see: + * https://docs.typo3.org/permalink/t3coreapi:sitehandling-settings + * + * @access public + * + * @param int $pid page id + * + * @return array typoscript configuration of site root + */ + public static function getTyposcriptConfig(int $pid): array + { + $typo3Version = (new Typo3Version())->getMajorVersion(); + if ($typo3Version === 13) { + return GeneralUtility::makeInstance(TypoScriptHelper::class)->getTyposcriptConfigV13($pid); + } + return TypoScriptHelper::getTyposcriptConfigV12($pid); + } +} diff --git a/Classes/Controller/AbstractController.php b/Classes/Controller/AbstractController.php index 137ef08254..1cd79b9b2c 100644 --- a/Classes/Controller/AbstractController.php +++ b/Classes/Controller/AbstractController.php @@ -121,7 +121,7 @@ protected function initialize(RequestInterface $request): void { /** @var Request $request */ $this->requestData = $request->getQueryParams()['tx_dlf'] ?? []; - $this->pageUid = (int) GeneralUtility::_GET('id'); + $this->pageUid = (int) ($request->getQueryParams()['id'] ?? null); $this->requestData['page'] = $this->requestData['page'] ?? 1; // Sanitize user input to prevent XSS attacks. @@ -225,7 +225,7 @@ protected function loadDocument(string $documentId = ''): void } elseif (!empty($this->requestData['recordId'])) { - $this->document = $this->documentRepository->findOneByRecordId($this->requestData['recordId']); + $this->document = $this->documentRepository->findOneBy(['recordId' => $this->requestData['recordId']]); if ($this->document !== null) { $doc = AbstractDocument::getInstance($this->document->getLocation(), $this->settings); @@ -730,7 +730,7 @@ protected function getDocumentByUrl(string $documentUrl) if ($doc->recordId) { // find document from repository by recordId - $docFromRepository = $this->documentRepository->findOneByRecordId($doc->recordId); + $docFromRepository = $this->documentRepository->findOneBy(['recordId' => $doc->recordId]); if ($docFromRepository !== null) { $this->document = $docFromRepository; } diff --git a/Classes/Controller/Backend/NewTenantController.php b/Classes/Controller/Backend/NewTenantController.php index 96e4f53b52..fff5746e3f 100644 --- a/Classes/Controller/Backend/NewTenantController.php +++ b/Classes/Controller/Backend/NewTenantController.php @@ -148,20 +148,24 @@ public function injectSolrCoreRepository(SolrCoreRepository $solrCoreRepository) * * @access protected * - * @param ?string $html optional html + * @param bool $isError whether to render the non-error or error template + * + * @param array $extraData extra view data used to render the template (in addition to $viewData of AbstractController) * * @return ResponseInterface the response */ - protected function htmlResponse(?string $html = null): ResponseInterface + protected function templateResponse(bool $isError, array $extraData): ResponseInterface { $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class); $messageQueue = $flashMessageService->getMessageQueueByIdentifier(); $moduleTemplateFactory = GeneralUtility::makeInstance(ModuleTemplateFactory::class); $moduleTemplate = $moduleTemplateFactory->create($this->request); - $moduleTemplate->setContent($this->view->render()); + $moduleTemplate->assignMultiple($this->viewData); + $moduleTemplate->assignMultiple($extraData); $moduleTemplate->setFlashMessageQueue($messageQueue); - return parent::htmlResponse(($html ?? $moduleTemplate->renderContent())); + $template = $isError ? 'Backend/NewTenant/Error' : 'Backend/NewTenant/Index'; + return $moduleTemplate->renderResponse($template); } /** @@ -173,8 +177,7 @@ protected function htmlResponse(?string $html = null): ResponseInterface */ protected function initializeAction(): void { - // replace with $this->request->getQueryParams() when dropping support for Typo3 v11, see Deprecation-100596 - $this->pid = (int) GeneralUtility::_GP('id'); + $this->pid = (int) ($this->request->getQueryParams()['id'] ?? null); $frameworkConfiguration = $this->configurationManager->getConfiguration($this->configurationManager::CONFIGURATION_TYPE_FRAMEWORK); $frameworkConfiguration['persistence']['storagePid'] = $this->pid; @@ -207,7 +210,7 @@ public function addFormatAction(): ResponseInterface foreach ($formatsDefaults as $type => $values) { // if default format record is not found, add it to the repository - if ($this->formatRepository->findOneByType($type) === null) { + if ($this->formatRepository->findOneBy(['type' => $type]) === null) { $newRecord = GeneralUtility::makeInstance(Format::class); $newRecord->setType($type); $newRecord->setRoot($values['root']); @@ -286,6 +289,7 @@ public function addMetadataAction(): ResponseInterface $insertedMetadata = []; foreach ($metadataIds as $id => $uid) { + /** @var \Kitodo\Dlf\Domain\Model\Metadata $metadata */ $metadata = $this->metadataRepository->findByUid($uid); // id array contains also ids of formats if ($metadata != null) { @@ -329,7 +333,7 @@ public function addSolrCoreAction(): ResponseInterface // load language file in own array $beLabels = $this->languageFactory->getParsedData('EXT:dlf/Resources/Private/Language/locallang_be.xlf', $this->siteLanguages[0]->getTypo3Language()); - if ($this->solrCoreRepository->findOneByPid($this->pid) === null) { + if ($this->solrCoreRepository->findOneBy(['pid' => $this->pid]) === null) { $newRecord = GeneralUtility::makeInstance(SolrCore::class); $newRecord->setLabel($this->getLLL('flexform.solrcore', $this->siteLanguages[0]->getTypo3Language(), $beLabels). ' (PID ' . $this->pid . ')'); $indexName = Solr::createCore(''); @@ -381,7 +385,9 @@ public function addStructureAction(): ResponseInterface $insertedStructures = []; foreach ($structureIds as $id => $uid) { - $insertedStructures[$uid] = $this->structureRepository->findByUid($uid)->getIndexName(); + /** @var \Kitodo\Dlf\Domain\Model\Structure $structure */ + $structure = $this->structureRepository->findByUid($uid); + $insertedStructures[$uid] = $structure->getIndexName(); } foreach ($this->siteLanguages as $siteLanguage) { @@ -428,18 +434,18 @@ public function indexAction(): ResponseInterface $recordInfos['formats']['numDefault'] = count($formatsDefaults); $structuresDefaults = $this->getRecords('Structure'); - $recordInfos['structures']['numCurrent'] = $this->structureRepository->countByPid($this->pid); + $recordInfos['structures']['numCurrent'] = $this->structureRepository->count(['pid' => $this->pid]); $recordInfos['structures']['numDefault'] = count($structuresDefaults); $metadataDefaults = $this->getRecords('Metadata'); - $recordInfos['metadata']['numCurrent'] = $this->metadataRepository->countByPid($this->pid); + $recordInfos['metadata']['numCurrent'] = $this->metadataRepository->count(['pid' => $this->pid]); $recordInfos['metadata']['numDefault'] = count($metadataDefaults); - $recordInfos['solrcore']['numCurrent'] = $this->solrCoreRepository->countByPid($this->pid); + $recordInfos['solrcore']['numCurrent'] = $this->solrCoreRepository->count(['pid' => $this->pid]); - $this->view->assign('recordInfos', $recordInfos); + $viewData = ['recordInfos' => $recordInfos]; - return $this->htmlResponse(); + return $this->templateResponse(false, $viewData); } /** @@ -452,7 +458,7 @@ public function indexAction(): ResponseInterface // @phpstan-ignore-next-line public function errorAction(): ResponseInterface { - return $this->htmlResponse(); + return $this->templateResponse(true, []); } /** diff --git a/Classes/Controller/BasketController.php b/Classes/Controller/BasketController.php index 0c6e90ac61..54eaf4a963 100644 --- a/Classes/Controller/BasketController.php +++ b/Classes/Controller/BasketController.php @@ -20,6 +20,7 @@ use Kitodo\Dlf\Domain\Repository\BasketRepository; use Kitodo\Dlf\Domain\Repository\PrinterRepository; use Psr\Http\Message\ResponseInterface; +use Symfony\Component\Mime\Address; use TYPO3\CMS\Core\Mail\MailMessage; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\MailUtility; @@ -239,19 +240,20 @@ public function mainAction(): ResponseInterface protected function getBasketData(): Basket { // get user session - $userSession = $GLOBALS['TSFE']->fe_user->getSession(); + $feUser = $this->request->getAttribute('frontend.user'); + $userSession = $feUser->getSession(); // Checking if a user is logged in $userIsLoggedIn = $this->isUserLoggedIn(); if ($userIsLoggedIn) { - $basket = $this->basketRepository->findOneByFeUserId((int) $GLOBALS['TSFE']->fe_user->user['uid']); + $basket = $this->basketRepository->findOneBy(['feUserId' => (int) $feUser->getUserId()]); } else { $userSession->set('ses', 'tx_dlf_basket', ''); $userSession->dataWasUpdated(); - $GLOBALS['TSFE']->fe_user->storeSessionData(); + $feUser->storeSessionData(); - $basket = $this->basketRepository->findOneBySessionId($userSession->getIdentifier()); + $basket = $this->basketRepository->findOneBy(['sessionId' => $userSession->getIdentifier()]); } // session does not exist @@ -259,7 +261,7 @@ protected function getBasketData(): Basket // create new basket in db $basket = GeneralUtility::makeInstance(Basket::class); $basket->setSessionId($userSession->getIdentifier()); - $basket->setFeUserId($userIsLoggedIn ? $GLOBALS['TSFE']->fe_user->user['uid'] : 0); + $basket->setFeUserId($userIsLoggedIn ? $feUser->getUserId() : 0); } return $basket; @@ -553,7 +555,8 @@ protected function sendMail(): void // send mail $mailId = $this->requestData['mail_action']; - $mailObject = $this->mailRepository->findByUid(intval($mailId))->getFirst(); + /** @var \Kitodo\Dlf\Domain\Model\Mail $mailObject */ + $mailObject = $this->mailRepository->findByUid((int) $mailId); $mailText = htmlspecialchars(LocalizationUtility::translate('basket.mailBody', 'dlf')) . "\n"; $numberOfPages = 0; @@ -589,12 +592,12 @@ protected function sendMail(): void // Prepare and send the message $mail // subject - ->setSubject(LocalizationUtility::translate('basket.mailSubject', 'dlf')) + ->subject(LocalizationUtility::translate('basket.mailSubject', 'dlf')) // Set the From address with an associative array ->setFrom($from) // Set the To addresses with an associative array - ->setTo([$mailObject->getMail() => $mailObject->getName()]) - ->setBody($mailBody, 'text/html') + ->to(new Address($mailObject->getMail(), $mailObject->getName())) + ->html($mailBody) ->send(); // create entry for action log @@ -638,7 +641,7 @@ protected function printDocument(): void $printerId = $this->requestData['print_action']; // get id from db and send selected doc download link - $printer = $this->printerRepository->findOneByUid($printerId); + $printer = $this->printerRepository->findOneBy(['uid' => $printerId]); // printer is selected if ($printer) { diff --git a/Classes/Controller/CalendarController.php b/Classes/Controller/CalendarController.php index 95381164d9..eeb948de5d 100644 --- a/Classes/Controller/CalendarController.php +++ b/Classes/Controller/CalendarController.php @@ -159,7 +159,10 @@ public function yearsAction(): ResponseInterface } // Get all children of anchor. This should be the year anchor documents - $documents = $this->documentRepository->getChildrenOfYearAnchor($this->document->getUid(), $this->structureRepository->findOneByIndexName('year')); + $documents = $this->documentRepository->getChildrenOfYearAnchor( + $this->document->getUid(), + $this->structureRepository->findOneBy(['indexName' => 'year']) + ); $years = []; // Process results. @@ -452,7 +455,10 @@ private function getIssuesByYear(): array */ private function getIssues(): Generator { - $documents = $this->documentRepository->getChildrenOfYearAnchor($this->document->getUid(), $this->structureRepository->findOneByIndexName('issue')); + $documents = $this->documentRepository->getChildrenOfYearAnchor( + $this->document->getUid(), + $this->structureRepository->findOneBy(['indexName' => 'issue']) + ); // Process results. if ($documents->count() === 0) { diff --git a/Classes/Controller/CollectionController.php b/Classes/Controller/CollectionController.php index 1479571164..fb3efa6ccb 100644 --- a/Classes/Controller/CollectionController.php +++ b/Classes/Controller/CollectionController.php @@ -151,13 +151,13 @@ public function showAction(Collection $collection): ResponseInterface } // get all metadata records to be shown in results - $listedMetadata = $this->metadataRepository->findByIsListed(true); + $listedMetadata = $this->metadataRepository->findBy(['isListed' => true]); // get all indexed metadata fields - $indexedMetadata = $this->metadataRepository->findByIndexIndexed(true); + $indexedMetadata = $this->metadataRepository->findBy(['indexIndexed' => true]); // get all sortable metadata records - $sortableMetadata = $this->metadataRepository->findByIsSortable(true); + $sortableMetadata = $this->metadataRepository->findBy(['isSortable' => true]); // get all documents of given collection $solrResults = null; diff --git a/Classes/Controller/ListViewController.php b/Classes/Controller/ListViewController.php index 8de90884a8..a30c09334f 100644 --- a/Classes/Controller/ListViewController.php +++ b/Classes/Controller/ListViewController.php @@ -93,13 +93,13 @@ public function mainAction(): ResponseInterface $currentPage = $this->requestData['page'] ?? 1; // get all sortable metadata records - $sortableMetadata = $this->metadataRepository->findByIsSortable(true); + $sortableMetadata = $this->metadataRepository->findBy(['isSortable' => true]); // get all metadata records to be shown in results - $listedMetadata = $this->metadataRepository->findByIsListed(true); + $listedMetadata = $this->metadataRepository->findBy(['isListed' => true]); // get all indexed metadata fields - $indexedMetadata = $this->metadataRepository->findByIndexIndexed(true); + $indexedMetadata = $this->metadataRepository->findBy(['indexIndexed' => true]); $solrResults = null; $numResults = 0; diff --git a/Classes/Controller/MetadataController.php b/Classes/Controller/MetadataController.php index 32a306df03..d75e0c8b99 100644 --- a/Classes/Controller/MetadataController.php +++ b/Classes/Controller/MetadataController.php @@ -447,7 +447,7 @@ private function parseOwner(int $i, array &$metadata) : void */ private function parseType(int $i, array &$metadata) : void { - $structure = $this->structureRepository->findOneByIndexName($metadata[$i]['type'][0]); + $structure = $this->structureRepository->findOneBy(['indexName' => $metadata[$i]['type'][0]]); if ($structure) { $metadata[$i]['type'][0] = $structure->getLabel(); } @@ -468,7 +468,7 @@ private function parseCollections(int $i, $value, array &$metadata) : void { $j = 0; foreach ($value as $entry) { - $collection = $this->collectionRepository->findOneByIndexName($entry); + $collection = $this->collectionRepository->findOneBy(['indexName' => $entry]); if ($collection) { $metadata[$i]['collection'][$j] = $collection->getLabel() ? : ''; $j++; diff --git a/Classes/Controller/NavigationController.php b/Classes/Controller/NavigationController.php index 9723754b22..16b2258fcd 100644 --- a/Classes/Controller/NavigationController.php +++ b/Classes/Controller/NavigationController.php @@ -101,7 +101,7 @@ public function mainAction(): ResponseInterface $this->view->assign('numPages', $this->document->getCurrentDocument()->numPages); $this->view->assign('viewData', $this->viewData); - $searchSessionParameters = $GLOBALS['TSFE']->fe_user->getKey('ses', 'search'); + $searchSessionParameters = $this->request->getAttribute('frontend.user')->getKey('ses', 'search'); if ($searchSessionParameters) { $lastSearchArguments = [ 'tx_dlf_listview' => [ diff --git a/Classes/Controller/OaiPmhController.php b/Classes/Controller/OaiPmhController.php index b7485cda57..c2ea2eacc9 100644 --- a/Classes/Controller/OaiPmhController.php +++ b/Classes/Controller/OaiPmhController.php @@ -11,6 +11,7 @@ namespace Kitodo\Dlf\Controller; +use DateTime; use DOMDocument; use TYPO3\CMS\Core\Utility\GeneralUtility; use Kitodo\Dlf\Common\Solr\Solr; @@ -19,6 +20,7 @@ use Kitodo\Dlf\Domain\Repository\LibraryRepository; use Kitodo\Dlf\Domain\Repository\TokenRepository; use Psr\Http\Message\ResponseInterface; +use TYPO3\CMS\Extbase\Mvc\RequestInterface; /** * Controller class for the plugin 'OAI-PMH Interface'. @@ -91,7 +93,7 @@ public function injectLibraryRepository(LibraryRepository $libraryRepository) * * @return void */ - public function initializeAction() + public function initializeAction(): void { $this->request = $this->request->withFormat("xml"); } @@ -147,10 +149,11 @@ protected function deleteExpiredTokens() * Load URL parameters * * @access protected + * @param RequestInterface $request the HTTP request * * @return void */ - protected function getUrlParams() + protected function getUrlParams(RequestInterface $request) { $allowedParams = [ 'verb', @@ -165,9 +168,8 @@ protected function getUrlParams() $this->parameters = []; // Set only allowed parameters. foreach ($allowedParams as $param) { - // replace with $this->request->getQueryParams() when dropping support for Typo3 v11, see Deprecation-100596 - if (GeneralUtility::_GP($param)) { - $this->parameters[$param] = GeneralUtility::_GP($param); + if ($request->getQueryParams()[$param] ?? null) { + $this->parameters[$param] = $request->getQueryParams()[$param]; } } } @@ -199,7 +201,7 @@ private function getDublinCoreData(array $record) $record[] = ['dc:format' => $record['application/mets+xml'] ?? '']; $record[] = ['dc:type' => $record['Text'] ?? '']; if (!empty($record['partof'])) { - $document = $this->documentRepository->findOneByPartof($metadata['partof'] ?? ''); + $document = $this->documentRepository->findOneBy(['partof' => $metadata['partof'] ?? '']); if ($document) { $metadata[] = ['dc:relation' => $document->getRecordId()]; @@ -271,7 +273,7 @@ protected function getMetsData(array $record) public function mainAction(): ResponseInterface { // Get allowed GET and POST variables. - $this->getUrlParams(); + $this->getUrlParams($this->request); // Delete expired resumption tokens. $this->deleteExpiredTokens(); @@ -315,7 +317,7 @@ public function mainAction(): ResponseInterface */ protected function resume(): ?array { - $token = $this->tokenRepository->findOneByToken($this->parameters['resumptionToken']); + $token = $this->tokenRepository->findOneBy(['token' => $this->parameters['resumptionToken']]); if ($token) { $options = $token->getOptions(); @@ -490,7 +492,7 @@ protected function verbListMetadataFormats() $resArray = []; // check for the optional "identifier" parameter if (isset($this->parameters['identifier'])) { - $resArray = $this->documentRepository->findOneByRecordId($this->parameters['identifier']); + $resArray = $this->documentRepository->findOneBy(['recordId' => $this->parameters['identifier']]); } $resultSet = []; @@ -679,9 +681,9 @@ private function getFrom(): string // Check "from" for valid value. if (!empty($this->parameters['from'])) { // Is valid format? - $date = $this->getDate('from'); - if (is_array($date)) { - $from = $this->getDateFromTimestamp($date, '.000Z'); + $date = $this->getDateTimeFromParameter('from'); + if ($date) { + $from = $this->dateTimeToString($date, '.000Z'); } else { $this->error = 'badArgument'; } @@ -704,9 +706,9 @@ private function getUntil(string $from): string // Check "until" for valid value. if (!empty($this->parameters['until'])) { // Is valid format? - $date = $this->getDate('until'); - if (is_array($date)) { - $until = $this->getDateFromTimestamp($date, '.999Z'); + $date = $this->getDateTimeFromParameter('until'); + if ($date) { + $until = $this->dateTimeToString($date, '.999Z'); if ($from != "*" && $from > $until) { $this->error = 'badArgument'; } @@ -724,11 +726,12 @@ private function getUntil(string $from): string * * @param string $dateType * - * @return array|false + * @return DateTime|false */ - private function getDate(string $dateType) + private function getDateTimeFromParameter(string $dateType) { - return strptime($this->parameters[$dateType], '%Y-%m-%dT%H:%M:%SZ') ?: strptime($this->parameters[$dateType], '%Y-%m-%d'); + return DateTime::createFromFormat('Y-m-d\TH:i:s\Z', $this->parameters[$dateType]) + ?: DateTime::createFromFormat('Y-m-d', $this->parameters[$dateType]); } /** @@ -741,17 +744,9 @@ private function getDate(string $dateType) * * @return string */ - private function getDateFromTimestamp(array $date, string $end): string + private function dateTimeToString(DateTime $date, string $end): string { - $timestamp = gmmktime( - $date['tm_hour'], - $date['tm_min'], - $date['tm_sec'], - $date['tm_mon'] + 1, - $date['tm_mday'], - $date['tm_year'] + 1900 - ); - return date("Y-m-d", $timestamp) . 'T' . date("H:i:s", $timestamp) . $end; + return $date->format('Y-m-d') . 'T' . $date->format("H:i:s") . $end; } /** diff --git a/Classes/Controller/SearchController.php b/Classes/Controller/SearchController.php index 58800b0a8a..830c256608 100644 --- a/Classes/Controller/SearchController.php +++ b/Classes/Controller/SearchController.php @@ -121,8 +121,7 @@ public function mainAction(): ResponseInterface $this->search = $this->getParametersSafely('search'); // if search was triggered by the ListView plugin, get the parameters from GET variables - // replace with $this->request->getQueryParams() when dropping support for Typo3 v11, see Deprecation-100596 - $listRequestData = GeneralUtility::_GPmerged('tx_dlf_listview'); + $listRequestData = $this->request->getQueryParams()['tx_dlf_listview'] ?? null; // Quit without doing anything if no search parameters. if (empty($this->search) && empty($listRequestData)) { $this->logger->warning('Missing search parameters'); @@ -132,7 +131,7 @@ public function mainAction(): ResponseInterface if (isset($listRequestData['search']) && is_array($listRequestData['search'])) { $this->search = array_merge($this->search ?: [], $listRequestData['search']); $listViewSearch = true; - $GLOBALS['TSFE']->fe_user->setKey('ses', 'search', $this->search); + $this->request->getAttribute('frontend.user')->setKey('ses', 'search', $this->search); } $this->search = is_array($this->search) ? $this->search : []; @@ -177,13 +176,13 @@ public function mainAction(): ResponseInterface // An empty form will be shown. if (!empty($this->search)) { // get all sortable metadata records - $sortableMetadata = $this->metadataRepository->findByIsSortable(true); + $sortableMetadata = $this->metadataRepository->findBy(['isSortable' => true]); // get all metadata records to be shown in results - $listedMetadata = $this->metadataRepository->findByIsListed(true); + $listedMetadata = $this->metadataRepository->findBy(['isListed' => true]); // get all indexed metadata fields - $indexedMetadata = $this->metadataRepository->findByIndexIndexed(true); + $indexedMetadata = $this->metadataRepository->findBy(['indexIndexed' => true]); $solrResults = null; $numResults = 0; @@ -410,6 +409,7 @@ private function addCollectionsQuery(string $query): string $virtualCollectionsQueryString = ''; foreach ($collections as $collectionEntry) { // check for virtual collections query string + /** @var Collection $collectionEntry */ if ($collectionEntry->getIndexSearch()) { $virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '(' . $collectionEntry->getIndexSearch() . ')' : ' OR (' . $collectionEntry->getIndexSearch() . ')'; } else { diff --git a/Classes/Domain/Model/SolrCore.php b/Classes/Domain/Model/SolrCore.php index ced90803f3..c9ecd0cb10 100644 --- a/Classes/Domain/Model/SolrCore.php +++ b/Classes/Domain/Model/SolrCore.php @@ -26,12 +26,6 @@ */ class SolrCore extends AbstractEntity { - /** - * @access protected - * @var int - */ - protected $pid; - /** * @access protected * @var string Label of the core that is displayed in the backend. diff --git a/Classes/Domain/Repository/BasketRepository.php b/Classes/Domain/Repository/BasketRepository.php index fd05163f8c..489aeaa648 100644 --- a/Classes/Domain/Repository/BasketRepository.php +++ b/Classes/Domain/Repository/BasketRepository.php @@ -23,8 +23,7 @@ * * @access public * - * @method Basket|null findOneByFeUserId(int $feUserId) Get a basket by frontend user ID - * @method Basket|null findOneBySessionId(string $sessionId) Get a document by session id + * @method Basket|null findOneBy(array $criteria) Get a basket by criteria */ class BasketRepository extends Repository { diff --git a/Classes/Domain/Repository/CollectionRepository.php b/Classes/Domain/Repository/CollectionRepository.php index a6fa806672..205d0c548a 100644 --- a/Classes/Domain/Repository/CollectionRepository.php +++ b/Classes/Domain/Repository/CollectionRepository.php @@ -29,7 +29,7 @@ * * @access public * - * @method Collection|null findOneByIndexName(string $indexName) Get a collection by its index name + * @method Collection|null findOneBy(array $criteria) Get a collection by criteria */ class CollectionRepository extends Repository { @@ -150,7 +150,7 @@ public function getIndexNameForSolr(array $settings, $set): Result ) ->setMaxResults(1); - return $result->execute(); + return $result->executeQuery(); } } diff --git a/Classes/Domain/Repository/DocumentRepository.php b/Classes/Domain/Repository/DocumentRepository.php index 7efe85bffe..cd6d9a80db 100644 --- a/Classes/Domain/Repository/DocumentRepository.php +++ b/Classes/Domain/Repository/DocumentRepository.php @@ -36,10 +36,8 @@ * * @access public * - * @method Document|null findOneByUid(int $uid) Get a document by its UID - * @method Document|null findOneByRecordId(string $recordId) Get a document by its record ID - * @method Document|null findOneByIndexName(string $indexName) Get a document by its index name - * @method Document|null findOneByLocation(string $location) Get a document by its XML location + * @method Document|null findByUid(int|null $uid) Get a document by its UID + * @method Document|null findOneBy(array $criteria) Get a document by criteria */ class DocumentRepository extends Repository { @@ -77,14 +75,14 @@ public function findOneByParameters(array $parameters): ?Document } else if (isset($parameters['recordId'])) { - $document = $this->findOneByRecordId($parameters['recordId']); + $document = $this->findOneBy(['recordId' => $parameters['recordId']]); } else if (isset($parameters['location']) && GeneralUtility::isValidUrl($parameters['location'])) { $doc = AbstractDocument::getInstance($parameters['location']); if ($doc !== null && $doc->recordId) { - $document = $this->findOneByRecordId($doc->recordId); + $document = $this->findOneBy(['recordId' => $doc->recordId]); } if ($document === null) { @@ -120,7 +118,9 @@ public function findOldestDocument(): ?Document $query->setOrderings(['tstamp' => QueryInterface::ORDER_ASCENDING]); $query->setLimit(1); - return $query->execute()->getFirst(); + /** @var Document $document */ + $document = $query->execute()->getFirst(); + return $document; } /** @@ -281,7 +281,7 @@ public function getStatisticsForSelectedCollection(array $settings): array $queryBuilder->expr()->in('tx_dlf_collections_join.uid', $queryBuilder->createNamedParameter(GeneralUtility::intExplode(',', $settings['collections']), Connection::PARAM_INT_ARRAY)), $queryBuilder->expr()->eq('tx_dlf_relations_joins.ident', $queryBuilder->createNamedParameter('docs_colls')) ) - ->execute() + ->executeQuery() ->fetchFirstColumn(); $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) @@ -326,7 +326,7 @@ public function getStatisticsForSelectedCollection(array $settings): array $queryBuilder->expr()->in('tx_dlf_collections_join.uid', $queryBuilder->createNamedParameter(GeneralUtility::intExplode(',', $settings['collections']), Connection::PARAM_INT_ARRAY)), $queryBuilder->expr()->eq('tx_dlf_relations_joins.ident', $queryBuilder->createNamedParameter('docs_colls')) ) - ->execute() + ->executeQuery() ->fetchFirstColumn(); } else { $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) @@ -341,7 +341,7 @@ public function getStatisticsForSelectedCollection(array $settings): array $queryBuilder->expr()->eq('partof', 0), Helper::whereExpression('tx_dlf_documents') ) - ->execute() + ->executeQuery() ->fetchFirstColumn(); $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) @@ -365,7 +365,7 @@ public function getStatisticsForSelectedCollection(array $settings): array $queryBuilder->expr()->eq('pid', (int)$settings['storagePid']), $queryBuilder->expr()->notIn('uid', $subQuery) ) - ->execute() + ->executeQuery() ->fetchFirstColumn(); } @@ -419,9 +419,10 @@ public function getTableOfContentsFromDb(int $uid, int $pid, array $settings): R $queryBuilder->expr()->eq('tx_dlf_structures_join.pid', intval($pid)), $excludeOtherWhere ) - ->add('orderBy', 'cast(volume_sorting as UNSIGNED) asc') + ->getConcreteQueryBuilder() + ->orderBy('cast(volume_sorting as UNSIGNED)', 'asc') ->addOrderBy('tx_dlf_documents.mets_orderlabel') - ->execute(); + ->executeQuery(); } /** @@ -520,7 +521,7 @@ public function findAllByUids(array $uids, bool $checkPartof = false): array // Fetch document info for UIDs in $documentSet from DB $exprDocumentMatchesUid = $queryBuilder->expr()->in('uid', $uids); if ($checkPartof) { - $exprDocumentMatchesUid = $queryBuilder->expr()->orX( + $exprDocumentMatchesUid = $queryBuilder->expr()->or( $exprDocumentMatchesUid, $queryBuilder->expr()->in('partof', $uids) ); @@ -540,15 +541,16 @@ public function findAllByUids(array $uids, bool $checkPartof = false): array $queryBuilder->expr()->in('pid', $this->settings['storagePid']), $exprDocumentMatchesUid ) - ->add('orderBy', 'cast(volume_sorting as UNSIGNED) asc') + ->getConcreteQueryBuilder() + ->orderBy('cast(volume_sorting as UNSIGNED)', 'asc') ->addOrderBy('mets_orderlabel', 'asc') - ->execute(); + ->executeQuery(); $allDocuments = []; $documentStructures = Helper::getDocumentStructures($this->settings['storagePid']); // Process documents in a usable array structure while ($resArray = $kitodoDocuments->fetchAssociative()) { - $resArray['structure'] = $documentStructures[$resArray['structure']]; + $resArray['structure'] = $documentStructures[$resArray['structure']] ?? null; $allDocuments[$resArray['uid']] = $resArray; } @@ -583,13 +585,18 @@ public function findChildrenOfEach(array $uids): array * @param Collection $collection * @param array $settings * @param array $searchParams - * @param ?QueryResult $listedMetadata - * @param ?QueryResult $indexedMetadata + * @param ?QueryResultInterface $listedMetadata + * @param ?QueryResultInterface $indexedMetadata * * @return SolrSearch */ - public function findSolrByCollection(Collection $collection, array $settings, array $searchParams, ?QueryResult $listedMetadata = null, ?QueryResult $indexedMetadata = null) - { + public function findSolrByCollection( + Collection $collection, + array $settings, + array $searchParams, + ?QueryResultInterface $listedMetadata = null, + ?QueryResultInterface $indexedMetadata = null + ) { return $this->findSolr([$collection], $settings, $searchParams, $listedMetadata, $indexedMetadata); } @@ -601,13 +608,18 @@ public function findSolrByCollection(Collection $collection, array $settings, ar * @param array|QueryResultInterface $collections * @param array $settings * @param array $searchParams - * @param ?QueryResult $listedMetadata - * @param ?QueryResult $indexedMetadata + * @param ?QueryResultInterface $listedMetadata + * @param ?QueryResultInterface $indexedMetadata * * @return SolrSearch */ - public function findSolrByCollections(array|QueryResultInterface $collections, array $settings, array $searchParams, ?QueryResult $listedMetadata = null, ?QueryResult $indexedMetadata = null): SolrSearch - { + public function findSolrByCollections( + array|QueryResultInterface $collections, + array $settings, + array $searchParams, + ?QueryResultInterface $listedMetadata = null, + ?QueryResultInterface $indexedMetadata = null + ): SolrSearch { return $this->findSolr($collections, $settings, $searchParams, $listedMetadata, $indexedMetadata); } @@ -618,13 +630,17 @@ public function findSolrByCollections(array|QueryResultInterface $collections, a * * @param array $settings * @param array $searchParams - * @param ?QueryResult $listedMetadata - * @param ?QueryResult $indexedMetadata + * @param ?QueryResultInterface $listedMetadata + * @param ?QueryResultInterface $indexedMetadata * * @return SolrSearch */ - public function findSolrWithoutCollection(array $settings, array $searchParams, ?QueryResult $listedMetadata = null, ?QueryResult $indexedMetadata = null): SolrSearch - { + public function findSolrWithoutCollection( + array $settings, + array $searchParams, + ?QueryResultInterface $listedMetadata = null, + ?QueryResultInterface $indexedMetadata = null + ): SolrSearch { return $this->findSolr([], $settings, $searchParams, $listedMetadata, $indexedMetadata); } @@ -636,13 +652,18 @@ public function findSolrWithoutCollection(array $settings, array $searchParams, * @param array|QueryResultInterface $collections * @param array $settings * @param array $searchParams - * @param ?QueryResult $listedMetadata - * @param ?QueryResult $indexedMetadata + * @param ?QueryResultInterface $listedMetadata + * @param ?QueryResultInterface $indexedMetadata * * @return SolrSearch */ - private function findSolr(array|QueryResultInterface $collections, array $settings, array $searchParams, ?QueryResult $listedMetadata = null, ?QueryResult $indexedMetadata = null): SolrSearch - { + private function findSolr( + array|QueryResultInterface $collections, + array $settings, + array $searchParams, + ?QueryResultInterface $listedMetadata = null, + ?QueryResultInterface $indexedMetadata = null + ): SolrSearch { // set settings global inside this repository // (may be necessary when SolrSearch calls back) $this->settings = $settings; @@ -664,7 +685,7 @@ private function findSolr(array|QueryResultInterface $collections, array $settin */ public function getPreviousDocumentUid(int $uid): ?int { - $currentDocument = $this->findOneByUid($uid); + $currentDocument = $this->findOneBy(['uid' => $uid]); if ($currentDocument) { $parentId = $currentDocument->getPartof(); @@ -685,7 +706,7 @@ public function getPreviousDocumentUid(int $uid): ?int 'volume_sorting < \'' . $currentVolume . '\'' ) ->addOrderBy('volume_sorting', 'desc') - ->execute() + ->executeQuery() ->fetchAssociative(); if (!empty($prevDocument)) { @@ -714,7 +735,7 @@ public function getPreviousDocumentUid(int $uid): ?int */ public function getNextDocumentUid(int $uid): ?int { - $currentDocument = $this->findOneByUid($uid); + $currentDocument = $this->findOneBy(['uid' => $uid]); if ($currentDocument) { $parentId = $currentDocument->getPartof(); @@ -735,7 +756,7 @@ public function getNextDocumentUid(int $uid): ?int 'volume_sorting > \'' . $currentVolume . '\'' ) ->addOrderBy('volume_sorting', 'asc') - ->execute() + ->executeQuery() ->fetchAssociative(); if (!empty($nextDocument)) { @@ -775,7 +796,7 @@ public function getFirstChild(int $uid): int $queryBuilder->expr()->eq('partof', $uid) ) ->addOrderBy('volume_sorting', 'asc') - ->execute() + ->executeQuery() ->fetchAssociative(); if (empty($child['uid'])) { @@ -808,7 +829,7 @@ public function getLastChild(int $uid): int $queryBuilder->expr()->eq('partof', $uid) ) ->addOrderBy('volume_sorting', 'desc') - ->execute() + ->executeQuery() ->fetchAssociative(); if (empty($child['uid'])) { diff --git a/Classes/Domain/Repository/FormatRepository.php b/Classes/Domain/Repository/FormatRepository.php index ed4d65ba62..2089f68f45 100644 --- a/Classes/Domain/Repository/FormatRepository.php +++ b/Classes/Domain/Repository/FormatRepository.php @@ -22,8 +22,6 @@ * @subpackage dlf * * @access public - * - * @method Format|null findOneByType(string $type) Get a format by its type */ class FormatRepository extends Repository { diff --git a/Classes/Domain/Repository/LibraryRepository.php b/Classes/Domain/Repository/LibraryRepository.php index d4696e3c4b..cddce2ae91 100644 --- a/Classes/Domain/Repository/LibraryRepository.php +++ b/Classes/Domain/Repository/LibraryRepository.php @@ -23,7 +23,8 @@ * * @access public * - * @method Library|null findOneByIndexName(string $indexName) Get a library by its index name + * @method Library|null findByUid(int|null $uid) Get a library by its UID + * @method Library|null findOneBy(array $criteria) Get a library by criteria */ class LibraryRepository extends Repository { diff --git a/Classes/Domain/Repository/MetadataRepository.php b/Classes/Domain/Repository/MetadataRepository.php index cd7d6db92e..69f447f02b 100644 --- a/Classes/Domain/Repository/MetadataRepository.php +++ b/Classes/Domain/Repository/MetadataRepository.php @@ -24,11 +24,6 @@ * @subpackage dlf * * @access public - * - * @method int countByPid(int $uid) Count amount of metadata for given PID - * @method QueryResult findByIsListed(bool $isListed) Get a metadata which is listed or not listed - * @method QueryResult findByIndexIndexed(bool $indexIndexed) Get a metadata which is indexed or not indexed - * @method QueryResult findByIsSortable(bool $isSortable) Get a metadata which is sortable or not sortable */ class MetadataRepository extends Repository { diff --git a/Classes/Domain/Repository/PrinterRepository.php b/Classes/Domain/Repository/PrinterRepository.php index cfc8528c11..7ce7cb8583 100644 --- a/Classes/Domain/Repository/PrinterRepository.php +++ b/Classes/Domain/Repository/PrinterRepository.php @@ -23,7 +23,7 @@ * * @access public * - * @method Printer|null findOneByUid(int $uid) Get a printer by its UID + * @method Printer|null findOneBy(array $criteria) Get a printer by criteria */ class PrinterRepository extends Repository { diff --git a/Classes/Domain/Repository/SolrCoreRepository.php b/Classes/Domain/Repository/SolrCoreRepository.php index 3c27b99358..cf4d316575 100644 --- a/Classes/Domain/Repository/SolrCoreRepository.php +++ b/Classes/Domain/Repository/SolrCoreRepository.php @@ -22,9 +22,6 @@ * @subpackage dlf * * @access public - * - * @method int countByPid(int $uid) Count amount of SOLR cores for given PID - * @method SolrCore|null findOneByPid(int $uid) Get a SOLR core by its PID */ class SolrCoreRepository extends Repository { diff --git a/Classes/Domain/Repository/StructureRepository.php b/Classes/Domain/Repository/StructureRepository.php index f71fdc0780..e9129afe7a 100644 --- a/Classes/Domain/Repository/StructureRepository.php +++ b/Classes/Domain/Repository/StructureRepository.php @@ -23,8 +23,7 @@ * * @access public * - * @method int countByPid(int $uid) Count amount of structures for given PID - * @method Structure|null findOneByIndexName(string $indexName) Get a structure by its index name + * @method Structure|null findOneBy(array $criteria) Get a structure by criteria */ class StructureRepository extends Repository { diff --git a/Classes/ExpressionLanguage/DocumentTypeFunctionProvider.php b/Classes/ExpressionLanguage/DocumentTypeFunctionProvider.php index 1a38ef4d3a..6fbc3c57e4 100644 --- a/Classes/ExpressionLanguage/DocumentTypeFunctionProvider.php +++ b/Classes/ExpressionLanguage/DocumentTypeFunctionProvider.php @@ -175,7 +175,7 @@ protected function loadDocument(array $requestData, int $pid): void if ($doc !== null) { if ($doc->recordId) { - $this->document = $this->documentRepository->findOneByRecordId($doc->recordId); + $this->document = $this->documentRepository->findOneBy(['recordId' => $doc->recordId]); } if (!isset($this->document)) { // create new dummy Document object @@ -190,7 +190,7 @@ protected function loadDocument(array $requestData, int $pid): void $this->document->setCurrentDocument($doc); } } elseif (!empty($requestData['recordId'])) { - $this->document = $this->documentRepository->findOneByRecordId($requestData['recordId']); + $this->document = $this->documentRepository->findOneBy(['recordId' => $requestData['recordId']]); if ($this->document !== null) { $doc = AbstractDocument::getInstance($this->document->getLocation(), ['storagePid' => $pid]); if ($doc !== null) { diff --git a/Classes/Hooks/ConfigurationForm.php b/Classes/Hooks/ConfigurationForm.php index f79d01fd7f..c0f9f7e47a 100644 --- a/Classes/Hooks/ConfigurationForm.php +++ b/Classes/Hooks/ConfigurationForm.php @@ -14,7 +14,7 @@ use Kitodo\Dlf\Common\Helper; use Kitodo\Dlf\Common\Solr\Solr; -use TYPO3\CMS\Core\Messaging\FlashMessage; +use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; /** * Hooks and helper for \TYPO3\CMS\Core\TypoScript\ConfigurationForm @@ -26,6 +26,7 @@ */ class ConfigurationForm { + const LANG_PREFIX = 'LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:'; /** * Check if a connection to a Solr server could be established with the given credentials. @@ -39,31 +40,18 @@ public function checkSolrConnection(): string $solr = Solr::getInstance(); if ($solr->ready) { Helper::addMessage( - Helper::getLanguageService()->getLL('solr.status'), - Helper::getLanguageService()->getLL('solr.connected'), - FlashMessage::OK + Helper::getLanguageService()->sL(self::LANG_PREFIX . 'solr.status'), + Helper::getLanguageService()->sL(self::LANG_PREFIX . 'solr.connected'), + ContextualFeedbackSeverity::OK ); } else { Helper::addMessage( - Helper::getLanguageService()->getLL('solr.error'), - Helper::getLanguageService()->getLL('solr.notConnected'), - FlashMessage::WARNING + Helper::getLanguageService()->sL(self::LANG_PREFIX . 'solr.error'), + Helper::getLanguageService()->sL(self::LANG_PREFIX . 'solr.notConnected'), + ContextualFeedbackSeverity::WARNING ); } return Helper::renderFlashMessages(); } - /** - * This is the constructor. - * - * @access public - * - * @return void - */ - public function __construct() - { - // Load backend localization file. - Helper::getLanguageService()->includeLLFile('EXT:dlf/Resources/Private/Language/locallang_be.xlf'); - } - } diff --git a/Classes/Hooks/DataHandler.php b/Classes/Hooks/DataHandler.php index f8485062b6..edaa955c95 100644 --- a/Classes/Hooks/DataHandler.php +++ b/Classes/Hooks/DataHandler.php @@ -132,7 +132,7 @@ public function processDatamap_postProcessFieldArray(string $status, string $tab Helper::whereExpression($table) ) ->setMaxResults(1) - ->execute(); + ->executeQuery(); $resArray = $result->fetchAssociative(); if (is_array($resArray)) { @@ -158,7 +158,7 @@ public function processDatamap_postProcessFieldArray(string $status, string $tab Helper::whereExpression($table) ) ->setMaxResults(1) - ->execute(); + ->executeQuery(); if ($resArray = $result->fetchAssociative()) { // Reset indexing to current. @@ -220,7 +220,7 @@ public function processDatamap_afterDatabaseOperations(string $status, string $t ) ) ->setMaxResults(1) - ->execute(); + ->executeQuery(); $resArray = $result->fetchAssociative(); if (is_array($resArray)) { @@ -282,7 +282,7 @@ public function processCmdmap_postProcess(string $command, string $table, $id): ) ) ->setMaxResults(1) - ->execute(); + ->executeQuery(); $resArray = $result->fetchAssociative(); if (is_array($resArray)) { @@ -381,7 +381,7 @@ private function deleteSolrCore($id): void ->from('tx_dlf_solrcores') ->where($queryBuilder->expr()->eq('uid', (int) $id)) ->setMaxResults(1) - ->execute(); + ->executeQuery(); $resArray = $result->fetchAssociative(); if (is_array($resArray)) { diff --git a/Classes/Hooks/Form/FieldInformation/EditInProductionWarning.php b/Classes/Hooks/Form/FieldInformation/EditInProductionWarning.php index 386cf2de2f..27ab4ec816 100644 --- a/Classes/Hooks/Form/FieldInformation/EditInProductionWarning.php +++ b/Classes/Hooks/Form/FieldInformation/EditInProductionWarning.php @@ -14,7 +14,7 @@ use Kitodo\Dlf\Common\Helper; use TYPO3\CMS\Backend\Form\AbstractNode; -use TYPO3\CMS\Core\Messaging\FlashMessage; +use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; /** * FieldInformation renderType for TYPO3 FormEngine @@ -38,13 +38,11 @@ public function render(): array $result = $this->initializeResultArray(); // Show warning only when editing existing records. if ($this->data['command'] !== 'new') { - // Load localization file. - Helper::getLanguageService()->includeLLFile('EXT:dlf/Resources/Private/Language/locallang_be.xlf'); // Create flash message. Helper::addMessage( - htmlspecialchars(Helper::getLanguageService()->getLL('flash.editInProductionWarning')), + htmlspecialchars(Helper::getLanguageService()->sL('LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flash.editInProductionWarning')), '', // We must not set a title/header, because

isn't allowed in FieldInformation. - FlashMessage::WARNING + ContextualFeedbackSeverity::WARNING ); // Add message to result array. $result['html'] = Helper::renderFlashMessages(); diff --git a/Classes/Hooks/Form/FieldInformation/SolrCoreStatus.php b/Classes/Hooks/Form/FieldInformation/SolrCoreStatus.php index f45f4e82ee..330f65d1fe 100644 --- a/Classes/Hooks/Form/FieldInformation/SolrCoreStatus.php +++ b/Classes/Hooks/Form/FieldInformation/SolrCoreStatus.php @@ -16,7 +16,7 @@ use Kitodo\Dlf\Common\Helper; use Kitodo\Dlf\Common\Solr\Solr; use TYPO3\CMS\Backend\Form\AbstractNode; -use TYPO3\CMS\Core\Messaging\FlashMessage; +use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; /** * FieldInformation renderType for TYPO3 FormEngine @@ -28,6 +28,8 @@ */ class SolrCoreStatus extends AbstractNode { + const LANG_PREFIX = 'LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:'; + /** * Shows Solr core status for given 'index_name' * @@ -49,8 +51,6 @@ public function render(): array // Show only when editing existing records. if ($this->data['command'] !== 'new') { $core = $this->data['databaseRow']['index_name']; - // Load localization file. - Helper::getLanguageService()->includeLLFile('EXT:dlf/Resources/Private/Language/locallang_be.xlf'); // Get Solr instance. $solr = Solr::getInstance($core); if ($solr->ready) { @@ -64,24 +64,24 @@ public function render(): array $uptimeInSeconds = floor($response->getUptime() / 1000); $dateTimeFrom = new \DateTime('@0'); $dateTimeTo = new \DateTime("@$uptimeInSeconds"); - $uptime = $dateTimeFrom->diff($dateTimeTo)->format('%a ' . Helper::getLanguageService()->getLL('flash.days') . ', %H:%I:%S'); + $uptime = $dateTimeFrom->diff($dateTimeTo)->format('%a ' . Helper::getLanguageService()->sL(self::LANG_PREFIX . 'flash.days') . ', %H:%I:%S'); $numDocuments = $response->getNumberOfDocuments(); $startTime = $response->getStartTime() ? $dateFormatter->format($response->getStartTime()) : 'N/A'; $lastModified = $response->getLastModified() ? $dateFormatter->format($response->getLastModified()) : 'N/A'; // Create flash message. Helper::addMessage( - sprintf(Helper::getLanguageService()->getLL('flash.coreStatus'), $startTime, $uptime, $lastModified, $numDocuments), + sprintf(Helper::getLanguageService()->sL(self::LANG_PREFIX . 'flash.coreStatus'), $startTime, $uptime, $lastModified, $numDocuments), '', // We must not set a title/header, because

isn't allowed in FieldInformation. - FlashMessage::INFO + ContextualFeedbackSeverity::INFO ); } } else { // Could not fetch core status. Helper::addMessage( - Helper::getLanguageService()->getLL('solr.error'), + Helper::getLanguageService()->sL(self::LANG_PREFIX . 'solr.error'), '', // We must not set a title/header, because

isn't allowed in FieldInformation. - FlashMessage::ERROR + ContextualFeedbackSeverity::ERROR ); } // Add message to result array. diff --git a/Classes/Hooks/ItemsProcFunc.php b/Classes/Hooks/ItemsProcFunc.php index 58371b1d27..5333a33a4c 100644 --- a/Classes/Hooks/ItemsProcFunc.php +++ b/Classes/Hooks/ItemsProcFunc.php @@ -13,12 +13,11 @@ namespace Kitodo\Dlf\Hooks; use Kitodo\Dlf\Common\Helper; +use Kitodo\Dlf\Common\TypoScriptHelper; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; -use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Configuration\ConfigurationManager; use TYPO3\CMS\Core\Database\ConnectionPool; -use TYPO3\CMS\Core\TypoScript\TemplateService; use TYPO3\CMS\Core\Utility\GeneralUtility; /** @@ -58,7 +57,7 @@ public function toolList(array &$params): void } /** - * Extract typoScript configuration from site root of the plugin + * Extract typoScript configuration from site root to load storagePid * * @access public * @@ -66,28 +65,11 @@ public function toolList(array &$params): void * * @return void */ - public function getTyposcriptConfigFromPluginSiteRoot(array $params): void + public function loadStoragePid(array $params): void { $pid = $params['flexParentDatabaseRow']['pid']; - $rootLine = BackendUtility::BEgetRootLine($pid); - $siteRootRow = []; - foreach ($rootLine as $row) { - if (isset($row['is_siteroot'])) { - $siteRootRow = $row; - break; - } - } - - try { - $ts = GeneralUtility::makeInstance(TemplateService::class); - $ts->rootLine = $rootLine; - $ts->runThroughTemplates($rootLine, 0); - $ts->generateConfig(); - $typoScriptConfig = $ts->setup; - $this->storagePid = $typoScriptConfig['plugin.']['tx_dlf.']['persistence.']['storagePid']; - } catch (\Exception $e) { - $this->logger->error($e->getMessage()); - } + $config = TypoScriptHelper::getTyposcriptConfig($pid); + $this->storagePid = $config['plugin.']['tx_dlf.']['persistence.']['storagePid']; } /** @@ -143,7 +125,7 @@ public function getFacetsList(array &$params): void */ protected function generateList(array &$params, string $fields, string $table, string $sorting, string $andWhere = ''): void { - $this->getTyposcriptConfigFromPluginSiteRoot($params); + $this->loadStoragePid($params); $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) ->getQueryBuilderForTable($table); @@ -158,7 +140,7 @@ protected function generateList(array &$params, string $fields, string $table, s $andWhere ) ->orderBy($sorting) - ->execute(); + ->executeQuery(); while ($resArray = $result->fetchNumeric()) { $params['items'][] = $resArray; diff --git a/Classes/Task/BaseAdditionalFieldProvider.php b/Classes/Task/BaseAdditionalFieldProvider.php index 38e8d3c361..176941c2bb 100644 --- a/Classes/Task/BaseAdditionalFieldProvider.php +++ b/Classes/Task/BaseAdditionalFieldProvider.php @@ -15,11 +15,14 @@ use TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; -use TYPO3\CMS\Core\Messaging\FlashMessage; +use TYPO3\CMS\Core\Information\Typo3Version; +use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Scheduler\AdditionalFieldProviderInterface; use TYPO3\CMS\Scheduler\Controller\SchedulerModuleController; +use TYPO3\CMS\Scheduler\SchedulerManagementAction; use TYPO3\CMS\Scheduler\Task\AbstractTask; +use TYPO3\CMS\Scheduler\Task\Enumeration\Action; /** * Base class for additional fields classes of scheduler tasks. @@ -31,6 +34,8 @@ */ class BaseAdditionalFieldProvider implements AdditionalFieldProviderInterface { + const LANG_PREFIX = 'LLL:EXT:dlf/Resources/Private/Language/locallang_tasks.xlf:'; + /** * Gets additional fields to render in the form to add/edit a task * @@ -55,14 +60,12 @@ public function validateAdditionalFields(array &$submittedData, SchedulerModuleC { $fieldsValid = true; - Helper::getLanguageService()->includeLLFile('EXT:dlf/Resources/Private/Language/locallang_tasks.xlf'); - - $messageTitle = Helper::getLanguageService()->getLL('additionalFields.error'); - $messageSeverity = FlashMessage::ERROR; + $messageTitle = Helper::getLanguageService()->sL(self::LANG_PREFIX . 'additionalFields.error'); + $messageSeverity = ContextualFeedbackSeverity::ERROR; if (isset($submittedData['doc']) && empty($submittedData['doc'])) { Helper::addMessage( - Helper::getLanguageService()->getLL('additionalFields.doc') . ' ' . Helper::getLanguageService()->getLL('additionalFields.valid'), + Helper::getLanguageService()->sL(self::LANG_PREFIX . 'additionalFields.doc') . ' ' . Helper::getLanguageService()->sL(self::LANG_PREFIX . 'additionalFields.valid'), $messageTitle, $messageSeverity, true, @@ -73,7 +76,7 @@ public function validateAdditionalFields(array &$submittedData, SchedulerModuleC if ((isset($submittedData['pid']) && (int) $submittedData['pid'] <= 0)) { Helper::addMessage( - Helper::getLanguageService()->getLL('additionalFields.pid') . ' ' . Helper::getLanguageService()->getLL('additionalFields.valid'), + Helper::getLanguageService()->sL(self::LANG_PREFIX . 'additionalFields.pid') . ' ' . Helper::getLanguageService()->sL(self::LANG_PREFIX . 'additionalFields.valid'), $messageTitle, $messageSeverity, true, @@ -84,7 +87,7 @@ public function validateAdditionalFields(array &$submittedData, SchedulerModuleC if (!isset($submittedData['commit']) && !isset($submittedData['optimize']) && !isset($submittedData['pid']) && ($submittedData['class'] != 'Kitodo\Dlf\Task\SuggestBuildTask')) { Helper::addMessage( - Helper::getLanguageService()->getLL('additionalFields.commitOrOptimize'), + Helper::getLanguageService()->sL(self::LANG_PREFIX . 'additionalFields.commitOrOptimize'), $messageTitle, $messageSeverity, true, @@ -94,42 +97,42 @@ public function validateAdditionalFields(array &$submittedData, SchedulerModuleC } if (!$submittedData['uid']) { - $messageTitle = Helper::getLanguageService()->getLL('additionalFields.warning'); - $messageSeverity = FlashMessage::WARNING; + $messageTitle = Helper::getLanguageService()->sL(self::LANG_PREFIX . 'additionalFields.warning'); + $messageSeverity = ContextualFeedbackSeverity::WARNING; } if ((isset($submittedData['lib']) && (int) $submittedData['lib'] <= 0)) { Helper::addMessage( - Helper::getLanguageService()->getLL('additionalFields.lib') . ' ' . Helper::getLanguageService()->getLL('additionalFields.valid'), + Helper::getLanguageService()->sL(self::LANG_PREFIX . 'additionalFields.lib') . ' ' . Helper::getLanguageService()->sL(self::LANG_PREFIX . 'additionalFields.valid'), $messageTitle, $messageSeverity, true, 'core.template.flashMessages' ); - $fieldsValid = $messageSeverity === FlashMessage::ERROR ? false : $fieldsValid; + $fieldsValid = $messageSeverity === ContextualFeedbackSeverity::ERROR ? false : $fieldsValid; } if ((isset($submittedData['solr']) && (int) $submittedData['solr'] <= 0) || !isset($submittedData['solr'])) { Helper::addMessage( - Helper::getLanguageService()->getLL('additionalFields.solr') . ' ' . Helper::getLanguageService()->getLL('additionalFields.valid'), + Helper::getLanguageService()->sL(self::LANG_PREFIX . 'additionalFields.solr') . ' ' . Helper::getLanguageService()->sL(self::LANG_PREFIX . 'additionalFields.valid'), $messageTitle, $messageSeverity, true, 'core.template.flashMessages' ); - $fieldsValid = $messageSeverity === FlashMessage::ERROR ? false : $fieldsValid; + $fieldsValid = $messageSeverity === ContextualFeedbackSeverity::ERROR ? false : $fieldsValid; } if (((isset($submittedData['coll']) && isset($submittedData['all'])) || (!isset($submittedData['coll']) && !isset($submittedData['all']))) && !isset($submittedData['doc']) && !isset($submittedData['lib']) && isset($submittedData['pid'])) { Helper::addMessage( - Helper::getLanguageService()->getLL('additionalFields.collOrAll'), + Helper::getLanguageService()->sL(self::LANG_PREFIX . 'additionalFields.collOrAll'), $messageTitle, $messageSeverity, true, 'core.template.flashMessages' ); - $fieldsValid = $messageSeverity === FlashMessage::ERROR ? false : $fieldsValid; + $fieldsValid = $messageSeverity === ContextualFeedbackSeverity::ERROR ? false : $fieldsValid; } return $fieldsValid; } @@ -309,7 +312,7 @@ private function getSolrCores(?int $pid = null): array ->eq('pid', $queryBuilder->createNamedParameter((int) $pid, Connection::PARAM_INT)) ); } - $result = $queryBuilder->execute(); + $result = $queryBuilder->executeQuery(); while ($record = $result->fetchAssociative()) { $solrCores[$record['label'] . ' (' . $record['index_name'] . ')'] = $record['uid']; @@ -339,4 +342,30 @@ protected function getSoftCommitField(bool $softCommit): array 'cshLabel' => $fieldId ]; } + + /** + * Return whether the current action is an edit action. + * + * Between Typo3 v12 and v13 the action type has changed from a custom Typo3 class to an PHP enum, see: + * https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/13.0/Breaking-101129-ConvertActionToNativeEnum.html + * + * @access protected + * + * @param SchedulerModuleController $schedulerModule scheduler module + * + * @return bool whether current action is an edit action + */ + protected function isEditAction(SchedulerModuleController $schedulerModule): bool + { + $typo3Version = (new Typo3Version())->getMajorVersion(); + if ($typo3Version == 12) { + /** @var \TYPO3\CMS\Scheduler\Task\Enumeration\Action $action */ + $action = $schedulerModule->getCurrentAction(); + return $action->equals(Action::EDIT); + } else { + /** @var \TYPO3\CMS\Scheduler\SchedulerManagementAction $action */ + $action = $schedulerModule->getCurrentAction(); + return $action === SchedulerManagementAction::EDIT; + } + } } diff --git a/Classes/Task/BaseTask.php b/Classes/Task/BaseTask.php index 815eda5824..131a75d7fd 100644 --- a/Classes/Task/BaseTask.php +++ b/Classes/Task/BaseTask.php @@ -12,7 +12,7 @@ namespace Kitodo\Dlf\Task; use Kitodo\Dlf\Common\Helper; -use TYPO3\CMS\Core\Messaging\FlashMessage; +use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; use TYPO3\CMS\Scheduler\Task\AbstractTask; /** @@ -372,11 +372,11 @@ public function setOptimize(bool $optimize): void * @access protected * * @param string $message Messages separated by PHP_EOL - * @param int $severity + * @param ContextualFeedbackSeverity $severity * * @return void */ - protected function outputFlashMessages(string $message, int $severity): void + protected function outputFlashMessages(string $message, ContextualFeedbackSeverity $severity): void { $messages = explode(PHP_EOL, $message); @@ -385,10 +385,14 @@ protected function outputFlashMessages(string $message, int $severity): void continue; } + if ($severity !== ContextualFeedbackSeverity::ERROR) { + $severity = ContextualFeedbackSeverity::OK; + } + Helper::addMessage( $message, '', - $severity == FlashMessage::ERROR ? FlashMessage::ERROR : FlashMessage::OK, + $severity, true, 'core.template.flashMessages' ); diff --git a/Classes/Task/DeleteAdditionalFieldProvider.php b/Classes/Task/DeleteAdditionalFieldProvider.php index cc0605fcc8..3e32d5b4b8 100644 --- a/Classes/Task/DeleteAdditionalFieldProvider.php +++ b/Classes/Task/DeleteAdditionalFieldProvider.php @@ -12,8 +12,6 @@ namespace Kitodo\Dlf\Task; use TYPO3\CMS\Scheduler\Controller\SchedulerModuleController; -use TYPO3\CMS\Scheduler\Task\AbstractTask; -use TYPO3\CMS\Scheduler\Task\Enumeration\Action; /** * Additional fields for index document task. @@ -35,10 +33,8 @@ class DeleteAdditionalFieldProvider extends BaseAdditionalFieldProvider */ public function getAdditionalFields(array &$taskInfo, $task, SchedulerModuleController $schedulerModule) { - $currentSchedulerModuleAction = $schedulerModule->getCurrentAction(); - /** @var BaseTask $task */ - if ($currentSchedulerModuleAction->equals(Action::EDIT)) { + if ($this->isEditAction($schedulerModule)) { $taskInfo['doc'] = $task->getDoc(); $taskInfo['pid'] = $task->getPid(); $taskInfo['solr'] = $task->getSolr(); diff --git a/Classes/Task/DeleteTask.php b/Classes/Task/DeleteTask.php index 0ac9b594af..4e3c6e6efc 100644 --- a/Classes/Task/DeleteTask.php +++ b/Classes/Task/DeleteTask.php @@ -12,7 +12,7 @@ namespace Kitodo\Dlf\Task; use TYPO3\CMS\Core\Core\Environment; -use TYPO3\CMS\Core\Messaging\FlashMessage; +use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; use TYPO3\CMS\Core\Utility\GeneralUtility; /** @@ -46,7 +46,8 @@ public function execute() $return = $deleteCommand->run($inputInterface, $outputInterface); if (!Environment::isCli()) { - $this->outputFlashMessages($outputInterface->fetch(), $return ? FlashMessage::ERROR : FlashMessage::OK); + $severity = $return ? ContextualFeedbackSeverity::ERROR : ContextualFeedbackSeverity::OK; + $this->outputFlashMessages($outputInterface->fetch(), $severity); } return !$return; } diff --git a/Classes/Task/HarvestAdditionalFieldProvider.php b/Classes/Task/HarvestAdditionalFieldProvider.php index ed28250aa6..085aae7638 100644 --- a/Classes/Task/HarvestAdditionalFieldProvider.php +++ b/Classes/Task/HarvestAdditionalFieldProvider.php @@ -15,7 +15,6 @@ use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Scheduler\Controller\SchedulerModuleController; -use TYPO3\CMS\Scheduler\Task\Enumeration\Action; /** * Additional fields for harvest documents task. @@ -37,10 +36,8 @@ class HarvestAdditionalFieldProvider extends BaseAdditionalFieldProvider */ public function getAdditionalFields(array &$taskInfo, $task, SchedulerModuleController $schedulerModule) { - $currentSchedulerModuleAction = $schedulerModule->getCurrentAction(); - /** @var BaseTask $task */ - if ($currentSchedulerModuleAction->equals(Action::EDIT)) { + if ($this->isEditAction($schedulerModule)) { $taskInfo['dryRun'] = $task->isDryRun(); $taskInfo['lib'] = $task->getLib(); $taskInfo['pid'] = $task->getPid(); @@ -149,7 +146,7 @@ private function getLibraries(int $pid): array $queryBuilder->expr() ->eq('pid', $queryBuilder->createNamedParameter((int) $pid, Connection::PARAM_INT)) ) - ->execute(); + ->executeQuery(); while ($record = $result->fetchAssociative()) { $libraries[$record['label']] = $record['uid']; diff --git a/Classes/Task/HarvestTask.php b/Classes/Task/HarvestTask.php index 145243a516..5cbf887cb3 100644 --- a/Classes/Task/HarvestTask.php +++ b/Classes/Task/HarvestTask.php @@ -12,7 +12,7 @@ namespace Kitodo\Dlf\Task; use TYPO3\CMS\Core\Core\Environment; -use TYPO3\CMS\Core\Messaging\FlashMessage; +use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; use TYPO3\CMS\Core\Utility\GeneralUtility; /** @@ -58,7 +58,8 @@ public function execute() $return = $harvestCommand->run($inputInterface, $outputInterface); if (!Environment::isCli()) { - $this->outputFlashMessages($outputInterface->fetch(), $return ? FlashMessage::ERROR : FlashMessage::OK); + $severity = $return ? ContextualFeedbackSeverity::ERROR : ContextualFeedbackSeverity::OK; + $this->outputFlashMessages($outputInterface->fetch(), $severity); } return !$return; } diff --git a/Classes/Task/IndexAdditionalFieldProvider.php b/Classes/Task/IndexAdditionalFieldProvider.php index 5d3b0b6fe0..eb5d9cd403 100644 --- a/Classes/Task/IndexAdditionalFieldProvider.php +++ b/Classes/Task/IndexAdditionalFieldProvider.php @@ -12,8 +12,6 @@ namespace Kitodo\Dlf\Task; use TYPO3\CMS\Scheduler\Controller\SchedulerModuleController; -use TYPO3\CMS\Scheduler\Task\AbstractTask; -use TYPO3\CMS\Scheduler\Task\Enumeration\Action; /** * Additional fields for index document task. @@ -35,10 +33,8 @@ class IndexAdditionalFieldProvider extends BaseAdditionalFieldProvider */ public function getAdditionalFields(array &$taskInfo, $task, SchedulerModuleController $schedulerModule) { - $currentSchedulerModuleAction = $schedulerModule->getCurrentAction(); - /** @var BaseTask $task */ - if ($currentSchedulerModuleAction->equals(Action::EDIT)) { + if ($this->isEditAction($schedulerModule)) { $taskInfo['dryRun'] = $task->isDryRun(); $taskInfo['doc'] = $task->getDoc(); $taskInfo['pid'] = $task->getPid(); diff --git a/Classes/Task/IndexTask.php b/Classes/Task/IndexTask.php index 7a45e2366c..e31d208277 100644 --- a/Classes/Task/IndexTask.php +++ b/Classes/Task/IndexTask.php @@ -12,7 +12,7 @@ namespace Kitodo\Dlf\Task; use TYPO3\CMS\Core\Core\Environment; -use TYPO3\CMS\Core\Messaging\FlashMessage; +use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; use TYPO3\CMS\Core\Utility\GeneralUtility; /** @@ -52,7 +52,8 @@ public function execute() $return = $indexCommand->run($inputInterface, $outputInterface); if (!Environment::isCli()) { - $this->outputFlashMessages($outputInterface->fetch(), $return ? FlashMessage::ERROR : FlashMessage::OK); + $severity = $return ? ContextualFeedbackSeverity::ERROR : ContextualFeedbackSeverity::OK; + $this->outputFlashMessages($outputInterface->fetch(), $severity); } return !$return; } diff --git a/Classes/Task/OptimizeAdditionalFieldProvider.php b/Classes/Task/OptimizeAdditionalFieldProvider.php index b74dcaf9ed..1cb73478af 100644 --- a/Classes/Task/OptimizeAdditionalFieldProvider.php +++ b/Classes/Task/OptimizeAdditionalFieldProvider.php @@ -11,11 +11,7 @@ */ namespace Kitodo\Dlf\Task; -use TYPO3\CMS\Core\Database\Connection; -use TYPO3\CMS\Core\Database\ConnectionPool; -use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Scheduler\Controller\SchedulerModuleController; -use TYPO3\CMS\Scheduler\Task\Enumeration\Action; /** * Additional fields for reindex documents task. @@ -37,10 +33,8 @@ class OptimizeAdditionalFieldProvider extends BaseAdditionalFieldProvider */ public function getAdditionalFields(array &$taskInfo, $task, SchedulerModuleController $schedulerModule) { - $currentSchedulerModuleAction = $schedulerModule->getCurrentAction(); - /** @var BaseTask $task */ - if ($currentSchedulerModuleAction->equals(Action::EDIT)) { + if ($this->isEditAction($schedulerModule)) { $taskInfo['solr'] = $task->getSolr(); $taskInfo['commit'] = $task->isCommit(); $taskInfo['optimize'] = $task->isOptimize(); diff --git a/Classes/Task/OptimizeTask.php b/Classes/Task/OptimizeTask.php index d028b8d263..7b36ffaaa9 100644 --- a/Classes/Task/OptimizeTask.php +++ b/Classes/Task/OptimizeTask.php @@ -12,7 +12,7 @@ namespace Kitodo\Dlf\Task; use TYPO3\CMS\Core\Core\Environment; -use TYPO3\CMS\Core\Messaging\FlashMessage; +use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; use TYPO3\CMS\Core\Utility\GeneralUtility; /** @@ -47,7 +47,8 @@ public function execute() $return = $optimizeCommand->run($inputInterface, $outputInterface); if (!Environment::isCli()) { - $this->outputFlashMessages($outputInterface->fetch(), $return ? FlashMessage::ERROR : FlashMessage::OK); + $severity = $return ? ContextualFeedbackSeverity::ERROR : ContextualFeedbackSeverity::OK; + $this->outputFlashMessages($outputInterface->fetch(), $severity); } return !$return; } diff --git a/Classes/Task/ReindexAdditionalFieldProvider.php b/Classes/Task/ReindexAdditionalFieldProvider.php index 2342dd1e56..c3c68a2c6c 100644 --- a/Classes/Task/ReindexAdditionalFieldProvider.php +++ b/Classes/Task/ReindexAdditionalFieldProvider.php @@ -15,7 +15,6 @@ use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Scheduler\Controller\SchedulerModuleController; -use TYPO3\CMS\Scheduler\Task\Enumeration\Action; /** * Additional fields for reindex documents task. @@ -37,10 +36,8 @@ class ReindexAdditionalFieldProvider extends BaseAdditionalFieldProvider */ public function getAdditionalFields(array &$taskInfo, $task, SchedulerModuleController $schedulerModule) { - $currentSchedulerModuleAction = $schedulerModule->getCurrentAction(); - /** @var BaseTask $task */ - if ($currentSchedulerModuleAction->equals(Action::EDIT)) { + if ($this->isEditAction($schedulerModule)) { $taskInfo['dryRun'] = $task->isDryRun(); $taskInfo['coll'] = $task->getColl(); $taskInfo['pid'] = $task->getPid(); @@ -141,7 +138,7 @@ private function getCollections(int $pid): array $queryBuilder->expr() ->eq('pid', $queryBuilder->createNamedParameter((int) $pid, Connection::PARAM_INT)) ) - ->execute(); + ->executeQuery(); while ($record = $result->fetchAssociative()) { $collections[$record['label']] = $record['uid']; diff --git a/Classes/Task/ReindexTask.php b/Classes/Task/ReindexTask.php index 88bc7e752a..7489be7344 100644 --- a/Classes/Task/ReindexTask.php +++ b/Classes/Task/ReindexTask.php @@ -12,7 +12,7 @@ namespace Kitodo\Dlf\Task; use TYPO3\CMS\Core\Core\Environment; -use TYPO3\CMS\Core\Messaging\FlashMessage; +use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; use TYPO3\CMS\Core\Utility\GeneralUtility; /** @@ -57,7 +57,8 @@ public function execute() $return = $reindexCommand->run($inputInterface, $outputInterface); if (!Environment::isCli()) { - $this->outputFlashMessages($outputInterface->fetch(), $return ? FlashMessage::ERROR : FlashMessage::OK); + $severity = $return ? ContextualFeedbackSeverity::ERROR : ContextualFeedbackSeverity::OK; + $this->outputFlashMessages($outputInterface->fetch(), $severity); } return !$return; } diff --git a/Classes/Task/SuggestBuildAdditionalFieldProvider.php b/Classes/Task/SuggestBuildAdditionalFieldProvider.php index 1af7f61326..ce1799dfd2 100644 --- a/Classes/Task/SuggestBuildAdditionalFieldProvider.php +++ b/Classes/Task/SuggestBuildAdditionalFieldProvider.php @@ -11,11 +11,7 @@ */ namespace Kitodo\Dlf\Task; -use TYPO3\CMS\Core\Database\Connection; -use TYPO3\CMS\Core\Database\ConnectionPool; -use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Scheduler\Controller\SchedulerModuleController; -use TYPO3\CMS\Scheduler\Task\Enumeration\Action; /** * Additional fields for building the suggestion dictionary task. @@ -37,10 +33,8 @@ class SuggestBuildAdditionalFieldProvider extends BaseAdditionalFieldProvider */ public function getAdditionalFields(array &$taskInfo, $task, SchedulerModuleController $schedulerModule) { - $currentSchedulerModuleAction = $schedulerModule->getCurrentAction(); - /** @var BaseTask $task */ - if ($currentSchedulerModuleAction->equals(Action::EDIT)) { + if ($this->isEditAction($schedulerModule)) { $taskInfo['solr'] = $task->getSolr(); } else { $taskInfo['solr'] = - 1; diff --git a/Classes/Task/SuggestBuildTask.php b/Classes/Task/SuggestBuildTask.php index 01e548f0d4..b1a81c8f9e 100644 --- a/Classes/Task/SuggestBuildTask.php +++ b/Classes/Task/SuggestBuildTask.php @@ -12,7 +12,7 @@ namespace Kitodo\Dlf\Task; use TYPO3\CMS\Core\Core\Environment; -use TYPO3\CMS\Core\Messaging\FlashMessage; +use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; use TYPO3\CMS\Core\Utility\GeneralUtility; /** @@ -41,7 +41,8 @@ public function execute() $return = $suggestBuildCommand->run($inputInterface, $outputInterface); if (!Environment::isCli()) { - $this->outputFlashMessages($outputInterface->fetch(), $return ? FlashMessage::ERROR : FlashMessage::OK); + $severity = $return ? ContextualFeedbackSeverity::ERROR : ContextualFeedbackSeverity::OK; + $this->outputFlashMessages($outputInterface->fetch(), $severity); } return !$return; } diff --git a/Classes/Updates/FileLocationUpdater.php b/Classes/Updates/FileLocationUpdater.php index 256f985865..786bc722c1 100644 --- a/Classes/Updates/FileLocationUpdater.php +++ b/Classes/Updates/FileLocationUpdater.php @@ -17,11 +17,13 @@ use Psr\Log\LoggerAwareTrait; use Symfony\Component\Console\Output\OutputInterface; use TYPO3\CMS\Core\Core\Environment; +use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder; use TYPO3\CMS\Core\Resource\ResourceStorage; use TYPO3\CMS\Core\Resource\StorageRepository; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Install\Attribute\UpgradeWizard; use TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite; use TYPO3\CMS\Install\Updates\UpgradeWizardInterface; use TYPO3\CMS\Install\Updates\ChattyInterface; @@ -34,6 +36,7 @@ * * @access public */ +#[UpgradeWizard('fileLocationUpdater')] class FileLocationUpdater implements UpgradeWizardInterface, ChattyInterface, LoggerAwareInterface { use LoggerAwareTrait; @@ -58,16 +61,6 @@ class FileLocationUpdater implements UpgradeWizardInterface, ChattyInterface, Lo 'tx_dlf_collections' => 'thumbnail' ]; - /** - * @access public - * - * @return string Unique identifier of this updater - */ - public function getIdentifier(): string - { - return self::class; - } - /** * Return the speaking name of this wizard * @@ -187,7 +180,7 @@ protected function getRecordsFromTable(bool $countOnly = false) $queryBuilder->expr()->isNotNull($this->fieldsToMigrate[$table]), $queryBuilder->expr()->neq( $this->fieldsToMigrate[$table], - $queryBuilder->createNamedParameter('', \PDO::PARAM_STR) + $queryBuilder->createNamedParameter('', Connection::PARAM_STR) ), $queryBuilder->expr()->comparison( 'CAST(CAST(' . $queryBuilder->quoteIdentifier($this->fieldsToMigrate[$table]) . ' AS DECIMAL) AS CHAR)', @@ -196,7 +189,7 @@ protected function getRecordsFromTable(bool $countOnly = false) ) ) ->orderBy('uid') - ->execute() + ->executeQuery() ->fetchAllAssociative(); if ($countOnly === true) { $numResults += count($result); @@ -283,17 +276,17 @@ protected function migrateField(string $table, array $row): void $existingFileRecord = $queryBuilder->select('uid')->from('sys_file')->where( $queryBuilder->expr()->eq( 'missing', - $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT) + $queryBuilder->createNamedParameter(0, Connection::PARAM_INT) ), $queryBuilder->expr()->eq( 'sha1', - $queryBuilder->createNamedParameter($fileSha1, \PDO::PARAM_STR) + $queryBuilder->createNamedParameter($fileSha1, Connection::PARAM_STR) ), $queryBuilder->expr()->eq( 'storage', - $queryBuilder->createNamedParameter($storageUid, \PDO::PARAM_INT) + $queryBuilder->createNamedParameter($storageUid, Connection::PARAM_INT) ) - )->execute()->fetchAssociative(); + )->executeQuery()->fetchAssociative(); // the file exists if (is_array($existingFileRecord)) { @@ -317,7 +310,7 @@ protected function migrateField(string $table, array $row): void $result = $queryBuilder ->insert('sys_file_reference') ->values($fields) - ->execute(); + ->executeStatement(); // Update referencing table's original field to now contain the count of references, // which is "1" in our case. @@ -325,9 +318,9 @@ protected function migrateField(string $table, array $row): void $queryBuilder->update($table)->where( $queryBuilder->expr()->eq( 'uid', - $queryBuilder->createNamedParameter($row['uid'], \PDO::PARAM_INT) + $queryBuilder->createNamedParameter($row['uid'], Connection::PARAM_INT) ) - )->set($this->fieldsToMigrate[$table], 1)->execute(); + )->set($this->fieldsToMigrate[$table], 1)->executeStatement(); } } } diff --git a/Classes/Updates/FormatUpdater.php b/Classes/Updates/FormatUpdater.php index 38dbb9bb29..3a820be30e 100644 --- a/Classes/Updates/FormatUpdater.php +++ b/Classes/Updates/FormatUpdater.php @@ -17,8 +17,10 @@ use Psr\Log\LoggerAwareTrait; use RuntimeException; use Symfony\Component\Console\Output\OutputInterface; +use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Install\Attribute\UpgradeWizard; use TYPO3\CMS\Install\Updates\ChattyInterface; use TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite; use TYPO3\CMS\Install\Updates\UpgradeWizardInterface; @@ -31,6 +33,7 @@ * * @access public */ +#[UpgradeWizard('formatUpdater')] class FormatUpdater implements UpgradeWizardInterface, ChattyInterface, LoggerAwareInterface { use LoggerAwareTrait; @@ -47,19 +50,6 @@ class FormatUpdater implements UpgradeWizardInterface, ChattyInterface, LoggerAw */ protected OutputInterface $output; - /** - * Return the identifier for this wizard - * This should be the same string as used in the ext_localconf class registration - * - * @access public - * - * @return string Unique identifier of this updater - */ - public function getIdentifier(): string - { - return self::class; - } - /** * Return the speaking name of this wizard * @@ -176,7 +166,7 @@ protected function getRecordsFromTable(bool $countOnly = false): array|int $queryBuilder->expr()->eq('pid', 0) ) ->orderBy('uid') - ->execute() + ->executeQuery() ->fetchAllAssociative(); if ($countOnly === true) { $numResults += count($result); @@ -242,7 +232,7 @@ protected function migrateField(array $row): void $solrQueryBuilder->expr()->eq('uid', 1) ) ->orderBy('uid') - ->execute() + ->executeQuery() ->fetchAssociative(); if ($result !== false) { @@ -250,9 +240,9 @@ protected function migrateField(array $row): void $queryBuilder->update($this->table)->where( $queryBuilder->expr()->eq( 'uid', - $queryBuilder->createNamedParameter($row['uid'], \PDO::PARAM_INT) + $queryBuilder->createNamedParameter($row['uid'], Connection::PARAM_INT) ) - )->set('pid', $result['pid'])->execute(); + )->set('pid', $result['pid'])->executeStatement(); } } } diff --git a/Classes/Updates/MigrateSettings.php b/Classes/Updates/MigrateSettings.php index 51e0fe721c..e53fe9344d 100644 --- a/Classes/Updates/MigrateSettings.php +++ b/Classes/Updates/MigrateSettings.php @@ -12,9 +12,11 @@ namespace Kitodo\Dlf\Updates; +use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\Query\QueryBuilder; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Install\Attribute\UpgradeWizard; use TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite; use TYPO3\CMS\Install\Updates\UpgradeWizardInterface; @@ -26,22 +28,9 @@ * * @internal */ +#[UpgradeWizard('migrateSettings')] class MigrateSettings implements UpgradeWizardInterface { - - /** - * Return the identifier for this wizard - * This should be the same string as used in the ext_localconf class registration - * - * @access public - * - * @return string - */ - public function getIdentifier(): string - { - return self::class; - } - /** * Return the speaking name of this wizard * @@ -91,7 +80,7 @@ public function executeUpdate(): bool $queryBuilder->expr()->eq('CType', $queryBuilder->createNamedParameter('list')), $queryBuilder->expr()->like('list_type', $queryBuilder->createNamedParameter('dlf_%')) ) - ->execute(); + ->executeQuery(); // Update the found record sets while ($record = $statement->fetchAssociative()) { @@ -100,11 +89,11 @@ public function executeUpdate(): bool ->where( $queryBuilder->expr()->eq( 'uid', - $queryBuilder->createNamedParameter($record['uid'], \PDO::PARAM_INT) + $queryBuilder->createNamedParameter($record['uid'], Connection::PARAM_INT) ) ) ->set('pi_flexform', $this->migrateFlexFormSettings($record['pi_flexform'])) - ->execute(); + ->executeStatement(); // exit if at least one update statement is not successful if (!((bool) $updateResult)) { @@ -139,7 +128,7 @@ public function updateNecessary(): bool $queryBuilder->expr()->eq('CType', $queryBuilder->createNamedParameter('list')), $queryBuilder->expr()->like('list_type', $queryBuilder->createNamedParameter('dlf_%')) ) - ->execute(); + ->executeQuery(); // Update the found record sets while ($record = $statement->fetchAssociative()) { diff --git a/Classes/Updates/UpdateSolrSchema.php b/Classes/Updates/UpdateSolrSchema.php index fdcbfae0e5..6f47c81529 100644 --- a/Classes/Updates/UpdateSolrSchema.php +++ b/Classes/Updates/UpdateSolrSchema.php @@ -16,6 +16,7 @@ use Solarium\Core\Client\Request; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Install\Attribute\UpgradeWizard; use TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite; use TYPO3\CMS\Install\Updates\UpgradeWizardInterface; @@ -27,22 +28,9 @@ * * @internal */ +#[UpgradeWizard('updateSolrSchema')] class UpdateSolrSchema implements UpgradeWizardInterface { - - /** - * Return the identifier for this wizard - * This should be the same string as used in the ext_localconf class registration - * - * @access public - * - * @return string - */ - public function getIdentifier(): string - { - return self::class; - } - /** * Return the speaking name of this wizard * @@ -161,7 +149,7 @@ private function getAllAffectedSolrCores(): array $allSolrCores = $queryBuilder->select('uid', 'index_name') ->from('tx_dlf_solrcores') - ->execute() + ->executeQuery() ->fetchAllAssociative(); $affectedSolrCores = []; diff --git a/Classes/ViewHelpers/MetadataWrapVariableViewHelper.php b/Classes/ViewHelpers/MetadataWrapVariableViewHelper.php index ac7cadd413..7d4a795388 100644 --- a/Classes/ViewHelpers/MetadataWrapVariableViewHelper.php +++ b/Classes/ViewHelpers/MetadataWrapVariableViewHelper.php @@ -13,7 +13,9 @@ use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; -use TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser; +use TYPO3\CMS\Core\EventDispatcher\NoopEventDispatcher; +use TYPO3\CMS\Core\TypoScript\AST\AstBuilder; +use TYPO3\CMS\Core\TypoScript\TypoScriptStringFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; /** @@ -68,12 +70,13 @@ public static function renderStatic( RenderingContextInterface $renderingContext ): void { - $parser = GeneralUtility::makeInstance(TypoScriptParser::class); - $parser->parse($renderChildrenClosure()); + $factory = GeneralUtility::makeInstance(TypoScriptStringFactory::class); + $rootNode = $factory->parseFromString($renderChildrenClosure(), new AstBuilder(new NoopEventDispatcher())); + $setup = $rootNode->toArray(); $wrap = [ - 'key' => $parser->setup['key.'] ?? [], - 'value' => $parser->setup['value.'] ?? [], - 'all' => $parser->setup['all.'] ?? [], + 'key' => $setup['key.'] ?? [], + 'value' => $setup['value.'] ?? [], + 'all' => $setup['all.'] ?? [], ]; $renderingContext->getVariableProvider()->add($arguments['name'], $wrap); } diff --git a/Classes/ViewHelpers/StdWrapViewHelper.php b/Classes/ViewHelpers/StdWrapViewHelper.php index 164b381993..afff9a8037 100644 --- a/Classes/ViewHelpers/StdWrapViewHelper.php +++ b/Classes/ViewHelpers/StdWrapViewHelper.php @@ -11,8 +11,7 @@ namespace Kitodo\Dlf\ViewHelpers; -use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Extbase\Configuration\ConfigurationManager; +use \RuntimeException; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; /** @@ -50,6 +49,7 @@ public function initializeArguments(): void * * @access public * + * @thorws RuntimeException if view helper is used outside of request context * @return string */ public function render(): string @@ -57,8 +57,13 @@ public function render(): string $wrap = $this->arguments['wrap']; $data = $this->arguments['data'] ?? []; - $configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class); - $cObj = $configurationManager->getContentObject(); + /** @var \TYPO3\CMS\Fluid\Core\Rendering\RenderingContext $renderingContext */ + $renderingContext = $this->renderingContext; + if (!$renderingContext->getRequest()) { + throw new RuntimeException('Required request not found in RenderingContext'); + } + $request = $renderingContext->getRequest(); + $cObj = $request->getAttribute('currentContentObject'); $insideContent = $this->renderChildren(); diff --git a/Configuration/FlexForms/AudioPlayer.xml b/Configuration/FlexForms/AudioPlayer.xml index 3ba57921f2..2204acee27 100644 --- a/Configuration/FlexForms/AudioPlayer.xml +++ b/Configuration/FlexForms/AudioPlayer.xml @@ -15,31 +15,25 @@ - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general - + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general array - - 1 - - - check - 1 - - + 1 + + + check + 1 + - - 1 - - - input - required,alphanum_x,nospace - tx-dlf-audio - - + 1 + + + input + required,alphanum_x,nospace + tx-dlf-audio + diff --git a/Configuration/FlexForms/Basket.xml b/Configuration/FlexForms/Basket.xml index 348d6205c3..f83e5a5906 100644 --- a/Configuration/FlexForms/Basket.xml +++ b/Configuration/FlexForms/Basket.xml @@ -15,104 +15,85 @@ - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general - + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general array - - 1 - - - check - 0 - - + 1 + + + check + 0 + - - 1 - - - input - required - - + 1 + + + input + required + - - 1 - - - input - required - - - + 1 + + + input + required + + - - 1 - - - input - required - - - + 1 + + + input + required + + - - 1 - - - input - required - ##docId##,##startpage##,##endpage##,##startx##,##starty##,##endx##,##endy##,##rotation## - - + 1 + + + input + required + ##docId##,##startpage##,##endpage##,##startx##,##starty##,##endx##,##endy##,##rotation## + - - 1 - - - input - required - * - - + 1 + + + input + required + * + - - 1 - - - check - 0 - - + 1 + + + check + 0 + - - 1 - - - group - db - pages - 1 - 1 - 1 - 1 - - - suggest - - - - + 1 + + + group + pages + 1 + 1 + 1 + 1 + + + suggest + + + diff --git a/Configuration/FlexForms/Calendar.xml b/Configuration/FlexForms/Calendar.xml index a73bfde134..947dbd63a6 100644 --- a/Configuration/FlexForms/Calendar.xml +++ b/Configuration/FlexForms/Calendar.xml @@ -15,70 +15,58 @@ - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general - + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general array - - 1 - - - group - db - pages - 1 - 1 - 0 - 1 - - - suggest - - - - + 1 + + + group + pages + 1 + 1 + 0 + 1 + + + suggest + + + - - 1 - - - group - db - tx_dlf_documents - 1 - 1 - 0 - 1 - - - suggest - - - - + 1 + + + group + tx_dlf_documents + 1 + 1 + 0 + 1 + + + suggest + + + - 1 - check - 0 + check + 0 - - 1 - check - 1 + check + 1 - diff --git a/Configuration/FlexForms/Collection.xml b/Configuration/FlexForms/Collection.xml index a6d4fc2aac..2d7a6eac9a 100644 --- a/Configuration/FlexForms/Collection.xml +++ b/Configuration/FlexForms/Collection.xml @@ -15,140 +15,119 @@ - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general - + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general array - - 1 - - - select - selectMultipleSideBySide - tx_dlf_collections - AND tx_dlf_collections.hidden = 0 AND tx_dlf_collections.sys_language_uid IN (-1,0) - ORDER BY tx_dlf_collections.label ASC - - 5 - 15 - 1024 - 0 - - + 1 + + + select + selectMultipleSideBySide + tx_dlf_collections + AND tx_dlf_collections.hidden = 0 AND tx_dlf_collections.sys_language_uid IN (-1,0) + ORDER BY tx_dlf_collections.label ASC + + 5 + 15 + 1024 + 0 + - - 1 - - - select - selectSingle - tx_dlf_solrcores - ORDER BY - tx_dlf_solrcores.label ASC - - 1 - 1 - 1 - - + 1 + + + select + selectSingle + tx_dlf_solrcores + ORDER BY + tx_dlf_solrcores.label ASC + + 1 + 1 + 1 + - - 1 - - - select - selectSingle - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.collection.flexform.show_userdefined.all - -1 - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.collection.flexform.show_userdefined.none - 0 - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.collection.flexform.show_userdefined.exclusive - 1 - - - 1 - 1 - 0 - - + 1 + + + select + selectSingle + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.collection.flexform.show_userdefined.all + -1 + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.collection.flexform.show_userdefined.none + 0 + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.collection.flexform.show_userdefined.exclusive + 1 + + + 1 + 1 + 0 + - - 1 - - - check - 0 - - + 1 + + + check + 0 + - - 1 - - - check - 0 - - + 1 + + + check + 0 + - - 1 - - - group - db - pages - 1 - 1 - 0 - 1 - - - suggest - - - - + 1 + + + group + pages + 1 + 1 + 0 + 1 + + + suggest + + + - - 1 - - - group - db - pages - 1 - 1 - 0 - - + 1 + + + group + pages + 1 + 1 + 0 + - - 1 - - - group - db - pages - 1 - 1 - 0 - - + 1 + + + group + pages + 1 + 1 + 0 + diff --git a/Configuration/FlexForms/Embedded3dViewer.xml b/Configuration/FlexForms/Embedded3dViewer.xml index 8838e5b51f..2eab4bffd5 100644 --- a/Configuration/FlexForms/Embedded3dViewer.xml +++ b/Configuration/FlexForms/Embedded3dViewer.xml @@ -15,40 +15,32 @@ - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general - + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general array - - 1 - - - input - trim - - + 1 + + + input + trim + - - 1 - - - input - trim - - + 1 + + + input + trim + - - 1 - - - input - trim - - + 1 + + + input + trim + diff --git a/Configuration/FlexForms/Feeds.xml b/Configuration/FlexForms/Feeds.xml index c533204a45..ef2241d8b0 100644 --- a/Configuration/FlexForms/Feeds.xml +++ b/Configuration/FlexForms/Feeds.xml @@ -15,116 +15,97 @@ - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general - + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general array - - 1 - - - select - selectMultipleSideBySide - tx_dlf_collections - AND tx_dlf_collections.hidden = 0 AND tx_dlf_collections.sys_language_uid IN (-1,0) - ORDER BY tx_dlf_collections.label ASC - - 5 - 15 - 1024 - 0 - - + 1 + + + select + selectMultipleSideBySide + tx_dlf_collections + AND tx_dlf_collections.hidden = 0 AND tx_dlf_collections.sys_language_uid IN (-1,0) + ORDER BY tx_dlf_collections.label ASC + + 5 + 15 + 1024 + 0 + - - 1 - - - check - 0 - - + 1 + + + check + 0 + - - 1 - - - select - selectSingle - tx_dlf_libraries - AND tx_dlf_libraries.sys_language_uid IN (-1,0) - ORDER BY tx_dlf_libraries.label ASC - - 1 - 1 - 0 - - + 1 + + + select + selectSingle + tx_dlf_libraries + AND tx_dlf_libraries.sys_language_uid IN (-1,0) + ORDER BY tx_dlf_libraries.label ASC + + 1 + 1 + 0 + - - 1 - - - input - required,num,int - 50 - - + 1 + + + input + required,num,int + 50 + - - 1 - - - check - 0 - - + 1 + + + check + 0 + - - 1 - - - group - db - pages - 1 - 1 - 1 - 1 - - - suggest - - - - + 1 + + + group + pages + 1 + 1 + 1 + 1 + + + suggest + + + - - 1 - - - input - required,trim - - + 1 + + + input + required,trim + - - 1 - - - input - trim - - + 1 + + + input + trim + diff --git a/Configuration/FlexForms/ListView.xml b/Configuration/FlexForms/ListView.xml index 69439b9c5c..111c3152b7 100644 --- a/Configuration/FlexForms/ListView.xml +++ b/Configuration/FlexForms/ListView.xml @@ -15,92 +15,76 @@ - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general - + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general array - - 1 - - - select - selectSingle - tx_dlf_solrcores - ORDER BY tx_dlf_solrcores.label ASC - 1 - 1 - 0 - - + 1 + + + select + selectSingle + tx_dlf_solrcores + ORDER BY tx_dlf_solrcores.label ASC + 1 + 1 + 0 + - - 1 - - - input - required,num,int - 25 - - + 1 + + + input + required,num,int + 25 + - - 1 - - - group - db - pages - 1 - 1 - 1 - 1 - - - suggest - - - - + 1 + + + group + pages + 1 + 1 + 1 + 1 + + + suggest + + + - - 1 - - - check - 0 - - + 1 + + + check + 0 + - - reload - 1 - - - check - 0 - - + reload + 1 + + + check + 0 + - - FIELD:settings.basketButton:REQ:true - 1 - - - group - db - pages - 1 - 1 - 1 - - + FIELD:settings.basketButton:REQ:true + 1 + + + group + pages + 1 + 1 + 1 + diff --git a/Configuration/FlexForms/MediaPlayer.xml b/Configuration/FlexForms/MediaPlayer.xml index 10e1646bcc..f280fb9e6b 100644 --- a/Configuration/FlexForms/MediaPlayer.xml +++ b/Configuration/FlexForms/MediaPlayer.xml @@ -15,31 +15,25 @@ - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general - + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general array - - 1 - - - check - 1 - - + 1 + + + check + 1 + - - 1 - - - input - required,alphanum_x,nospace - tx-dlf-video - - + 1 + + + input + required,alphanum_x,nospace + tx-dlf-video + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.mediaplayer.flexform.shareButtons.title @@ -51,99 +45,85 @@ array - - - reload - - select - selectSingle - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.mediaplayer.flexform.shareButtons.type.material - material - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.mediaplayer.flexform.shareButtons.type.image - image - - - - + + reload + + select + selectSingle + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.mediaplayer.flexform.shareButtons.type.material + material + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.mediaplayer.flexform.shareButtons.type.image + image + + + - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.mediaplayer.flexform.shareButtons.icon.description - - FIELD:type:=:material - - - input - 255 - trim - - + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.mediaplayer.flexform.shareButtons.icon.description + + FIELD:type:=:material + + + input + 255 + trim + - - - - FIELD:type:=:image - - - input - 255 - trim - - + + + FIELD:type:=:image + + + input + 255 + trim + - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.mediaplayer.flexform.shareButtons.titleTranslationKey.description - - input - 255 - trim - - + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.mediaplayer.flexform.shareButtons.titleTranslationKey.description + + input + 255 + trim + - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.mediaplayer.flexform.shareButtons.hrefTemplate.description - - input - 255 - trim - - + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.mediaplayer.flexform.shareButtons.hrefTemplate.description + + input + 255 + trim + - - 1 - - - check - 1 - - + 1 + + + check + 1 + - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.mediaplayer.flexform.constants.prevChapterTolerance.description - - input - required,num,int - 5 - 0 - - + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.mediaplayer.flexform.constants.prevChapterTolerance.description + + input + required,num,int + 5 + 0 + diff --git a/Configuration/FlexForms/Metadata.xml b/Configuration/FlexForms/Metadata.xml index 34b9f1a1c5..4d0f06f0a2 100644 --- a/Configuration/FlexForms/Metadata.xml +++ b/Configuration/FlexForms/Metadata.xml @@ -15,166 +15,139 @@ - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general - + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general array - - 1 - - - check - 1 - - + 1 + + + check + 1 + - - reload - 1 - - - check - 1 - - + reload + 1 + + + check + 1 + - - FIELD:settings.linkTitle:REQ:true - 1 - - - group - db - pages - 1 - 1 - 0 - 1 - - - suggest - - - - + FIELD:settings.linkTitle:REQ:true + 1 + + + group + pages + 1 + 1 + 0 + 1 + + + suggest + + + - - 1 - - - check - 1 - - + 1 + + + check + 1 + - - 1 - - - check - 1 - - + 1 + + + check + 1 + - - 1 - - - select - selectSingle - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:text.none - 0 - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:text.all - 1 - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.metadata.flexform.rootline.titledata - 2 - - - 1 - 1 - 1 - 0 - - + 1 + + + select + selectSingle + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:text.none + 0 + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:text.all + 1 + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.metadata.flexform.rootline.titledata + 2 + + + 1 + 1 + 1 + 0 + - - 1 - - reload - - check - 0 - - + 1 + + reload + + check + 0 + - - 1 - - FIELD:settings.originalIiifMetadata:=:1 - - text - key.wrap = <dt>|</dt> value.required = 1 value.wrap = <dd>|</dd> - - + 1 + + FIELD:settings.originalIiifMetadata:=:1 + + text + key.wrap = <dt>|</dt> value.required = 1 value.wrap = <dd>|</dd> + - - 1 - - FIELD:settings.originalIiifMetadata:=:1 - - check - 1 - - + 1 + + FIELD:settings.originalIiifMetadata:=:1 + + check + 1 + - - 1 - - FIELD:settings.originalIiifMetadata:=:1 - - check - 1 - - + 1 + + FIELD:settings.originalIiifMetadata:=:1 + + check + 1 + - - 1 - - FIELD:settings.originalIiifMetadata:=:1 - - check - 1 - - + 1 + + FIELD:settings.originalIiifMetadata:=:1 + + check + 1 + - - 1 - - - input - required,trim - # - - + 1 + + + input + required,trim + # + diff --git a/Configuration/FlexForms/Navigation.xml b/Configuration/FlexForms/Navigation.xml index 72142da70b..b31e740d3c 100644 --- a/Configuration/FlexForms/Navigation.xml +++ b/Configuration/FlexForms/Navigation.xml @@ -15,116 +15,107 @@ - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general - + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general array - - 1 - - - select - selectMultipleSideBySide - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.doublePage - doublePage - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.pageFirst - pageFirst - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.pageBack - pageBack - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.pageStepBack - pageStepBack - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.pageSelect - pageSelect - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.pageForward - pageForward - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.pageStepForward - pageStepForward - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.pageLast - pageLast - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.listView - listView - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.zoom - zoom - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.rotation - rotation - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.measureForward - measureForward - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.measureBack - measureBack - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.documentBack - documentBack - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.documentForward - documentForward - - - doublePage,pageFirst,pageBack,pageStepBack,pageSelect,pageForward,pageStepForward,pageLast,listView,zoom,rotation,measureForward,measureBack,documentBack,documentForward - 1 - - + 1 + + + select + selectMultipleSideBySide + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.doublePage + doublePage + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.pageFirst + pageFirst + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.pageBack + pageBack + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.pageStepBack + pageStepBack + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.pageSelect + pageSelect + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.pageForward + pageForward + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.pageStepForward + pageStepForward + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.pageLast + pageLast + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.listView + listView + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.zoom + zoom + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.rotation + rotation + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.measureForward + measureForward + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.measureBack + measureBack + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.documentBack + documentBack + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.flexform.features.documentForward + documentForward + + + doublePage,pageFirst,pageBack,pageStepBack,pageSelect,pageForward,pageStepForward,pageLast,listView,zoom,rotation,measureForward,measureBack,documentBack,documentForward + 1 + - - 1 - - - input - required,num,int - 5 - - + 1 + + + input + required,num,int + 5 + - - 1 - FIELD:settings.features:IN:listView - - - group - db - pages - 1 - 1 - 0 - 1 - - - suggest - - - - + 1 + FIELD:settings.features:IN:listView + + + group + pages + 1 + 1 + 0 + 1 + + + suggest + + + diff --git a/Configuration/FlexForms/OaiPmh.xml b/Configuration/FlexForms/OaiPmh.xml index 8de01739e9..bb621b0ae3 100644 --- a/Configuration/FlexForms/OaiPmh.xml +++ b/Configuration/FlexForms/OaiPmh.xml @@ -15,154 +15,138 @@ - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general - + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general array - - 1 - - - select - selectSingle - tx_dlf_libraries - AND tx_dlf_libraries.sys_language_uid IN (-1,0) - ORDER BY tx_dlf_libraries.label ASC - - 1 - 1 - 0 - - + 1 + + + select + selectSingle + tx_dlf_libraries + AND tx_dlf_libraries.sys_language_uid IN (-1,0) + ORDER BY tx_dlf_libraries.label ASC + + 1 + 1 + 0 + - - 1 - - - input - required,num,int - 5 - - + 1 + + + input + required,num,int + 5 + - - 1 - - - input - required,num,int - 1800 - - + 1 + + + input + required,num,int + 1800 + - - 1 - - - check - 0 - - + 1 + + + check + 0 + - - 1 - - - select - selectSingle - tx_dlf_solrcores - ORDER BY tx_dlf_solrcores.label ASC - 1 - 1 - 0 - - + 1 + + + select + selectSingle + tx_dlf_solrcores + ORDER BY tx_dlf_solrcores.label ASC + 1 + 1 + 0 + - - 1 - - - input - required,num,int - 50000 - - + 1 + + + input + required,num,int + 50000 + - - 1 - - - inline - 1 - sys_file_reference - tablenames - uid_local - sorting_foreign - uid_foreign - uid_local - - - - file - xsl,xslt - - - - - - --palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette - + 1 + + + inline + 1 + sys_file_reference + tablenames + uid_local + sorting_foreign + uid_foreign + uid_local + + + + file + xsl,xslt + + + + + + --palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette + + + --palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette + + + + stylesheet + + + 1 + + 1 + 0 + 0 + 1 + 0 + 1 + 1 + + LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:media.addFileReference + + + select + 1 + + + + + + + file + xsl,xslt + + + + + --palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette - - - stylesheet - - - 1 - - 1 - 0 - 0 - 1 - 0 - 1 - 1 - - LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:media.addFileReference - - - select - 1 - - - - - - - file - xsl,xslt - - - - - - - --palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette - - - - - + + + diff --git a/Configuration/FlexForms/PageGrid.xml b/Configuration/FlexForms/PageGrid.xml index a4540ee96c..c922e379bf 100644 --- a/Configuration/FlexForms/PageGrid.xml +++ b/Configuration/FlexForms/PageGrid.xml @@ -15,115 +15,106 @@ - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general - + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general array - - 1 - - - input - required,num,int - 24 - - + 1 + + + input + required,num,int + 24 + - - 1 - - - inline - 1 - sys_file_reference - tablenames - uid_local - sorting_foreign - uid_foreign - uid_local - - - - file - gif,jpg,jpeg,png - - - - - - --palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette - + 1 + + + inline + 1 + sys_file_reference + tablenames + uid_local + sorting_foreign + uid_foreign + uid_local + + + + file + gif,jpg,jpeg,png + + + + + + --palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette + + + --palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette + + + + image + + + 1 + + uid_local + 64 + 64 + + + 1 + 0 + 0 + 1 + 0 + 1 + 1 + + LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference + + + select + 1 + + + + + + + file + jpg,png,jpeg,gif + + + + + --palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette - - - image - - - 1 - - uid_local - 64 - 64 - - - 1 - 0 - 0 - 1 - 0 - 1 - 1 - - LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference - - - select - 1 - - - - - - - file - jpg,png,jpeg,gif - - - - - - - --palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette - - - - - + + + - - 1 - - - group - db - pages - 1 - 1 - 1 - 1 - - - suggest - - - - + 1 + + + group + pages + 1 + 1 + 1 + 1 + + + suggest + + + diff --git a/Configuration/FlexForms/PageView.xml b/Configuration/FlexForms/PageView.xml index 67cf8d7698..a635866ad1 100644 --- a/Configuration/FlexForms/PageView.xml +++ b/Configuration/FlexForms/PageView.xml @@ -15,141 +15,118 @@ - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general - + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general array - - 1 - - - check - 1 - - + 1 + + + check + 1 + - - 1 - - - select - selectMultipleSideBySide - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.pageview.flexform.features.overviewmap - OverviewMap - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.pageview.flexform.features.zoompanel - ZoomPanel - - - 5 - 15 - 25 - 0 - - + 1 + + + select + selectMultipleSideBySide + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.pageview.flexform.features.overviewmap + OverviewMap + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.pageview.flexform.features.zoompanel + ZoomPanel + + + 5 + 15 + 25 + 0 + - - 1 - - - input - required,alphanum_x,nospace - tx-dlf-map - - + 1 + + + input + required,alphanum_x,nospace + tx-dlf-map + - - 1 - - - input - required,alphanum_x,nospace - tx-dlf-page-progress - - + 1 + + + input + required,alphanum_x,nospace + tx-dlf-page-progress + - - 1 - - - check - 0 - - + 1 + + + check + 0 + - - 1 - - reload - - check - 0 - - + 1 + + reload + + check + 0 + - - 1 - - FIELD:settings.basketButton:REQ:TRUE - - check - 0 - - + 1 + + FIELD:settings.basketButton:REQ:TRUE + + check + 0 + - - 1 - - FIELD:settings.basketButton:REQ:TRUE - - check - 0 - - + 1 + + FIELD:settings.basketButton:REQ:TRUE + + check + 0 + - - 1 - - FIELD:settings.basketButton:REQ:TRUE - - group - db - pages - 1 - 1 - 0 - 1 - - - suggest - - - - + 1 + + FIELD:settings.basketButton:REQ:TRUE + + group + pages + 1 + 1 + 0 + 1 + + + suggest + + + - - 1 - - - input - nospace - - - + 1 + + + input + nospace + + diff --git a/Configuration/FlexForms/Search.xml b/Configuration/FlexForms/Search.xml index e85f1cd055..ae6859b205 100644 --- a/Configuration/FlexForms/Search.xml +++ b/Configuration/FlexForms/Search.xml @@ -15,295 +15,255 @@ - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general - + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general array - - 1 - - - radio - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:text.yes - 1 - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:text.no - 0 - - - 1 - 1 - - + 1 + + + radio + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:text.yes + 1 + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:text.no + 0 + + + 1 + 1 + - - 1 - - - check - 0 - - + 1 + + + check + 0 + - - 1 - - - check - 0 - - + 1 + + + check + 0 + - - 1 - - - select - selectSingle - tx_dlf_solrcores - ORDER BY tx_dlf_solrcores.label ASC - 1 - 1 - 0 - - + 1 + + + select + selectSingle + tx_dlf_solrcores + ORDER BY tx_dlf_solrcores.label ASC + 1 + 1 + 0 + - - 1 - - - input - num,int - - 0 - 10 - - 0 - - + 1 + + + input + num,int + + 0 + 10 + + 0 + - - 1 - - - select - selectMultipleSideBySide - - Kitodo\Dlf\Hooks\ItemsProcFunc->extendedSearchList - 5 - 15 - 10 - 0 - - + 1 + + + select + selectMultipleSideBySide + + Kitodo\Dlf\Hooks\ItemsProcFunc->extendedSearchList + 5 + 15 + 10 + 0 + - - 1 - - - select - selectSingle - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:text.none - none - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.search.flexform.searchIn.document - document - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.search.flexform.searchIn.collection - collection - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.search.flexform.searchIn.all - all - - - 1 - 1 - 0 - - + 1 + + + select + selectSingle + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:text.none + none + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.search.flexform.searchIn.document + document + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.search.flexform.searchIn.collection + collection + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.search.flexform.searchIn.all + all + + + 1 + 1 + 0 + - - 1 - - - select - selectMultipleSideBySide - tx_dlf_collections - AND tx_dlf_collections.hidden = 0 AND tx_dlf_collections.sys_language_uid IN (-1,0) - ORDER BY tx_dlf_collections.label ASC - - 5 - 15 - Kitodo\Dlf\Hooks\ItemsProcFunc->getFacetsList - - 1024 - 0 - - + 1 + + + select + selectMultipleSideBySide + tx_dlf_collections + AND tx_dlf_collections.hidden = 0 AND tx_dlf_collections.sys_language_uid IN (-1,0) + ORDER BY tx_dlf_collections.label ASC + + 5 + 15 + + Kitodo\Dlf\Hooks\ItemsProcFunc->getFacetsList + 1024 + 0 + - - 1 - - - select - selectMultipleSideBySide - - Kitodo\Dlf\Hooks\ItemsProcFunc->getFacetsList - 5 - 15 - 1024 - 0 - - + 1 + + + select + selectMultipleSideBySide + + Kitodo\Dlf\Hooks\ItemsProcFunc->getFacetsList + 5 + 15 + 1024 + 0 + - - 1 - - - select - selectMultipleSideBySide - tx_dlf_collections - AND tx_dlf_collections.hidden = 0 AND tx_dlf_collections.sys_language_uid IN (-1,0) - ORDER BY tx_dlf_collections.label ASC - - 5 - 15 - 1024 - 0 - - + 1 + + + select + selectMultipleSideBySide + tx_dlf_collections + AND tx_dlf_collections.hidden = 0 AND tx_dlf_collections.sys_language_uid IN (-1,0) + ORDER BY tx_dlf_collections.label ASC + + 5 + 15 + 1024 + 0 + - - 1 - - - input - num,int - - 1 - 50000 - - 15 - - + 1 + + + input + num,int + + 1 + 50000 + + 15 + - - 1 - - - check - 0 - - + 1 + + + check + 0 + - - 1 - - - select - selectSingle - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.search.flexform.facets.sorting.count - count - - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.search.flexform.facets.sorting.index - index - - - 1 - 1 - 0 - - + 1 + + + select + selectSingle + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.search.flexform.facets.sorting.count + count + + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.search.flexform.facets.sorting.index + index + + + 1 + 1 + 0 + - - 1 - - - check - 1 - - + 1 + + + check + 1 + - - 1 - - - check - 0 - - + 1 + + + check + 0 + - - reload - 1 - - - check - 0 - - + reload + 1 + + + check + 0 + - - 1 - - - group - db - pages - 1 - 1 - 0 - 1 - - - suggest - - - - + 1 + + + group + pages + 1 + 1 + 0 + 1 + + + suggest + + + - 0 - 1 - - - group - db - pages - 1 - 1 - 0 - - + 1 + + + group + pages + 1 + 1 + 0 + diff --git a/Configuration/FlexForms/Statistics.xml b/Configuration/FlexForms/Statistics.xml index 90d3df5ce8..7dcbfa95e6 100644 --- a/Configuration/FlexForms/Statistics.xml +++ b/Configuration/FlexForms/Statistics.xml @@ -15,41 +15,35 @@ - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general - + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general array - - 1 - - - select - selectMultipleSideBySide - tx_dlf_collections - AND tx_dlf_collections.hidden = 0 AND tx_dlf_collections.sys_language_uid IN (-1,0) - ORDER BY tx_dlf_collections.label ASC - - 5 - 15 - 1024 - 0 - - + 1 + + + select + selectMultipleSideBySide + tx_dlf_collections + AND tx_dlf_collections.hidden = 0 AND tx_dlf_collections.sys_language_uid IN (-1,0) + ORDER BY tx_dlf_collections.label ASC + + 5 + 15 + 1024 + 0 + - - 1 - - - text - 30 - 10 - virtual - - richtext[undo,redo,cut,copy,paste,link,image,line,acronym,chMode,blockstylelabel,formatblock,blockstyle,textstylelabel,textstyle,bold,italic,unorderedlist,orderedlist]:rte_transform[mode=ts_css] - + 1 + + + text + 30 + 10 + virtual + + richtext[undo,redo,cut,copy,paste,link,image,line,acronym,chMode,blockstylelabel,formatblock,blockstyle,textstylelabel,textstyle,bold,italic,unorderedlist,orderedlist]:rte_transform[mode=ts_css] diff --git a/Configuration/FlexForms/TableOfContents.xml b/Configuration/FlexForms/TableOfContents.xml index 179b18e0b5..dfcf01b001 100644 --- a/Configuration/FlexForms/TableOfContents.xml +++ b/Configuration/FlexForms/TableOfContents.xml @@ -15,80 +15,66 @@ - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general - + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general array - - 1 - - - check - 1 - - + 1 + + + check + 1 + - - 1 - - - check - 0 - - + 1 + + + check + 0 + - - 1 - - - group - db - pages - 1 - 1 - 0 - 1 - - - suggest - - - - + 1 + + + group + pages + 1 + 1 + 0 + 1 + + + suggest + + + - - 1 - - - group - db - pages - 1 - 1 - 0 - 1 - - - suggest - - - - + 1 + + + group + pages + 1 + 1 + 0 + 1 + + + suggest + + + - - 1 - - - check - 0 - - + 1 + + + check + 0 + diff --git a/Configuration/FlexForms/Toolbox.xml b/Configuration/FlexForms/Toolbox.xml index a11916c73c..e9208ee797 100644 --- a/Configuration/FlexForms/Toolbox.xml +++ b/Configuration/FlexForms/Toolbox.xml @@ -15,42 +15,36 @@ - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general - + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general array - - 1 - - - select - selectMultipleSideBySide - - Kitodo\Dlf\Hooks\ItemsProcFunc->toolList - 5 - 15 - 1024 - 1 - 1 - - + 1 + + + select + selectMultipleSideBySide + + Kitodo\Dlf\Hooks\ItemsProcFunc->toolList + 5 + 15 + 1024 + 1 + 1 + - - 1 - - - select - selectSingle - tx_dlf_solrcores - ORDER BY tx_dlf_solrcores.label ASC - 1 - 1 - 0 - - + 1 + + + select + selectSingle + tx_dlf_solrcores + ORDER BY tx_dlf_solrcores.label ASC + 1 + 1 + 0 + diff --git a/Configuration/FlexForms/ValidationForm.xml b/Configuration/FlexForms/ValidationForm.xml index 2411cd021b..e2145c50fa 100644 --- a/Configuration/FlexForms/ValidationForm.xml +++ b/Configuration/FlexForms/ValidationForm.xml @@ -15,21 +15,17 @@ - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general - + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general array - - 1 - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.validationform.flexform.type.description - - input - required,trim - - + 1 + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.validationform.flexform.type.description + + input + required,trim + diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index d9bcc950a2..1644c6046c 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -42,6 +42,9 @@ services: - name: console.command command: 'kitodo:suggestBuild' + Kitodo\Dlf\Common\TypoScriptHelper: + public: true + Kitodo\Dlf\Validation\DOMDocumentValidationStack: autowire: false diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index f7441d5ada..3019a93286 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -19,7 +19,7 @@ $flexFormsPathPrefix = 'FILE:EXT:dlf/Configuration/FlexForms/'; $iconsDirectory = 'EXT:dlf/Resources/Public/Icons/'; -$pluginsLabel = 'EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.'; +$pluginsLabel = 'LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.'; // Plugin "annotation". \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( @@ -132,7 +132,7 @@ \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( 'Dlf', 'ValidationForm', - $pluginsLabel . 'validation.title', + $pluginsLabel . 'validationform.title', $iconsDirectory . 'tx-dlf-validationform.svg' ); diff --git a/Configuration/TCA/tx_dlf_actionlog.php b/Configuration/TCA/tx_dlf_actionlog.php index 5d7b8c08fb..81988bd8a7 100644 --- a/Configuration/TCA/tx_dlf_actionlog.php +++ b/Configuration/TCA/tx_dlf_actionlog.php @@ -15,7 +15,6 @@ 'title' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_actionlog', 'label' => 'label', 'crdate' => 'crdate', - 'cruser_id' => 'user_id', 'default_sortby' => 'ORDER BY label', 'delete' => 'deleted', 'iconfile' => 'EXT:dlf/Resources/Public/Icons/txdlfreport.png', @@ -33,7 +32,8 @@ 'type' => 'input', 'size' => 30, 'max' => 255, - 'eval' => 'required,trim', + 'required' => true, + 'eval' => 'trim', 'default' => '', ], ], @@ -43,7 +43,10 @@ 'type' => 'select', 'renderType' => 'selectSingle', 'items' => [ - ['LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_collections.fe_cruser_id.none', 0], + [ + 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_collections.fe_cruser_id.none', + 'value' => 0, + ], ], 'foreign_table' => 'fe_users', 'foreign_table_where' => 'ORDER BY fe_users.username', @@ -66,10 +69,9 @@ 'count_pages' => [ 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_actionlog.count_pages', 'config' => [ - 'type' => 'input', + 'type' => 'number', 'size' => 30, - 'max' => 11, - 'eval' => 'num,int', + 'format' => 'integer', 'default' => 0, ], ], diff --git a/Configuration/TCA/tx_dlf_basket.php b/Configuration/TCA/tx_dlf_basket.php index c7b7d985cf..38e093d0b1 100644 --- a/Configuration/TCA/tx_dlf_basket.php +++ b/Configuration/TCA/tx_dlf_basket.php @@ -34,7 +34,8 @@ 'type' => 'input', 'size' => 30, 'max' => 255, - 'eval' => 'required,trim', + 'required' => true, + 'eval' => 'trim', 'default' => '', ], ], diff --git a/Configuration/TCA/tx_dlf_collections.php b/Configuration/TCA/tx_dlf_collections.php index 415870ac3c..e1888c0c6b 100644 --- a/Configuration/TCA/tx_dlf_collections.php +++ b/Configuration/TCA/tx_dlf_collections.php @@ -16,7 +16,6 @@ 'label' => 'label', 'tstamp' => 'tstamp', 'crdate' => 'crdate', - 'cruser_id' => 'cruser_id', 'fe_cruser_id' => 'fe_cruser_id', 'fe_admin_lock' => 'fe_admin_lock', 'languageField' => 'sys_language_uid', @@ -51,7 +50,10 @@ 'foreign_table' => 'tx_dlf_collections', 'foreign_table_where' => 'AND tx_dlf_collections.pid=###CURRENT_PID### AND tx_dlf_collections.sys_language_uid IN (-1,0)', 'items' => [ - ['', 0], + [ + 'label' => '', + 'value' => 0, + ], ], 'default' => 0, ], @@ -77,9 +79,18 @@ 'renderType' => 'selectMultipleSideBySide', 'foreign_table' => 'fe_groups', 'items' => [ - ['LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hide_at_login', '-1'], - ['LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.any_login', '-2'], - ['LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.usergroups', '--div--'], + [ + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hide_at_login', + 'value' => '-1', + ], + [ + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.any_login', + 'value' => '-2', + ], + [ + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.usergroups', + 'value' => '--div--', + ], ], 'size' => 5, 'autoSizeMax' => 15, @@ -96,7 +107,8 @@ 'type' => 'input', 'size' => 30, 'max' => 255, - 'eval' => 'required,trim', + 'required' => true, + 'eval' => 'trim', 'default' => '', ], ], @@ -108,7 +120,8 @@ 'type' => 'input', 'size' => 30, 'max' => 255, - 'eval' => 'required,uniqueInPid', + 'required' => true, + 'eval' => 'uniqueInPid', 'default' => '', 'fieldInformation' => [ 'editInProductionWarning' => [ @@ -162,19 +175,17 @@ 'exclude' => 1, 'l10n_mode' => 'exclude', 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_collections.thumbnail', - 'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig( - 'image', - [ - 'appearance' => [ - 'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference' - ], - 'foreign_match_fields' => [ - 'fieldname' => 'thumbnail', - 'tablenames' => 'tx_dlf_collections', - ], + 'config' => [ + 'type' => 'file', + 'appearance' => [ + 'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference' + ], + 'foreign_match_fields' => [ + 'fieldname' => 'thumbnail', + 'tablenames' => 'tx_dlf_collections', ], - $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] - ) + 'allowed' => 'common-image-types' + ], ], 'priority' => [ 'exclude' => 1, @@ -184,11 +195,26 @@ 'type' => 'select', 'renderType' => 'selectSingle', 'items' => [ - ['1', 1], - ['2', 2], - ['3', 3], - ['4', 4], - ['5', 5], + [ + 'label' => '1', + 'value' => 1, + ], + [ + 'label' => '2', + 'value' => 2, + ], + [ + 'label' => '3', + 'value' => 3, + ], + [ + 'label' => '4', + 'value' => 4, + ], + [ + 'label' => '5', + 'value' => 5, + ], ], 'size' => 1, 'minitems' => 1, @@ -226,7 +252,10 @@ 'type' => 'select', 'renderType' => 'selectSingle', 'items' => [ - ['LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_collections.owner.none', 0], + [ + 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_collections.owner.none', + 'value' => 0, + ], ], 'foreign_table' => 'tx_dlf_libraries', 'foreign_table_where' => 'AND tx_dlf_libraries.sys_language_uid IN (-1,0) ORDER BY tx_dlf_libraries.label', @@ -244,7 +273,10 @@ 'type' => 'select', 'renderType' => 'selectSingle', 'items' => [ - ['LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_collections.fe_cruser_id.none', 0], + [ + 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_collections.fe_cruser_id.none', + 'value' => 0, + ], ], 'foreign_table' => 'fe_users', 'foreign_table_where' => 'ORDER BY fe_users.username', @@ -271,7 +303,10 @@ 'type' => 'select', 'renderType' => 'selectSingle', 'items' => [ - ['LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_collections.status.default', 0], + [ + 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_collections.status.default', + 'value' => 0, + ], ], 'size' => 1, 'minitems' => 1, diff --git a/Configuration/TCA/tx_dlf_documents.php b/Configuration/TCA/tx_dlf_documents.php index 2ae6d5c3d2..73d84e377c 100644 --- a/Configuration/TCA/tx_dlf_documents.php +++ b/Configuration/TCA/tx_dlf_documents.php @@ -16,7 +16,6 @@ 'label' => 'title', 'tstamp' => 'tstamp', 'crdate' => 'crdate', - 'cruser_id' => 'cruser_id', 'default_sortby' => 'ORDER BY title_sorting', 'delete' => 'deleted', 'enablecolumns' => [ @@ -45,27 +44,21 @@ 'tstamp' => [ 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.timestamp', 'config' => [ - 'type' => 'input', - 'renderType' => 'inputDateTime', - 'eval' => 'datetime', + 'type' => 'datetime', ] ], 'crdate' => [ 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.creationDate', 'config' => [ - 'type' => 'input', - 'renderType' => 'inputDateTime', - 'eval' => 'datetime', + 'type' => 'datetime', ] ], 'starttime' => [ 'exclude' => 1, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime', 'config' => [ - 'type' => 'input', - 'renderType' => 'inputDateTime', + 'type' => 'datetime', 'size' => 13, - 'eval' => 'datetime', 'default' => 0, ], ], @@ -73,10 +66,8 @@ 'exclude' => 1, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime', 'config' => [ - 'type' => 'input', - 'renderType' => 'inputDateTime', + 'type' => 'datetime', 'size' => 13, - 'eval' => 'datetime', 'default' => 0, ], ], @@ -87,9 +78,18 @@ 'type' => 'select', 'renderType' => 'selectMultipleSideBySide', 'items' => [ - ['LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hide_at_login', '-1'], - ['LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.any_login', '-2'], - ['LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.usergroups', '--div--'], + [ + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hide_at_login', + 'value' => '-1', + ], + [ + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.any_login', + 'value' => '-2', + ], + [ + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.usergroups', + 'value' => '--div--', + ], ], 'foreign_table' => 'fe_groups', 'size' => 5, @@ -118,7 +118,8 @@ 'type' => 'input', 'size' => 30, 'max' => 255, - 'eval' => 'required,uniqueInPid', + 'required' => true, + 'eval' => 'uniqueInPid', 'default' => '', ], ], @@ -258,7 +259,6 @@ 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_documents.partof', 'config' => [ 'type' => 'group', - 'internal_type' => 'db', 'allowed' => 'tx_dlf_documents', 'prepend_tname' => 0, 'size' => 1, @@ -419,7 +419,10 @@ 'type' => 'select', 'renderType' => 'selectSingle', 'items' => [ - ['LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_documents.status.default', 0], + [ + 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_documents.status.default', + 'value' => 0, + ], ], 'size' => 1, 'minitems' => 1, @@ -434,8 +437,14 @@ 'type' => 'select', 'renderType' => 'selectSingle', 'items' => [ - ['LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_documents.document_format.mets', 'METS'], - ['LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_documents.document_format.iiif', 'IIIF'], + [ + 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_documents.document_format.mets', + 'value' => 'METS', + ], + [ + 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_documents.document_format.iiif', + 'value' => 'IIIF', + ], ], 'size' => 1, 'minitems' => 1, diff --git a/Configuration/TCA/tx_dlf_formats.php b/Configuration/TCA/tx_dlf_formats.php index 4f6d38664c..333e331cee 100644 --- a/Configuration/TCA/tx_dlf_formats.php +++ b/Configuration/TCA/tx_dlf_formats.php @@ -16,7 +16,6 @@ 'label' => 'type', 'tstamp' => 'tstamp', 'crdate' => 'crdate', - 'cruser_id' => 'cruser_id', 'default_sortby' => 'ORDER BY type', 'delete' => 'deleted', 'iconfile' => 'EXT:dlf/Resources/Public/Icons/txdlfformats.png', @@ -32,7 +31,8 @@ 'type' => 'input', 'size' => 30, 'max' => 255, - 'eval' => 'required,nospace,alphanum_x,uniqueInPid', + 'required' => true, + 'eval' => 'nospace,alphanum_x,uniqueInPid', 'default' => '', ], ], @@ -42,7 +42,8 @@ 'type' => 'input', 'size' => 30, 'max' => 255, - 'eval' => 'required,nospace,alphanum_x,uniqueInPid', + 'required' => true, + 'eval' => 'nospace,alphanum_x,uniqueInPid', 'default' => '', ], ], @@ -52,7 +53,8 @@ 'type' => 'input', 'size' => 30, 'max' => 255, - 'eval' => 'required,nospace', + 'required' => true, + 'eval' => 'nospace', 'default' => '', ], ], diff --git a/Configuration/TCA/tx_dlf_libraries.php b/Configuration/TCA/tx_dlf_libraries.php index 93507d960c..48a573e52f 100644 --- a/Configuration/TCA/tx_dlf_libraries.php +++ b/Configuration/TCA/tx_dlf_libraries.php @@ -16,7 +16,6 @@ 'label' => 'label', 'tstamp' => 'tstamp', 'crdate' => 'crdate', - 'cruser_id' => 'cruser_id', 'languageField' => 'sys_language_uid', 'transOrigPointerField' => 'l18n_parent', 'transOrigDiffSourceField' => 'l18n_diffsource', @@ -45,7 +44,10 @@ 'foreign_table' => 'tx_dlf_libraries', 'foreign_table_where' => 'AND tx_dlf_libraries.pid=###CURRENT_PID### AND tx_dlf_libraries.sys_language_uid IN (-1,0)', 'items' => [ - ['', 0], + [ + 'label' => '', + 'value' => 0, + ], ], 'default' => 0, ], @@ -62,7 +64,8 @@ 'type' => 'input', 'size' => 30, 'max' => 255, - 'eval' => 'required,trim', + 'required' => true, + 'eval' => 'trim', 'default' => '', ], ], @@ -74,7 +77,8 @@ 'type' => 'input', 'size' => 30, 'max' => 255, - 'eval' => 'required,uniqueInPid', + 'required' => true, + 'eval' => 'uniqueInPid', 'default' => '', 'fieldInformation' => [ 'editInProductionWarning' => [ @@ -109,11 +113,13 @@ 'exclude' => 1, 'l10n_mode' => 'exclude', 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_libraries.image', - 'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('image', [ + 'config' => [ + 'type' => 'file', 'appearance' => [ 'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference' ], - ], $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']), + 'allowed' => 'common-image-types' + ], ], 'oai_label' => [ 'exclude' => 1, diff --git a/Configuration/TCA/tx_dlf_mail.php b/Configuration/TCA/tx_dlf_mail.php index b8cd2a4756..61d2743085 100644 --- a/Configuration/TCA/tx_dlf_mail.php +++ b/Configuration/TCA/tx_dlf_mail.php @@ -29,7 +29,7 @@ 'type' => 'input', 'size' => 30, 'max' => 255, - 'eval' => 'required', + 'required' => true, 'default' => '', ], ], diff --git a/Configuration/TCA/tx_dlf_metadata.php b/Configuration/TCA/tx_dlf_metadata.php index 3f70708ace..3a1fb3c677 100644 --- a/Configuration/TCA/tx_dlf_metadata.php +++ b/Configuration/TCA/tx_dlf_metadata.php @@ -16,7 +16,6 @@ 'label' => 'label', 'tstamp' => 'tstamp', 'crdate' => 'crdate', - 'cruser_id' => 'cruser_id', 'languageField' => 'sys_language_uid', 'transOrigPointerField' => 'l18n_parent', 'transOrigDiffSourceField' => 'l18n_diffsource', @@ -48,7 +47,10 @@ 'foreign_table' => 'tx_dlf_metadata', 'foreign_table_where' => 'AND tx_dlf_metadata.pid=###CURRENT_PID### AND tx_dlf_metadata.sys_language_uid IN (-1,0) ORDER BY label ASC', 'items' => [ - ['', 0], + [ + 'label' => '', + 'value' => 0, + ], ], 'default' => 0, ], @@ -73,7 +75,8 @@ 'type' => 'input', 'size' => 30, 'max' => 255, - 'eval' => 'required,trim', + 'required' => true, + 'eval' => 'trim', 'default' => '', ], ], @@ -85,7 +88,8 @@ 'type' => 'input', 'size' => 30, 'max' => 255, - 'eval' => 'required,nospace,alphanum_x,uniqueInPid', + 'required' => true, + 'eval' => 'nospace,alphanum_x,uniqueInPid', 'default' => '', 'fieldInformation' => [ 'editInProductionWarning' => [ @@ -178,11 +182,10 @@ 'l10n_mode' => 'exclude', 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_metadata.index_boost', 'config' => [ - 'type' => 'input', + 'type' => 'number', 'size' => 5, - 'max' => 5, 'default' => 1.0, - 'eval' => 'double2', + 'format' => 'decimal', ], ], 'is_sortable' => [ @@ -229,7 +232,10 @@ 'type' => 'select', 'renderType' => 'selectSingle', 'items' => [ - ['LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_metadata.status.default', 0], + [ + 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_metadata.status.default', + 'value' => 0, + ], ], 'size' => 1, 'minitems' => 1, diff --git a/Configuration/TCA/tx_dlf_metadataformat.php b/Configuration/TCA/tx_dlf_metadataformat.php index 9fd3f9b213..695bdc23de 100644 --- a/Configuration/TCA/tx_dlf_metadataformat.php +++ b/Configuration/TCA/tx_dlf_metadataformat.php @@ -16,7 +16,6 @@ 'label' => 'encoded', 'tstamp' => 'tstamp', 'crdate' => 'crdate', - 'cruser_id' => 'cruser_id', 'delete' => 'deleted', 'iconfile' => 'EXT:dlf/Resources/Public/Icons/txdlfmetadata.png', 'rootLevel' => 0, @@ -53,7 +52,8 @@ 'type' => 'input', 'size' => 30, 'max' => 1024, - 'eval' => 'required,trim', + 'required' => true, + 'eval' => 'trim', 'default' => '', ], ], diff --git a/Configuration/TCA/tx_dlf_metadatasubentries.php b/Configuration/TCA/tx_dlf_metadatasubentries.php index 386aa7d3fe..a73c052ed8 100644 --- a/Configuration/TCA/tx_dlf_metadatasubentries.php +++ b/Configuration/TCA/tx_dlf_metadatasubentries.php @@ -16,7 +16,6 @@ 'label' => 'label', 'tstamp' => 'tstamp', 'crdate' => 'crdate', - 'cruser_id' => 'cruser_id', 'languageField' => 'sys_language_uid', 'transOrigPointerField' => 'l18n_parent', 'transOrigDiffSourceField' => 'l18n_diffsource', @@ -39,7 +38,8 @@ 'type' => 'input', 'size' => 30, 'max' => 255, - 'eval' => 'required,trim', + 'required' => true, + 'eval' => 'trim', 'default' => '', ], ], @@ -51,7 +51,8 @@ 'type' => 'input', 'size' => 30, 'max' => 255, - 'eval' => 'required,nospace,alphanum_x,uniqueInPid', + 'required' => true, + 'eval' => 'nospace,alphanum_x,uniqueInPid', 'default' => '', 'fieldInformation' => [ 'editInProductionWarning' => [ @@ -67,7 +68,8 @@ 'type' => 'input', 'size' => 30, 'max' => 1024, - 'eval' => 'required,trim', + 'required' => true, + 'eval' => 'trim', 'default' => '', ], ], diff --git a/Configuration/TCA/tx_dlf_printer.php b/Configuration/TCA/tx_dlf_printer.php index c33b21e3be..50d2e0e131 100644 --- a/Configuration/TCA/tx_dlf_printer.php +++ b/Configuration/TCA/tx_dlf_printer.php @@ -29,7 +29,8 @@ 'type' => 'input', 'size' => 30, 'max' => 255, - 'eval' => 'required,trim', + 'required' => true, + 'eval' => 'trim', 'default' => '', ], ], @@ -39,7 +40,7 @@ 'type' => 'input', 'size' => 30, 'max' => 255, - 'eval' => 'required', + 'required' => true, 'default' => '', ], ], diff --git a/Configuration/TCA/tx_dlf_solrcores.php b/Configuration/TCA/tx_dlf_solrcores.php index 2f5dc68ae6..52eb7e004b 100644 --- a/Configuration/TCA/tx_dlf_solrcores.php +++ b/Configuration/TCA/tx_dlf_solrcores.php @@ -16,7 +16,6 @@ 'label' => 'label', 'tstamp' => 'tstamp', 'crdate' => 'crdate', - 'cruser_id' => 'cruser_id', 'default_sortby' => 'ORDER BY label', 'delete' => 'deleted', 'iconfile' => 'EXT:dlf/Resources/Public/Icons/txdlfsolrcores.png', @@ -32,7 +31,8 @@ 'type' => 'input', 'size' => 30, 'max' => 255, - 'eval' => 'required,trim', + 'required' => true, + 'eval' => 'trim', 'default' => '', ], ], diff --git a/Configuration/TCA/tx_dlf_structures.php b/Configuration/TCA/tx_dlf_structures.php index 6d40a34592..d0aed99d56 100644 --- a/Configuration/TCA/tx_dlf_structures.php +++ b/Configuration/TCA/tx_dlf_structures.php @@ -16,7 +16,6 @@ 'label' => 'label', 'tstamp' => 'tstamp', 'crdate' => 'crdate', - 'cruser_id' => 'cruser_id', 'languageField' => 'sys_language_uid', 'transOrigPointerField' => 'l18n_parent', 'transOrigDiffSourceField' => 'l18n_diffsource', @@ -48,7 +47,10 @@ 'foreign_table' => 'tx_dlf_structures', 'foreign_table_where' => 'AND tx_dlf_structures.pid=###CURRENT_PID### AND tx_dlf_structures.sys_language_uid IN (-1,0) ORDER BY label ASC', 'items' => [ - ['', 0], + [ + 'label' => '', + 'value' => 0, + ], ], 'default' => 0, ], @@ -83,7 +85,8 @@ 'type' => 'input', 'size' => 30, 'max' => 255, - 'eval' => 'required,trim', + 'required' => true, + 'eval' => 'trim', 'default' => '', ], ], @@ -95,7 +98,8 @@ 'type' => 'input', 'size' => 30, 'max' => 255, - 'eval' => 'required,nospace,alphanum_x,uniqueInPid', + 'required' => true, + 'eval' => 'nospace,alphanum_x,uniqueInPid', 'default' => '', 'fieldInformation' => [ 'editInProductionWarning' => [ @@ -125,7 +129,10 @@ 'type' => 'select', 'renderType' => 'selectSingle', 'items' => [ - ['LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_structures.thumbnail.self', 0], + [ + 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_structures.thumbnail.self', + 'value' => 0, + ], ], 'foreign_table' => 'tx_dlf_structures', 'foreign_table_where' => 'AND tx_dlf_structures.pid=###CURRENT_PID### AND tx_dlf_structures.toplevel=0 AND tx_dlf_structures.sys_language_uid IN (-1,0) ORDER BY tx_dlf_structures.label', @@ -142,7 +149,10 @@ 'type' => 'select', 'renderType' => 'selectSingle', 'items' => [ - ['LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_structures.status.default', 0], + [ + 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_structures.status.default', + 'value' => 0, + ], ], 'size' => 1, 'minitems' => 1, diff --git a/Configuration/TCA/tx_dlf_tokens.php b/Configuration/TCA/tx_dlf_tokens.php index 997ce00ab1..735741e095 100644 --- a/Configuration/TCA/tx_dlf_tokens.php +++ b/Configuration/TCA/tx_dlf_tokens.php @@ -16,7 +16,6 @@ 'label' => 'token', 'tstamp' => 'tstamp', 'crdate' => 'crdate', - 'cruser_id' => 'cruser_id', 'default_sortby' => 'ORDER BY token', 'iconfile' => 'EXT:dlf/Resources/Public/Icons/txdlfsolrcores.png', 'rootLevel' => -1, @@ -29,7 +28,8 @@ 'type' => 'input', 'size' => 30, 'max' => 255, - 'eval' => 'required,trim', + 'required' => true, + 'eval' => 'trim', 'default' => '', ], ], diff --git a/Configuration/TsConfig/ContentElements.tsconfig b/Configuration/TsConfig/ContentElements.tsconfig index f355c537bd..a53cd43297 100644 --- a/Configuration/TsConfig/ContentElements.tsconfig +++ b/Configuration/TsConfig/ContentElements.tsconfig @@ -157,8 +157,8 @@ mod.wizards.newContentElement.wizardItems { } tx_dlf_validationform { iconIdentifier = tx-dlf-validationform - title = LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.validation.title - description = LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.validation.description + title = LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.validationform.title + description = LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.validationform.description tt_content_defValues { CType = list list_type = dlf_validationform diff --git a/README.md b/README.md index 5344b4dbd2..681a2cc4a9 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ For a complete overview of all features, visit the [Kitodo homepage](https://www ## Requirements -Kitodo.Presentation requires [**TYPO3 v11**](https://get.typo3.org/version/11) or [**TYPO3 v12**](https://get.typo3.org/version/12). Additionally, [**Apache Solr v8.11 - v9.7**](https://solr.apache.org) with [**solr-ocrhighlighting v0.9.1+**](https://github.com/dbmdz/solr-ocrhighlighting/releases) are required as search engine backend. +Kitodo.Presentation requires [**TYPO3 v12**](https://get.typo3.org/version/12) or [**TYPO3 v13**](https://get.typo3.org/version/13). Additionally, [**Apache Solr v8.11 - v9.7**](https://solr.apache.org) with [**solr-ocrhighlighting v0.9.1+**](https://github.com/dbmdz/solr-ocrhighlighting/releases) are required as search engine backend. Application level dependencies are handled by [Composer](https://getcomposer.org) (see [composer.json](./composer.json)). diff --git a/Resources/Private/Templates/Backend/NewTenant/Error.html b/Resources/Private/Templates/Backend/NewTenant/Error.html index e0ad43b404..21c1301847 100644 --- a/Resources/Private/Templates/Backend/NewTenant/Error.html +++ b/Resources/Private/Templates/Backend/NewTenant/Error.html @@ -12,8 +12,9 @@ -

- - +
+

+ +
diff --git a/Resources/Private/Templates/Backend/NewTenant/Index.html b/Resources/Private/Templates/Backend/NewTenant/Index.html index 9a838447c9..403c32506c 100644 --- a/Resources/Private/Templates/Backend/NewTenant/Index.html +++ b/Resources/Private/Templates/Backend/NewTenant/Index.html @@ -12,80 +12,83 @@ - -

+
+

-
+
- - - - - - - - - - - - - + + + + + + + + + + + + + -
+
-
+
- - - - - - - - - - - + + + + + + + + + + + -
+
-
- - - - - - - - - - - - - - - - - - -
+
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + +
-
- - - - - - - - - - -
diff --git a/Tests/Fixtures/Common/pages.csv b/Tests/Fixtures/Common/pages.csv index be9073b4e7..cb5aadfdd0 100644 --- a/Tests/Fixtures/Common/pages.csv +++ b/Tests/Fixtures/Common/pages.csv @@ -1,4 +1,4 @@ -pages,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -,uid,pid,tstamp,crdate,deleted,hidden,starttime,endtime,fe_group,sorting,rowDescription,editlock,sys_language_uid,l10n_parent,l10n_source,t3_origuid,l10n_diffsource,perms_userid,perms_groupid,perms_user,perms_group,perms_everybody,title,slug,doktype,TSconfig,is_siteroot,php_tree_stop,url,shortcut,shortcut_mode,subtitle,layout,target,media,lastUpdated,keywords,cache_timeout,cache_tags,newUntil,description,no_search,SYS_LASTCHANGED,abstract,module,extendToSubpages,author,author_email,nav_title,nav_hide,content_from_pid,mount_pid,mount_pid_ol,l18n_cfg,backend_layout,backend_layout_next_level,tsconfig_includes,categories -,19999,0,1644840191,1644840051,0,0,0,0,,764,,0,0,0,0,0,a:47:{s:7:"doktype";N;s:5:"title";N;s:4:"slug";N;s:9:"nav_title";N;s:8:"subtitle";N;s:9:"seo_title";N;s:8:"no_index";N;s:9:"no_follow";N;s:14:"canonical_link";N;s:8:"og_title";N;s:14:"og_description";N;s:8:"og_image";N;s:13:"twitter_title";N;s:19:"twitter_description";N;s:13:"twitter_image";N;s:8:"abstract";N;s:8:"keywords";N;s:11:"description";N;s:6:"author";N;s:12:"author_email";N;s:11:"lastUpdated";N;s:6:"layout";N;s:8:"newUntil";N;s:14:"backend_layout";N;s:25:"backend_layout_next_level";N;s:16:"content_from_pid";N;s:6:"target";N;s:13:"cache_timeout";N;s:10:"cache_tags";N;s:11:"is_siteroot";N;s:9:"no_search";N;s:13:"php_tree_stop";N;s:6:"module";N;s:5:"media";N;s:17:"tsconfig_includes";N;s:8:"TSconfig";N;s:8:"l18n_cfg";N;s:6:"hidden";N;s:8:"nav_hide";N;s:9:"starttime";N;s:7:"endtime";N;s:16:"extendToSubpages";N;s:8:"fe_group";N;s:13:"fe_login_mode";N;s:8:"editlock";N;s:10:"categories";N;s:14:"rowDescription";N;},1,0,31,27,0,DLF Testing Site,,254,,1,0,,0,0,,0,,0,0,,0,,0,,0,1644840191,,,0,,,,0,0,0,0,0,,,,0 -,20000,19999,1644840191,1644840051,0,0,0,0,,764,,0,0,0,0,0,a:47:{s:7:"doktype";N;s:5:"title";N;s:4:"slug";N;s:9:"nav_title";N;s:8:"subtitle";N;s:9:"seo_title";N;s:8:"no_index";N;s:9:"no_follow";N;s:14:"canonical_link";N;s:8:"og_title";N;s:14:"og_description";N;s:8:"og_image";N;s:13:"twitter_title";N;s:19:"twitter_description";N;s:13:"twitter_image";N;s:8:"abstract";N;s:8:"keywords";N;s:11:"description";N;s:6:"author";N;s:12:"author_email";N;s:11:"lastUpdated";N;s:6:"layout";N;s:8:"newUntil";N;s:14:"backend_layout";N;s:25:"backend_layout_next_level";N;s:16:"content_from_pid";N;s:6:"target";N;s:13:"cache_timeout";N;s:10:"cache_tags";N;s:11:"is_siteroot";N;s:9:"no_search";N;s:13:"php_tree_stop";N;s:6:"module";N;s:5:"media";N;s:17:"tsconfig_includes";N;s:8:"TSconfig";N;s:8:"l18n_cfg";N;s:6:"hidden";N;s:8:"nav_hide";N;s:9:"starttime";N;s:7:"endtime";N;s:16:"extendToSubpages";N;s:8:"fe_group";N;s:13:"fe_login_mode";N;s:8:"editlock";N;s:10:"categories";N;s:14:"rowDescription";N;},1,0,31,27,0,Data,/data,254,,0,0,,0,0,,0,,0,0,,0,,0,,0,1644840191,,,0,,,,0,0,0,0,0,,,,0 +pages,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +,uid,pid,tstamp,crdate,deleted,hidden,starttime,endtime,fe_group,sorting,rowDescription,editlock,sys_language_uid,l10n_parent,l10n_source,l10n_diffsource,perms_userid,perms_groupid,perms_user,perms_group,perms_everybody,title,slug,doktype,TSconfig,is_siteroot,php_tree_stop,url,shortcut,shortcut_mode,subtitle,layout,target,media,lastUpdated,keywords,cache_timeout,cache_tags,newUntil,description,no_search,SYS_LASTCHANGED,abstract,module,extendToSubpages,author,author_email,nav_title,nav_hide,content_from_pid,mount_pid,mount_pid_ol,l18n_cfg,backend_layout,backend_layout_next_level,tsconfig_includes,categories +,19999,0,1644840191,1644840051,0,0,0,0,,764,,0,0,0,0,a:47:{s:7:"doktype";N;s:5:"title";N;s:4:"slug";N;s:9:"nav_title";N;s:8:"subtitle";N;s:9:"seo_title";N;s:8:"no_index";N;s:9:"no_follow";N;s:14:"canonical_link";N;s:8:"og_title";N;s:14:"og_description";N;s:8:"og_image";N;s:13:"twitter_title";N;s:19:"twitter_description";N;s:13:"twitter_image";N;s:8:"abstract";N;s:8:"keywords";N;s:11:"description";N;s:6:"author";N;s:12:"author_email";N;s:11:"lastUpdated";N;s:6:"layout";N;s:8:"newUntil";N;s:14:"backend_layout";N;s:25:"backend_layout_next_level";N;s:16:"content_from_pid";N;s:6:"target";N;s:13:"cache_timeout";N;s:10:"cache_tags";N;s:11:"is_siteroot";N;s:9:"no_search";N;s:13:"php_tree_stop";N;s:6:"module";N;s:5:"media";N;s:17:"tsconfig_includes";N;s:8:"TSconfig";N;s:8:"l18n_cfg";N;s:6:"hidden";N;s:8:"nav_hide";N;s:9:"starttime";N;s:7:"endtime";N;s:16:"extendToSubpages";N;s:8:"fe_group";N;s:13:"fe_login_mode";N;s:8:"editlock";N;s:10:"categories";N;s:14:"rowDescription";N;},1,0,31,27,0,DLF Testing Site,,254,,1,0,,0,0,,0,,0,0,,0,,0,,0,1644840191,,,0,,,,0,0,0,0,0,,,,0 +,20000,19999,1644840191,1644840051,0,0,0,0,,764,,0,0,0,0,a:47:{s:7:"doktype";N;s:5:"title";N;s:4:"slug";N;s:9:"nav_title";N;s:8:"subtitle";N;s:9:"seo_title";N;s:8:"no_index";N;s:9:"no_follow";N;s:14:"canonical_link";N;s:8:"og_title";N;s:14:"og_description";N;s:8:"og_image";N;s:13:"twitter_title";N;s:19:"twitter_description";N;s:13:"twitter_image";N;s:8:"abstract";N;s:8:"keywords";N;s:11:"description";N;s:6:"author";N;s:12:"author_email";N;s:11:"lastUpdated";N;s:6:"layout";N;s:8:"newUntil";N;s:14:"backend_layout";N;s:25:"backend_layout_next_level";N;s:16:"content_from_pid";N;s:6:"target";N;s:13:"cache_timeout";N;s:10:"cache_tags";N;s:11:"is_siteroot";N;s:9:"no_search";N;s:13:"php_tree_stop";N;s:6:"module";N;s:5:"media";N;s:17:"tsconfig_includes";N;s:8:"TSconfig";N;s:8:"l18n_cfg";N;s:6:"hidden";N;s:8:"nav_hide";N;s:9:"starttime";N;s:7:"endtime";N;s:16:"extendToSubpages";N;s:8:"fe_group";N;s:13:"fe_login_mode";N;s:8:"editlock";N;s:10:"categories";N;s:14:"rowDescription";N;},1,0,31,27,0,Data,/data,254,,0,0,,0,0,,0,,0,0,,0,,0,,0,1644840191,,,0,,,,0,0,0,0,0,,,,0 diff --git a/Tests/Fixtures/Common/pages.xml b/Tests/Fixtures/Common/pages.xml deleted file mode 100644 index 571d0928c1..0000000000 --- a/Tests/Fixtures/Common/pages.xml +++ /dev/null @@ -1,126 +0,0 @@ - - - - - 19999 - 0 - 1644840191 - 1644840051 - 0 - 0 - 0 - 0 - - 764 - - 0 - 0 - 0 - 0 - 0 - a:47:{s:7:"doktype";N;s:5:"title";N;s:4:"slug";N;s:9:"nav_title";N;s:8:"subtitle";N;s:9:"seo_title";N;s:8:"no_index";N;s:9:"no_follow";N;s:14:"canonical_link";N;s:8:"og_title";N;s:14:"og_description";N;s:8:"og_image";N;s:13:"twitter_title";N;s:19:"twitter_description";N;s:13:"twitter_image";N;s:8:"abstract";N;s:8:"keywords";N;s:11:"description";N;s:6:"author";N;s:12:"author_email";N;s:11:"lastUpdated";N;s:6:"layout";N;s:8:"newUntil";N;s:14:"backend_layout";N;s:25:"backend_layout_next_level";N;s:16:"content_from_pid";N;s:6:"target";N;s:13:"cache_timeout";N;s:10:"cache_tags";N;s:11:"is_siteroot";N;s:9:"no_search";N;s:13:"php_tree_stop";N;s:6:"module";N;s:5:"media";N;s:17:"tsconfig_includes";N;s:8:"TSconfig";N;s:8:"l18n_cfg";N;s:6:"hidden";N;s:8:"nav_hide";N;s:9:"starttime";N;s:7:"endtime";N;s:16:"extendToSubpages";N;s:8:"fe_group";N;s:13:"fe_login_mode";N;s:8:"editlock";N;s:10:"categories";N;s:14:"rowDescription";N;} - 1 - 0 - 31 - 27 - 0 - DLF Testing Site - / - 254 - - 1 - 0 - - 0 - 0 - - 0 - - 0 - 0 - - 0 - - 0 - - 0 - 1644840191 - - - 0 - - - - 0 - 0 - 0 - 0 - 0 - - - - 0 - - - - - 20000 - 19999 - 1644840191 - 1644840051 - 0 - 0 - 0 - 0 - - 764 - - 0 - 0 - 0 - 0 - 0 - a:47:{s:7:"doktype";N;s:5:"title";N;s:4:"slug";N;s:9:"nav_title";N;s:8:"subtitle";N;s:9:"seo_title";N;s:8:"no_index";N;s:9:"no_follow";N;s:14:"canonical_link";N;s:8:"og_title";N;s:14:"og_description";N;s:8:"og_image";N;s:13:"twitter_title";N;s:19:"twitter_description";N;s:13:"twitter_image";N;s:8:"abstract";N;s:8:"keywords";N;s:11:"description";N;s:6:"author";N;s:12:"author_email";N;s:11:"lastUpdated";N;s:6:"layout";N;s:8:"newUntil";N;s:14:"backend_layout";N;s:25:"backend_layout_next_level";N;s:16:"content_from_pid";N;s:6:"target";N;s:13:"cache_timeout";N;s:10:"cache_tags";N;s:11:"is_siteroot";N;s:9:"no_search";N;s:13:"php_tree_stop";N;s:6:"module";N;s:5:"media";N;s:17:"tsconfig_includes";N;s:8:"TSconfig";N;s:8:"l18n_cfg";N;s:6:"hidden";N;s:8:"nav_hide";N;s:9:"starttime";N;s:7:"endtime";N;s:16:"extendToSubpages";N;s:8:"fe_group";N;s:13:"fe_login_mode";N;s:8:"editlock";N;s:10:"categories";N;s:14:"rowDescription";N;} - 1 - 0 - 31 - 27 - 0 - Data - /data - 254 - - 0 - 0 - - 0 - 0 - - 0 - - 0 - 0 - - 0 - - 0 - - 0 - 1644840191 - - - 0 - - - - 0 - 0 - 0 - 0 - 0 - - - - 0 - - diff --git a/Tests/Fixtures/OaiPmh/pages.csv b/Tests/Fixtures/OaiPmh/pages.csv new file mode 100644 index 0000000000..dbbb480e21 --- /dev/null +++ b/Tests/Fixtures/OaiPmh/pages.csv @@ -0,0 +1,14 @@ +pages,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +,uid,pid,tstamp,crdate,deleted,hidden,starttime,endtime,fe_group,sorting,rowDescription,editlock,sys_language_uid,l10n_parent,l10n_source,l10n_diffsource,perms_userid,perms_groupid,perms_user,perms_group,perms_everybody,title,slug,doktype,TSconfig,is_siteroot,php_tree_stop,url,shortcut,shortcut_mode,subtitle,layout,target,media,lastUpdated,keywords,cache_timeout,cache_tags,newUntil,description,no_search,SYS_LASTCHANGED,abstract,module,extendToSubpages,author,author_email,nav_title,nav_hide,content_from_pid,mount_pid,mount_pid_ol,l18n_cfg,backend_layout,backend_layout_next_level,tsconfig_includes,categories,,,,,, +,20001,19999,1644840191,1644840051,0,0,0,0,,764,,0,0,0,0,a:47:{s:7:"doktype";N;s:5:"title";N;s:4:"slug";N;s:9:"nav_title";N;s:8:"subtitle";N;s:9:"seo_title";N;s:8:"no_index";N;s:9:"no_follow";N;s:14:"canonical_link";N;s:8:"og_title";N;s:14:"og_description";N;s:8:"og_image";N;s:13:"twitter_title";N;s:19:"twitter_description";N;s:13:"twitter_image";N;s:8:"abstract";N;s:8:"keywords";N;s:11:"description";N;s:6:"author";N;s:12:"author_email";N;s:11:"lastUpdated";N;s:6:"layout";N;s:8:"newUntil";N;s:14:"backend_layout";N;s:25:"backend_layout_next_level";N;s:16:"content_from_pid";N;s:6:"target";N;s:13:"cache_timeout";N;s:10:"cache_tags";N;s:11:"is_siteroot";N;s:9:"no_search";N;s:13:"php_tree_stop";N;s:6:"module";N;s:5:"media";N;s:17:"tsconfig_includes";N;s:8:"TSconfig";N;s:8:"l18n_cfg";N;s:6:"hidden";N;s:8:"nav_hide";N;s:9:"starttime";N;s:7:"endtime";N;s:16:"extendToSubpages";N;s:8:"fe_group";N;s:13:"fe_login_mode";N;s:8:"editlock";N;s:10:"categories";N;s:14:"rowDescription";N;},1,0,31,27,0,OAI,/oai,1,,0,0,,0,0,,0,,0,0,,0,,0,,0,1644840191,,,0,,,,0,0,0,0,0,,,,0,,,,,, +,20002,19999,1644840191,1644840051,0,0,0,0,,764,,0,0,0,0,a:47:{s:7:"doktype";N;s:5:"title";N;s:4:"slug";N;s:9:"nav_title";N;s:8:"subtitle";N;s:9:"seo_title";N;s:8:"no_index";N;s:9:"no_follow";N;s:14:"canonical_link";N;s:8:"og_title";N;s:14:"og_description";N;s:8:"og_image";N;s:13:"twitter_title";N;s:19:"twitter_description";N;s:13:"twitter_image";N;s:8:"abstract";N;s:8:"keywords";N;s:11:"description";N;s:6:"author";N;s:12:"author_email";N;s:11:"lastUpdated";N;s:6:"layout";N;s:8:"newUntil";N;s:14:"backend_layout";N;s:25:"backend_layout_next_level";N;s:16:"content_from_pid";N;s:6:"target";N;s:13:"cache_timeout";N;s:10:"cache_tags";N;s:11:"is_siteroot";N;s:9:"no_search";N;s:13:"php_tree_stop";N;s:6:"module";N;s:5:"media";N;s:17:"tsconfig_includes";N;s:8:"TSconfig";N;s:8:"l18n_cfg";N;s:6:"hidden";N;s:8:"nav_hide";N;s:9:"starttime";N;s:7:"endtime";N;s:16:"extendToSubpages";N;s:8:"fe_group";N;s:13:"fe_login_mode";N;s:8:"editlock";N;s:10:"categories";N;s:14:"rowDescription";N;},1,0,31,27,0,OAI,/oai,1,,0,0,,0,0,,0,,0,0,,0,,0,,0,1644840191,,,0,,,,0,0,0,0,0,,,,,,,,,, +,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +sys_template,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +,uid,pid,tstamp,crdate,deleted,hidden,starttime,endtime,sorting,description,title,root,clear,include_static_file,constants,config,basedOn,includeStaticAfterBasedOn,static_file_mode,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +,21001,20001,1644856416,1644856388,0,0,0,0,256,,OAI-PMH Template,1,3,"EXT:fluid_styled_content/Configuration/TypoScript/,EXT:dlf/Configuration/TypoScript/Plugins/OaiPmh/,EXT:dlf/Configuration/TypoScript/",plugin.tx_dlf.persistence.storagePid = 20000,,,0,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +,21002,20002,1644856416,1644856388,0,0,0,0,256,,OAI-PMH Template (missing storagePid),1,3,"EXT:fluid_styled_content/Configuration/TypoScript/,EXT:dlf/Configuration/TypoScript/Plugins/OaiPmh/,EXT:dlf/Configuration/TypoScript/",,,,0,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +tt_content,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +,uid,rowDescription,pid,tstamp,crdate,deleted,hidden,starttime,endtime,fe_group,sorting,editlock,sys_language_uid,l18n_parent,l10n_source,l18n_diffsource,CType,header,header_position,bodytext,bullets_type,uploads_description,uploads_type,assets,image,imagewidth,imageorient,imagecols,imageborder,media,layout,frame_class,cols,space_before_class,space_after_class,records,pages,colPos,subheader,header_link,image_zoom,header_layout,list_type,sectionIndex,linkToTop,file_collections,filelink_size,filelink_sorting,filelink_sorting_direction,target,date,recursive,imageheight,pi_flexform,selected_categories,category_field,table_class,table_caption,table_delimiter,table_enclosure,table_header_position,table_tfoot,categories +,22001,,20001,1644840071,1644840071,0,0,0,0,,256,0,0,0,0,,list,,,,0,0,0,0,0,0,25,1,0,0,0,default,0,,,,,0,,,1,0,dlf_oaipmh,1,0,,0,,,,0,0,0," 10001 1 1800 0 11001 50000 ",,,,,124,0,0,0,0 +,22002,,20002,1644840071,1644840071,0,0,0,0,,256,0,0,0,0,,list,,,,0,0,0,0,0,0,25,1,0,0,0,default,0,,,,,0,,,1,0,dlf_oaipmh,1,0,,0,,,,0,0,0," 10001 1 1800 0 11001 50000 ",,,,,124,0,0,0,0 diff --git a/Tests/Fixtures/OaiPmh/pages.xml b/Tests/Fixtures/OaiPmh/pages.xml deleted file mode 100644 index ff5d1661da..0000000000 --- a/Tests/Fixtures/OaiPmh/pages.xml +++ /dev/null @@ -1,374 +0,0 @@ - - - - - 20001 - 19999 - 1644840191 - 1644840051 - 0 - 0 - 0 - 0 - - 764 - - 0 - 0 - 0 - 0 - 0 - a:47:{s:7:"doktype";N;s:5:"title";N;s:4:"slug";N;s:9:"nav_title";N;s:8:"subtitle";N;s:9:"seo_title";N;s:8:"no_index";N;s:9:"no_follow";N;s:14:"canonical_link";N;s:8:"og_title";N;s:14:"og_description";N;s:8:"og_image";N;s:13:"twitter_title";N;s:19:"twitter_description";N;s:13:"twitter_image";N;s:8:"abstract";N;s:8:"keywords";N;s:11:"description";N;s:6:"author";N;s:12:"author_email";N;s:11:"lastUpdated";N;s:6:"layout";N;s:8:"newUntil";N;s:14:"backend_layout";N;s:25:"backend_layout_next_level";N;s:16:"content_from_pid";N;s:6:"target";N;s:13:"cache_timeout";N;s:10:"cache_tags";N;s:11:"is_siteroot";N;s:9:"no_search";N;s:13:"php_tree_stop";N;s:6:"module";N;s:5:"media";N;s:17:"tsconfig_includes";N;s:8:"TSconfig";N;s:8:"l18n_cfg";N;s:6:"hidden";N;s:8:"nav_hide";N;s:9:"starttime";N;s:7:"endtime";N;s:16:"extendToSubpages";N;s:8:"fe_group";N;s:13:"fe_login_mode";N;s:8:"editlock";N;s:10:"categories";N;s:14:"rowDescription";N;} - 1 - 0 - 31 - 27 - 0 - OAI - /oai - 1 - - 0 - 0 - - 0 - 0 - - 0 - - 0 - 0 - - 0 - - 0 - - 0 - 1644840191 - - - 0 - - - - 0 - 0 - 0 - 0 - 0 - - - - 0 - - - - 21001 - 20001 - 1644856416 - 1644856388 - 0 - 0 - 0 - 0 - 256 - - 0 - OAI-PMH Template - 1 - 3 - EXT:fluid_styled_content/Configuration/TypoScript/,EXT:dlf/Configuration/TypoScript/Plugins/OaiPmh/,EXT:dlf/Configuration/TypoScript/ - plugin.tx_dlf.persistence.storagePid = 20000 - - - 0 - 0 - - - - 22001 - - 20001 - 1644840071 - 1644840071 - 0 - 0 - 0 - 0 - - 256 - 0 - 0 - 0 - 0 - 0 - - list -
- - - 0 - 0 - 0 - 0 - 0 - 0 - 25 - 1 - 0 - 0 - 0 - default - 0 - - - - - 0 - - - 1 - 0 - dlf_oaipmh - 1 - 0 - - 0 - - - - 0 - 0 - 0 - - - - - - - 10001 - - - 1 - - - 1800 - - - 0 - - - 11001 - - - 50000 - - - - - - - - - ]]> - - 0 - - - - - - 124 - 0 - 0 - 0 - 0 -
- - - - 20002 - 19999 - 1644840191 - 1644840051 - 0 - 0 - 0 - 0 - - 764 - - 0 - 0 - 0 - 0 - 0 - a:47:{s:7:"doktype";N;s:5:"title";N;s:4:"slug";N;s:9:"nav_title";N;s:8:"subtitle";N;s:9:"seo_title";N;s:8:"no_index";N;s:9:"no_follow";N;s:14:"canonical_link";N;s:8:"og_title";N;s:14:"og_description";N;s:8:"og_image";N;s:13:"twitter_title";N;s:19:"twitter_description";N;s:13:"twitter_image";N;s:8:"abstract";N;s:8:"keywords";N;s:11:"description";N;s:6:"author";N;s:12:"author_email";N;s:11:"lastUpdated";N;s:6:"layout";N;s:8:"newUntil";N;s:14:"backend_layout";N;s:25:"backend_layout_next_level";N;s:16:"content_from_pid";N;s:6:"target";N;s:13:"cache_timeout";N;s:10:"cache_tags";N;s:11:"is_siteroot";N;s:9:"no_search";N;s:13:"php_tree_stop";N;s:6:"module";N;s:5:"media";N;s:17:"tsconfig_includes";N;s:8:"TSconfig";N;s:8:"l18n_cfg";N;s:6:"hidden";N;s:8:"nav_hide";N;s:9:"starttime";N;s:7:"endtime";N;s:16:"extendToSubpages";N;s:8:"fe_group";N;s:13:"fe_login_mode";N;s:8:"editlock";N;s:10:"categories";N;s:14:"rowDescription";N;} - 1 - 0 - 31 - 27 - 0 - OAI - /oai - 1 - - 0 - 0 - - 0 - 0 - - 0 - - 0 - 0 - - 0 - - 0 - - 0 - 1644840191 - - - 0 - - - - 0 - 0 - 0 - 0 - 0 - - - - 0 - - - - 21002 - 20002 - 1644856416 - 1644856388 - 0 - 0 - 0 - 0 - 256 - - 0 - OAI-PMH Template (missing storagePid) - 1 - 3 - EXT:fluid_styled_content/Configuration/TypoScript/,EXT:dlf/Configuration/TypoScript/Plugins/OaiPmh/,EXT:dlf/Configuration/TypoScript/ - - - - 0 - 0 - - - - 22002 - - 20002 - 1644840071 - 1644840071 - 0 - 0 - 0 - 0 - - 256 - 0 - 0 - 0 - 0 - 0 - - list -
- - - 0 - 0 - 0 - 0 - 0 - 0 - 25 - 1 - 0 - 0 - 0 - default - 0 - - - - - 0 - - - 1 - 0 - dlf_oaipmh - 1 - 0 - - 0 - - - - 0 - 0 - 0 - - - - - - - 10001 - - - 1 - - - 1800 - - - 0 - - - 11001 - - - 50000 - - - - - - - - - ]]> - - 0 - - - - - - 124 - 0 - 0 - 0 - 0 -
-
diff --git a/Tests/Functional/Api/OaiPmhTest.php b/Tests/Functional/Api/OaiPmhTest.php index 00a11a0b96..59ee2aa512 100644 --- a/Tests/Functional/Api/OaiPmhTest.php +++ b/Tests/Functional/Api/OaiPmhTest.php @@ -13,18 +13,16 @@ namespace Kitodo\Dlf\Tests\Functional\Api; use DateTime; -use GuzzleHttp\Client as HttpClient; use Kitodo\Dlf\Common\Solr\Solr; use Kitodo\Dlf\Domain\Repository\SolrCoreRepository; use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; +use Kitodo\Dlf\Tests\Functional\Api\OaiPmhTypo3Client; use Phpoaipmh\Endpoint; use Phpoaipmh\Exception\OaipmhException; -use SimpleXMLElement; +use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; class OaiPmhTest extends FunctionalTestCase { - protected bool $disableJsonWrappedResponse = true; - protected array $coreExtensionsToLoad = [ 'fluid', 'fluid_styled_content', @@ -62,7 +60,7 @@ public function setUp(): void $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Common/metadata.csv'); $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Common/libraries.csv'); $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Common/pages.csv'); - $this->importDataSet(__DIR__ . '/../../Fixtures/OaiPmh/pages.xml'); + $this->importCSVDataSet(__DIR__ . '/../../Fixtures/OaiPmh/pages.csv'); $this->importCSVDataSet(__DIR__ . '/../../Fixtures/OaiPmh/solrcores.csv'); $this->solrCoreRepository = $this->initializeRepository(SolrCoreRepository::class, 20000); @@ -103,14 +101,8 @@ protected function setUpOaiSolr(): void */ public function correctlyRespondsOnBadVerb() { - $client = new HttpClient(); - $response = $client->get($this->baseUrl, [ - 'query' => [ - 'id' => $this->oaiPage, - 'verb' => 'nastyVerb', - ], - ]); - $xml = new SimpleXMLElement((string) $response->getBody()); + $client = new OaiPmhTypo3Client($this->baseUrl, $this->oaiPage, $this, false); + $xml = $client->request('nastyVerb'); self::assertEquals('badVerb', (string) $xml->error['code']); @@ -129,8 +121,8 @@ public function correctlyRespondsOnBadVerb() */ public function canIdentify() { - $oai = Endpoint::build($this->oaiUrl); - $identity = $oai->identify(); + $client = new OaiPmhTypo3Client($this->baseUrl, $this->oaiPage, $this); + $identity = (new Endpoint($client))->identify(); self::assertEquals('Identify', (string) $identity->request['verb']); self::assertEquals('Default Library - OAI Repository', (string) $identity->Identify->repositoryName); @@ -143,8 +135,8 @@ public function canIdentify() */ public function identifyGivesFallbackDatestampWhenNoDocuments() { - $oai = Endpoint::build($this->oaiUrlNoStoragePid); - $identity = $oai->identify(); + $client = new OaiPmhTypo3Client($this->baseUrl, $this->oaiPageNoStoragePid, $this); + $identity = (new Endpoint($client))->identify(); self::assertUtcDateString((string) $identity->Identify->earliestDatestamp); } @@ -154,8 +146,8 @@ public function identifyGivesFallbackDatestampWhenNoDocuments() */ public function canListMetadataFormats() { - $oai = Endpoint::build($this->oaiUrl); - $formats = $oai->listMetadataFormats(); + $client = new OaiPmhTypo3Client($this->baseUrl, $this->oaiPage, $this); + $formats = (new Endpoint($client))->listMetadataFormats(); $formatMap = []; foreach ($formats as $format) { @@ -170,8 +162,8 @@ public function canListMetadataFormats() */ public function canListRecords() { - $oai = Endpoint::build($this->oaiUrl); - $result = $oai->listRecords('mets'); + $client = new OaiPmhTypo3Client($this->baseUrl, $this->oaiPage, $this); + $result = (new Endpoint($client))->listRecords('mets'); $record = $result->current(); $metsRoot = $record->metadata->children('http://www.loc.gov/METS/')[0]; @@ -187,8 +179,8 @@ public function noRecordsUntil1900() $this->expectException(OaipmhException::class); $this->expectExceptionMessage('empty list'); - $oai = Endpoint::build($this->oaiUrl); - $result = $oai->listRecords('mets', null, (new DateTime())->setDate(1900, 1, 1)); + $client = new OaiPmhTypo3Client($this->baseUrl, $this->oaiPage, $this); + $result = (new Endpoint($client))->listRecords('mets', null, (new DateTime())->setDate(1900, 1, 1)); $result->current(); } @@ -201,19 +193,12 @@ public function canUseResumptionToken() // NOTE: cursor and expirationDate are optional by the specification, // but we include them in our implementation - $client = new HttpClient(); + $client = new OaiPmhTypo3Client($this->baseUrl, $this->oaiPage, $this); // The general handling of resumption tokens should be the same for these verbs foreach (['ListIdentifiers', 'ListRecords'] as $verb) { // Check that we get a proper resumption token when starting a list - $response = $client->get($this->baseUrl, [ - 'query' => [ - 'id' => $this->oaiPage, - 'verb' => $verb, - 'metadataPrefix' => 'mets', - ], - ]); - $xml = new SimpleXMLElement((string) $response->getBody()); + $xml = $client->request($verb, [ 'metadataPrefix' => 'mets' ]); $resumptionToken = $xml->$verb->resumptionToken; self::assertEquals('0', (string) $resumptionToken['cursor']); @@ -227,14 +212,7 @@ public function canUseResumptionToken() // Check that we can resume and get a proper cursor value $cursor = 1; do { - $response = $client->get($this->baseUrl, [ - 'query' => [ - 'id' => $this->oaiPage, - 'verb' => $verb, - 'resumptionToken' => (string) $resumptionToken, - ], - ]); - $xml = new SimpleXMLElement((string) $response->getBody()); + $xml = $client->request($verb, [ 'resumptionToken' => (string) $resumptionToken ]); $resumptionToken = $xml->$verb->resumptionToken; $tokenStr = (string) $resumptionToken; @@ -257,18 +235,10 @@ public function canUseResumptionToken() */ public function noResumptionTokenForCompleteList() { - $client = new HttpClient(); + $client = new OaiPmhTypo3Client($this->baseUrl, $this->oaiPage, $this); foreach (['ListIdentifiers', 'ListRecords'] as $verb) { - $response = $client->get($this->baseUrl, [ - 'query' => [ - 'id' => $this->oaiPage, - 'verb' => $verb, - 'metadataPrefix' => 'mets', - 'set' => 'collection-with-single-document', - ], - ]); - $xml = new SimpleXMLElement((string) $response->getBody()); + $xml = $client->request($verb, [ 'metadataPrefix' => 'mets', 'set' => 'collection-with-single-document' ]); self::assertCount(1, $xml->$verb->children()); self::assertEmpty($xml->$verb->resumptionToken); @@ -280,8 +250,8 @@ public function noResumptionTokenForCompleteList() */ public function canListAndResumeIdentifiers() { - $oai = Endpoint::build($this->oaiUrl); - $result = $oai->listIdentifiers('mets'); + $client = new OaiPmhTypo3Client($this->baseUrl, $this->oaiPage, $this); + $result = (new Endpoint($client))->listIdentifiers('mets'); $record = $result->current(); self::assertEquals('oai:de:slub-dresden:db:id-476251419', $record->identifier); diff --git a/Tests/Functional/Api/OaiPmhTypo3Client.php b/Tests/Functional/Api/OaiPmhTypo3Client.php new file mode 100644 index 0000000000..2ffeaf4621 --- /dev/null +++ b/Tests/Functional/Api/OaiPmhTypo3Client.php @@ -0,0 +1,115 @@ + + * + * This file is part of the Kitodo and TYPO3 projects. + * + * @license GNU General Public License version 3 or later. + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + */ + +namespace Kitodo\Dlf\Tests\Functional\Api; + +use \Exception; +use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; +use Phpoaipmh\ClientInterface; +use Phpoaipmh\Exception\OaipmhException; +use Phpoaipmh\Exception\MalformedResponseException; +use SimpleXMLElement; +use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; + +/** + * Custom implementation of Phpoaipmh\ClientInterface such that Phpoaipmh\Endpoint can be used + * to test the Typo3 OAI endpoint. + * + * See: https://github.com/caseyamcl/phpoaipmh/blob/master/src/ClientInterface.php + */ +class OaiPmhTypo3Client implements ClientInterface +{ + + /** + * The base url of the Typo3 server used for functional tests + */ + private string $baseUrl; + + /** + * The Typo3 page id of the OAI endpoint + */ + private int $pageId; + + /** + * A reference to the functional test case class such that internal Typo3 requests can be issued. + */ + private FunctionalTestCase $functionalTestCase; + + /** + * Whether to throw an OaipmhException if the OAI response contains error information. + */ + private bool $throwError; + + /** + * Initialize a OaiPmh client. + * + * @param string $baseUrl the base url of the Typo3 server used for functional tests + * @param int $pageId the Typo3 page id of the OAI endpoint + * @param FunctionalTestCase $funtionalTestCase reference to the functional test case in order to issue internal requests + * @param bool $throwError whether to throw an OaiPmhException if the OAI response contains error information + */ + public function __construct( + string $baseUrl, + int $pageId, + FunctionalTestCase $functionalTestCase, + bool $throwError = true + ) { + $this->baseUrl = $baseUrl; + $this->pageId = $pageId; + $this->functionalTestCase = $functionalTestCase; + $this->throwError = $throwError; + } + + /** + * Issue a OaiPmh request for a given verb and options. + * + * @param $verb the verb as string + * @param array $params additional options + * @throws OaipmhException if there is an OaiPmh error and $throwError is true + * @throws MalformedResponseException if the XML response cannot be parsed + * @return SimpleXMLElement the parsed response as XML element + */ + public function request($verb, array $params = []) + { + $request = (new InternalRequest($this->baseUrl))->withQueryParameters( + array_merge([ 'id' => $this->pageId, 'verb' => $verb ], $params) + ); + + $response = $this->functionalTestCase->executeInternalRequest($request); + + try { + $xml = new SimpleXMLElement((string) $response->getBody()); + } catch (Exception $e) { + // ignore phpcs error "All output should be run through an escaping function, see WordPress security" + // phpcs:ignore + throw new MalformedResponseException(sprintf("Could not decode XML Response: %s", $e->getMessage())); + } + + if ($this->throwError && isset($xml->error)) { + $code = (string) $xml->error['code']; + $msg = (string) $xml->error; + // ignore phpcs error "All output should be run through an escaping function, see WordPress security" + // phpcs:ignore + throw new OaipmhException($code, $msg); + } + + return $xml; + } + + /** + * Empty implementation + */ + public function getHttpAdapter() + { + return null; + } +} diff --git a/Tests/Functional/Api/PageViewProxyDisabledTest.php b/Tests/Functional/Api/PageViewProxyDisabledTest.php index bce00df4e9..1b4dedc50d 100644 --- a/Tests/Functional/Api/PageViewProxyDisabledTest.php +++ b/Tests/Functional/Api/PageViewProxyDisabledTest.php @@ -15,11 +15,10 @@ use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; use Psr\Http\Message\ResponseInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; class PageViewProxyDisabledTest extends FunctionalTestCase { - protected bool $disableJsonWrappedResponse = true; - /** * Query the page view proxy with the given parameters. * @@ -34,11 +33,11 @@ class PageViewProxyDisabledTest extends FunctionalTestCase */ protected function queryProxy(array $query, string $method = 'GET'): ResponseInterface { - $query['eID'] = 'tx_dlf_pageview_proxy'; + $request = (new InternalRequest($this->baseUrl))->withQueryParameters( + array_merge([ 'eID' => 'tx_dlf_pageview_proxy' ], $query) + )->withMethod($method); - return $this->httpClient->request($method, '', [ - 'query' => $query, - ]); + return $this->executeInternalRequest($request); } /** diff --git a/Tests/Functional/Api/PageViewProxyTest.php b/Tests/Functional/Api/PageViewProxyTest.php index 07de469330..d35f9d7f1c 100644 --- a/Tests/Functional/Api/PageViewProxyTest.php +++ b/Tests/Functional/Api/PageViewProxyTest.php @@ -15,11 +15,10 @@ use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; use Psr\Http\Message\ResponseInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; class PageViewProxyTest extends FunctionalTestCase { - protected bool $disableJsonWrappedResponse = true; - /** * Returns the DLF configuration for the test instance. * @@ -55,11 +54,11 @@ protected function getDlfConfiguration(): array */ protected function queryProxy(array $query, string $method = 'GET'): ResponseInterface { - $query['eID'] = 'tx_dlf_pageview_proxy'; + $request = (new InternalRequest($this->baseUrl))->withQueryParameters( + array_merge([ 'eID' => 'tx_dlf_pageview_proxy' ], $query) + )->withMethod($method); - return $this->httpClient->request($method, '', [ - 'query' => $query, - ]); + return $this->executeInternalRequest($request); } /** diff --git a/Tests/Functional/Common/SolrIndexingTest.php b/Tests/Functional/Common/SolrIndexingTest.php index d1ac2bb1ad..f24913c08d 100644 --- a/Tests/Functional/Common/SolrIndexingTest.php +++ b/Tests/Functional/Common/SolrIndexingTest.php @@ -13,6 +13,7 @@ namespace Kitodo\Dlf\Tests\Functional\Common; use Kitodo\Dlf\Common\AbstractDocument; +use Kitodo\Dlf\Common\Helper; use Kitodo\Dlf\Common\Indexer; use Kitodo\Dlf\Common\Solr\Solr; use Kitodo\Dlf\Domain\Model\SolrCore; @@ -20,7 +21,6 @@ use Kitodo\Dlf\Domain\Repository\DocumentRepository; use Kitodo\Dlf\Domain\Repository\SolrCoreRepository; use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; -use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Utility\GeneralUtility; class SolrIndexingTest extends FunctionalTestCase @@ -48,9 +48,6 @@ public function setUp(): void { parent::setUp(); - // Needed for Indexer::add, which uses the language service - Bootstrap::initializeLanguageObject(); - $this->collectionRepository = $this->initializeRepository(CollectionRepository::class, 20000); $this->documentRepository = $this->initializeRepository(DocumentRepository::class, 20000); $this->solrCoreRepository = $this->initializeRepository(SolrCoreRepository::class, 20000); @@ -194,6 +191,7 @@ public function canGetIndexFieldName() */ protected function createSolrCore(): object { + Helper::resetIndexNameCache(); $coreName = Solr::createCore(); $solr = Solr::getInstance($coreName); diff --git a/Tests/Functional/Common/SolrSearchQueryTest.php b/Tests/Functional/Common/SolrSearchQueryTest.php index ecd2509d5b..9ee0040988 100644 --- a/Tests/Functional/Common/SolrSearchQueryTest.php +++ b/Tests/Functional/Common/SolrSearchQueryTest.php @@ -44,27 +44,29 @@ public function setUp(): void { parent::setUp(); $this->setUpData(self::$databaseFixtures); - $this->setUpSolr(4, 0, self::$solrFixtures); + $this->setUpSolr(4, 20000, self::$solrFixtures); } /** * @test - * @ignore */ public function canExecute() { $documentRepository = $this->initializeRepository(DocumentRepository::class, 0); - $settings = ['solrcore' => 4, 'storagePid' => 0]; + $settings = ['solrcore' => 4, 'storagePid' => 20000]; + + // FIXME: test would fail because it is not possible to set $this->settings['storagePid'] for the + // documentRepository used in DocumentRepository.php:502 + // as a workaround, call $documentRepository->findSolrWithoutCollection to register settings + $documentRepository->findSolrWithoutCollection($settings, []); $params = ['query' => '10 Keyboard pieces']; $search = new SolrSearch($documentRepository, [], $settings, $params); $search->prepare(); $solrSearchQuery = $search->getQuery(); $result = $solrSearchQuery->execute(); - // FIXME: test would fail because it is not possible to set $this->settings['storagePid'] for the - // documentRepository used in DocumentRepository.php:502 - self::assertCount(0, $result); - self::assertEquals(0, $solrSearchQuery->getLimit()); + self::assertCount(1, $result); + self::assertEquals(1, $solrSearchQuery->getLimit()); } } diff --git a/Tests/Functional/Common/SolrSearchTest.php b/Tests/Functional/Common/SolrSearchTest.php index b48bcb8e66..3fe2c54c03 100644 --- a/Tests/Functional/Common/SolrSearchTest.php +++ b/Tests/Functional/Common/SolrSearchTest.php @@ -28,8 +28,6 @@ class SolrSearchTest extends FunctionalTestCase __DIR__ . '/../../Fixtures/Common/documents_1.solr.json' ]; - private Solr $solr; - /** * Sets up the test environment. * @@ -44,7 +42,7 @@ public function setUp(): void { parent::setUp(); $this->setUpData(self::$databaseFixtures); - $this->solr = $this->setUpSolr(5, 0, self::$solrFixtures); + $this->setUpSolr(5, 0, self::$solrFixtures); } /** @@ -60,21 +58,21 @@ public function canPrepareAndSubmit() self::assertCount(33, $resultSet); $params1 = ['query' => '*']; - $search = new SolrSearch($documentRepository, null, $settings, $params1); + $search = new SolrSearch($documentRepository, [], $settings, $params1); $search->prepare(); self::assertEquals(33, $search->getNumFound()); self::assertEquals(3, $search->getSolrResults()['numberOfToplevels']); self::assertCount(15, $search->getSolrResults()['documents']); $params2 = ['query' => '10 Keyboard pieces']; - $search2 = new SolrSearch($documentRepository, null, $settings, $params2); + $search2 = new SolrSearch($documentRepository, [], $settings, $params2); $search2->prepare(); self::assertEquals(1, $search2->getNumFound()); self::assertEquals(1, $search2->getSolrResults()['numberOfToplevels']); self::assertCount(1, $search2->getSolrResults()['documents']); $params3 = ['query' => 'foobar']; - $search3 = new SolrSearch($documentRepository, null, $settings, $params3); + $search3 = new SolrSearch($documentRepository, [], $settings, $params3); $search3->prepare(); self::assertEquals(0, $search3->getNumFound()); self::assertEquals(0, $search3->getSolrResults()['numberOfToplevels']); diff --git a/Tests/Functional/Common/SolrTest.php b/Tests/Functional/Common/SolrTest.php index 395ce64a67..e53eacfaa8 100644 --- a/Tests/Functional/Common/SolrTest.php +++ b/Tests/Functional/Common/SolrTest.php @@ -65,9 +65,10 @@ public function canEscapeQueryKeepField() */ public function canGetNextCoreNumber() { - self::assertEquals(4, Solr::getNextCoreNumber()); + $currentCoreNumber = Solr::getNextCoreNumber(); + self::assertGreaterThan(0, $currentCoreNumber); Solr::createCore(); - self::assertEquals(5, Solr::getNextCoreNumber()); + self::assertEquals($currentCoreNumber + 1, Solr::getNextCoreNumber()); } /** diff --git a/Tests/Functional/FunctionalTestCase.php b/Tests/Functional/FunctionalTestCase.php index 28c85f99c2..28f550cb04 100644 --- a/Tests/Functional/FunctionalTestCase.php +++ b/Tests/Functional/FunctionalTestCase.php @@ -14,8 +14,10 @@ use Dotenv\Dotenv; use GuzzleHttp\Client as HttpClient; +use Kitodo\Dlf\Common\Helper; use Kitodo\Dlf\Common\Solr\Solr; use Kitodo\Dlf\Domain\Repository\SolrCoreRepository; +use Psr\Http\Message\ResponseInterface; use Symfony\Component\Yaml\Yaml; use TYPO3\CMS\Core\Utility\ArrayUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -23,6 +25,7 @@ use TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings; use TYPO3\CMS\Extbase\Persistence\Repository; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; +use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; /** * Base class for functional test cases. This provides some common configuration @@ -66,15 +69,6 @@ class FunctionalTestCase extends \TYPO3\TestingFramework\Core\Functional\Functio ], ]; - /** - * By default, the testing framework wraps responses into a JSON object - * that contains status code etc. as fields. Set this field to true to avoid - * this behavior by not loading the json_response extension. - * - * @var bool - */ - protected bool $disableJsonWrappedResponse = false; - /** * @var PersistenceManager */ @@ -92,18 +86,7 @@ class FunctionalTestCase extends \TYPO3\TestingFramework\Core\Functional\Functio protected SolrCoreRepository $solrCoreRepository; - public function __construct() - { - parent::__construct(); - - $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration(); - - if ($this->disableJsonWrappedResponse) { - $this->frameworkExtensionsToLoad = array_filter($this->frameworkExtensionsToLoad, function ($ext) { - return $ext !== 'Resources/Core/Functional/Extensions/json_response'; - }); - } - } + protected ?Solr $solr = null; /** * Sets up the test case environment. @@ -116,6 +99,8 @@ public function __construct() */ public function setUp(): void { + $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration(); + parent::setUp(); $this->persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class); @@ -346,21 +331,20 @@ protected function setUpSolr(int $uid, int $storagePid, array $solrFixtures): So $this->solrCoreRepository = $this->initializeRepository(SolrCoreRepository::class, $storagePid); // Setup Solr only once for all tests in this suite - static $solr = null; - - if ($solr === null) { + if ($this->solr === null) { + Helper::resetIndexNameCache(); $coreName = Solr::createCore(); - $solr = Solr::getInstance($coreName); + $this->solr = Solr::getInstance($coreName); foreach ($solrFixtures as $filePath) { - $this->importSolrDocuments($solr, $filePath); + $this->importSolrDocuments($this->solr, $filePath); } } $coreModel = $this->solrCoreRepository->findByUid($uid); - $coreModel->setIndexName($solr->core); + $coreModel->setIndexName($this->solr->core); $this->solrCoreRepository->update($coreModel); $this->persistenceManager->persistAll(); - return $solr; + return $this->solr; } /** @@ -384,4 +368,15 @@ protected static function assertArrayMatches(array $sub, array $super, string $m { self::assertEquals($sub, ArrayUtility::intersectRecursive($super, $sub), $message); } + + /** + * Execute an internal Typo3 Http request and return its response. + * + * @param InternalRequest $request the request + * @return ResponseInterface the response + */ + public function executeInternalRequest(InternalRequest $request): ResponseInterface + { + return $this->executeFrontendSubRequest($request); + } } diff --git a/Tests/Functional/Repository/DocumentRepositoryTest.php b/Tests/Functional/Repository/DocumentRepositoryTest.php index ea86519d5c..7497314f67 100644 --- a/Tests/Functional/Repository/DocumentRepositoryTest.php +++ b/Tests/Functional/Repository/DocumentRepositoryTest.php @@ -39,7 +39,7 @@ public function setUp(): void $this->documentRepository = $this->initializeRepository(DocumentRepository::class, 20000); $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Common/documents_1.csv'); - $this->importDataSet(__DIR__ . '/../../Fixtures/Common/pages.xml'); + $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Common/pages.csv'); $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Common/libraries.csv'); } diff --git a/Tests/Functional/Repository/MetatdataRepositoryTest.php b/Tests/Functional/Repository/MetadataRepositoryTest.php similarity index 100% rename from Tests/Functional/Repository/MetatdataRepositoryTest.php rename to Tests/Functional/Repository/MetadataRepositoryTest.php diff --git a/Tests/Functional/ViewHelpers/StdWrapViewHelperTest.php b/Tests/Functional/ViewHelpers/StdWrapViewHelperTest.php index 434cf0d0fe..8fa7718b63 100644 --- a/Tests/Functional/ViewHelpers/StdWrapViewHelperTest.php +++ b/Tests/Functional/ViewHelpers/StdWrapViewHelperTest.php @@ -13,7 +13,10 @@ namespace Kitodo\Dlf\Tests\Unit\ViewHelpers; use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; +use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Fluid\View\StandaloneView; +use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; /** * @covers StdWrapViewHelper @@ -30,7 +33,14 @@ class StdWrapViewHelperTest extends FunctionalTestCase */ public function renderWithStdWrap(): void { + $cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class); + + $request = new ServerRequest(); + $request = $request->withAttribute("currentContentObject", $cObj); + $view = new StandaloneView(); + $view->setRequest($request); + $view->assign( 'metadataWrap', [ diff --git a/composer.json b/composer.json index 502d9f22a7..5d737613e1 100644 --- a/composer.json +++ b/composer.json @@ -32,26 +32,27 @@ "ext-libxml": "*", "ext-openssl": "*", "ext-simplexml": "*", - "typo3/cms-core": "^11.5|^12.4", - "typo3/cms-extbase": "^11.5|^12.4", - "typo3/cms-scheduler": "^11.5|^12.4", - "typo3/cms-tstemplate": "^11.5|^12.4", + "typo3/cms-core": "^12.4|^13.4", + "typo3/cms-extbase": "^12.4|^13.4", + "typo3/cms-install": "^12.4|^13.4", + "typo3/cms-scheduler": "^12.4|^13.4", + "typo3/cms-tstemplate": "^12.4|^13.4", "caseyamcl/phpoaipmh": "^3.3", "slub/php-mods-reader": "^0.4", - "ubl/php-iiif-prezi-reader": "0.3", + "ubl/php-iiif-prezi-reader": "0.3.1|0.3.2", "solarium/solarium": "^6.3", "softcreatr/jsonpath": "^0.10", - "symfony/process": "^6.4" + "symfony/process": "^6.4|^7.3" }, "require-dev": { "phpstan/phpstan": "^1.12", - "phpunit/phpunit": "^9.6", + "phpunit/phpunit": "^10.1", "spatie/phpunit-watcher": "^1.23", - "typo3/cms-backend": "^11.5|^12.4", - "typo3/cms-fluid": "^11.5|^12.4", - "typo3/cms-fluid-styled-content": "^11.5|^12.4", - "typo3/cms-frontend": "^11.5|^12.4", - "typo3/testing-framework": "^7.1", + "typo3/cms-backend": "^12.4|^13.4", + "typo3/cms-fluid": "^12.4|^13.4", + "typo3/cms-fluid-styled-content": "^12.4|^13.4", + "typo3/cms-frontend": "^12.4|^13.4", + "typo3/testing-framework": "^8.2", "vlucas/phpdotenv": "^5.6" }, "replace": { @@ -118,7 +119,7 @@ "@composer docs:start" ], "phpstan": [ - "@php vendor/bin/phpstan --configuration=\".github/phpstan.neon\"" + "@php vendor/bin/phpstan --configuration=\".github/phpstan_13.4.neon\"" ] }, "config": { @@ -126,5 +127,11 @@ "typo3/class-alias-loader": true, "typo3/cms-composer-installers": true } - } + }, + "repositories": [ + { + "type": "github", + "url": "https://github.com/kitodo/php-iiif-prezi-reader.git" + } + ] } diff --git a/ext_emconf.php b/ext_emconf.php index bee546beac..b93e367f00 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -18,7 +18,7 @@ 'constraints' => [ 'depends' => [ 'php' => '8.1.0-8.4.99', - 'typo3' => '11.5.0-12.4.99' + 'typo3' => '12.4.0-13.4.99' ], 'conflicts' => [], 'suggests' => [] diff --git a/ext_localconf.php b/ext_localconf.php index 6d79f09534..0da6d96bb9 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -146,17 +146,6 @@ 'class' => \Kitodo\Dlf\Hooks\Form\FieldInformation\SolrCoreStatus::class ]; - -// Add migration wizards -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\Kitodo\Dlf\Updates\MigrateSettings::class] - = \Kitodo\Dlf\Updates\MigrateSettings::class; -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\Kitodo\Dlf\Updates\FileLocationUpdater::class] - = \Kitodo\Dlf\Updates\FileLocationUpdater::class; -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\Kitodo\Dlf\Updates\FormatUpdater::class] - = \Kitodo\Dlf\Updates\FormatUpdater::class; -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\Kitodo\Dlf\Updates\UpdateSolrSchema::class] -= \Kitodo\Dlf\Updates\UpdateSolrSchema::class; - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( 'Dlf', 'Search', diff --git a/ext_tables.php b/ext_tables.php deleted file mode 100644 index 8a6c8d3062..0000000000 --- a/ext_tables.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * This file is part of the Kitodo and TYPO3 projects. - * - * @license GNU General Public License version 3 or later. - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - */ - -if (!defined('TYPO3')) { - die('Access denied.'); -} - -// Register backend module for Typo3 v11. - -\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule( - 'Dlf', - 'tools', // Main area - 'newTenantModule', // Name of the module - 'bottom', // Position of the module - [// Allowed controller action combinations - \Kitodo\Dlf\Controller\Backend\NewTenantController::class => 'index,error,addFormat,addMetadata,addSolrCore,addStructure', - ], - [// Additional configuration - 'access' => 'admin', - 'icon' => 'EXT:dlf/Resources/Public/Icons/Extension.svg', - 'labels' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_mod_newtenant.xlf', - 'navigationComponentId' => 'TYPO3/CMS/Backend/PageTree/PageTreeElement' - ], -);