@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | { |
| 189 | 189 | $file = $this->getFileInfo($id); |
| 190 | 190 | if ($file['mimeType'] === 'application/vnd.kitodo.iiif') { |
| 191 | - $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'); |
|
| 191 | + $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'); |
|
| 192 | 192 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'iiif'); |
| 193 | 193 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
| 194 | 194 | IiifHelper::setMaxThumbnailHeight($conf['thumbnailHeight']); |
@@ -198,9 +198,9 @@ discard block |
||
| 198 | 198 | return $service->getImageUrl(); |
| 199 | 199 | } |
| 200 | 200 | } elseif ($file['mimeType'] === 'application/vnd.netfpx') { |
| 201 | - $baseURL = $file['location'] . (strpos($file['location'], '?') === false ? '?' : ''); |
|
| 201 | + $baseURL = $file['location'].(strpos($file['location'], '?') === false ? '?' : ''); |
|
| 202 | 202 | // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server' |
| 203 | - return $baseURL . '&CVT=jpeg'; |
|
| 203 | + return $baseURL.'&CVT=jpeg'; |
|
| 204 | 204 | } |
| 205 | 205 | return $file['location']; |
| 206 | 206 | } |
@@ -229,14 +229,14 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | public function getFileLocation(string $id): string |
| 231 | 231 | { |
| 232 | - $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]'); |
|
| 232 | + $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/mets:FLocat[@LOCTYPE="URL"]'); |
|
| 233 | 233 | if ( |
| 234 | 234 | !empty($id) |
| 235 | 235 | && !empty($location) |
| 236 | 236 | ) { |
| 237 | 237 | return (string) $location[0]->attributes('http://www.w3.org/1999/xlink')->href; |
| 238 | 238 | } else { |
| 239 | - $this->logger->warning('There is no file node with @ID "' . $id . '"'); |
|
| 239 | + $this->logger->warning('There is no file node with @ID "'.$id.'"'); |
|
| 240 | 240 | return ''; |
| 241 | 241 | } |
| 242 | 242 | } |
@@ -246,14 +246,14 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | public function getFileMimeType(string $id): string |
| 248 | 248 | { |
| 249 | - $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE'); |
|
| 249 | + $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/@MIMETYPE'); |
|
| 250 | 250 | if ( |
| 251 | 251 | !empty($id) |
| 252 | 252 | && !empty($mimetype) |
| 253 | 253 | ) { |
| 254 | 254 | return (string) $mimetype[0]; |
| 255 | 255 | } else { |
| 256 | - $this->logger->warning('There is no file node with @ID "' . $id . '" or no MIME type specified'); |
|
| 256 | + $this->logger->warning('There is no file node with @ID "'.$id.'" or no MIME type specified'); |
|
| 257 | 257 | return ''; |
| 258 | 258 | } |
| 259 | 259 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | return $this->logicalUnits[$id]; |
| 274 | 274 | } elseif (!empty($id)) { |
| 275 | 275 | // Get specified logical unit. |
| 276 | - $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]'); |
|
| 276 | + $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]'); |
|
| 277 | 277 | } else { |
| 278 | 278 | // Get all logical units at top level. |
| 279 | 279 | $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div'); |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | $cPid = max($cPid, 0); |
| 462 | 462 | if ($cPid == 0 && ($this->cPid || $this->pid)) { |
| 463 | 463 | // Retain current PID. |
| 464 | - $cPid = $this->cPid ?: $this->pid; |
|
| 464 | + $cPid = $this->cPid ? : $this->pid; |
|
| 465 | 465 | } |
| 466 | 466 | return $cPid; |
| 467 | 467 | } |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | if (isset($this->fileInfos[$id]) || in_array('dmdSec', $metadataSections)) { |
| 529 | 529 | return $metadata; |
| 530 | 530 | } else { |
| 531 | - $this->logger->warning('No supported descriptive metadata found for logical structure with @ID "' . $id . '"'); |
|
| 531 | + $this->logger->warning('No supported descriptive metadata found for logical structure with @ID "'.$id.'"'); |
|
| 532 | 532 | return []; |
| 533 | 533 | } |
| 534 | 534 | } |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | if (!empty($this->logicalUnits[$id])) { |
| 548 | 548 | return [$this->logicalUnits[$id]['type']]; |
| 549 | 549 | } else { |
| 550 | - $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]/@TYPE'); |
|
| 550 | + $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@TYPE'); |
|
| 551 | 551 | if (!empty($struct)) { |
| 552 | 552 | return [(string) $struct[0]]; |
| 553 | 553 | } |
@@ -690,13 +690,13 @@ discard block |
||
| 690 | 690 | if ($resArray['format'] > 0 && !empty($resArray['xpath_sorting'])) { |
| 691 | 691 | $values = $domXPath->evaluate($resArray['xpath_sorting'], $domNode); |
| 692 | 692 | if ($values instanceof \DOMNodeList && $values->length > 0) { |
| 693 | - $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
| 693 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
| 694 | 694 | } elseif (!($values instanceof \DOMNodeList)) { |
| 695 | - $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values); |
|
| 695 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values); |
|
| 696 | 696 | } |
| 697 | 697 | } |
| 698 | - if (empty($metadata[$resArray['index_name'] . '_sorting'][0])) { |
|
| 699 | - $metadata[$resArray['index_name'] . '_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
| 698 | + if (empty($metadata[$resArray['index_name'].'_sorting'][0])) { |
|
| 699 | + $metadata[$resArray['index_name'].'_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
| 700 | 700 | } |
| 701 | 701 | } |
| 702 | 702 | } |
@@ -756,11 +756,11 @@ discard block |
||
| 756 | 756 | return true; |
| 757 | 757 | } |
| 758 | 758 | } else { |
| 759 | - $this->logger->warning('Invalid class/method "' . $class . '->extractMetadata()" for metadata format "' . $this->mdSec[$dmdId]['type'] . '"'); |
|
| 759 | + $this->logger->warning('Invalid class/method "'.$class.'->extractMetadata()" for metadata format "'.$this->mdSec[$dmdId]['type'].'"'); |
|
| 760 | 760 | } |
| 761 | 761 | } |
| 762 | 762 | } else { |
| 763 | - $this->logger->notice('Unsupported metadata format "' . $this->mdSec[$dmdId]['type'] . '" in ' . $mdSectionType . ' with @ID "' . $dmdId . '"'); |
|
| 763 | + $this->logger->notice('Unsupported metadata format "'.$this->mdSec[$dmdId]['type'].'" in '.$mdSectionType.' with @ID "'.$dmdId.'"'); |
|
| 764 | 764 | } |
| 765 | 765 | return false; |
| 766 | 766 | } |
@@ -867,7 +867,7 @@ discard block |
||
| 867 | 867 | $dmdIds = $this->logicalUnits[$id]['dmdId'] ?? ''; |
| 868 | 868 | $admIds = $this->logicalUnits[$id]['admId'] ?? ''; |
| 869 | 869 | } else { |
| 870 | - $mdSec = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]')[0]; |
|
| 870 | + $mdSec = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]')[0]; |
|
| 871 | 871 | if ($mdSec) { |
| 872 | 872 | $dmdIds = (string) $mdSec->attributes()->DMDID; |
| 873 | 873 | $admIds = (string) $mdSec->attributes()->ADMID; |
@@ -897,7 +897,7 @@ discard block |
||
| 897 | 897 | |
| 898 | 898 | return array_filter( |
| 899 | 899 | $allMdIds, |
| 900 | - function ($element) { |
|
| 900 | + function($element) { |
|
| 901 | 901 | return !empty($element); |
| 902 | 902 | } |
| 903 | 903 | ); |
@@ -923,7 +923,7 @@ discard block |
||
| 923 | 923 | */ |
| 924 | 924 | public function getStructureDepth(string $logId) |
| 925 | 925 | { |
| 926 | - $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
|
| 926 | + $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*'); |
|
| 927 | 927 | if (!empty($ancestors)) { |
| 928 | 928 | return count($ancestors); |
| 929 | 929 | } else { |
@@ -947,9 +947,9 @@ discard block |
||
| 947 | 947 | $this->registerNamespaces($this->mets); |
| 948 | 948 | } else { |
| 949 | 949 | if (!empty($location)) { |
| 950 | - $this->logger->error('No METS part found in document with location "' . $location . '".'); |
|
| 950 | + $this->logger->error('No METS part found in document with location "'.$location.'".'); |
|
| 951 | 951 | } elseif (!empty($this->recordId)) { |
| 952 | - $this->logger->error('No METS part found in document with recordId "' . $this->recordId . '".'); |
|
| 952 | + $this->logger->error('No METS part found in document with recordId "'.$this->recordId.'".'); |
|
| 953 | 953 | } else { |
| 954 | 954 | $this->logger->error('No METS part found in current document.'); |
| 955 | 955 | } |
@@ -970,7 +970,7 @@ discard block |
||
| 970 | 970 | return true; |
| 971 | 971 | } |
| 972 | 972 | } |
| 973 | - $this->logger->error('Could not load XML file from "' . $location . '"'); |
|
| 973 | + $this->logger->error('Could not load XML file from "'.$location.'"'); |
|
| 974 | 974 | return false; |
| 975 | 975 | } |
| 976 | 976 | |
@@ -1093,10 +1093,10 @@ discard block |
||
| 1093 | 1093 | |
| 1094 | 1094 | if (!empty($mdType) && !empty($this->formats[(string) $mdType[0]])) { |
| 1095 | 1095 | $type = (string) $mdType[0]; |
| 1096 | - $xml = $element->xpath('./mets:mdWrap[@MDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
| 1096 | + $xml = $element->xpath('./mets:mdWrap[@MDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
| 1097 | 1097 | } elseif (!empty($otherMdType) && !empty($this->formats[(string) $otherMdType[0]])) { |
| 1098 | 1098 | $type = (string) $otherMdType[0]; |
| 1099 | - $xml = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
| 1099 | + $xml = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
| 1100 | 1100 | } |
| 1101 | 1101 | |
| 1102 | 1102 | if (empty($xml)) { |
@@ -1289,9 +1289,9 @@ discard block |
||
| 1289 | 1289 | || $forceReload |
| 1290 | 1290 | ) { |
| 1291 | 1291 | // Retain current PID. |
| 1292 | - $cPid = $this->cPid ?: $this->pid; |
|
| 1292 | + $cPid = $this->cPid ? : $this->pid; |
|
| 1293 | 1293 | if (!$cPid) { |
| 1294 | - $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions'); |
|
| 1294 | + $this->logger->error('Invalid PID '.$cPid.' for structure definitions'); |
|
| 1295 | 1295 | $this->thumbnailLoaded = true; |
| 1296 | 1296 | return $this->thumbnail; |
| 1297 | 1297 | } |
@@ -1328,7 +1328,7 @@ discard block |
||
| 1328 | 1328 | if (!empty($resArray['thumbnail'])) { |
| 1329 | 1329 | $strctType = Helper::getIndexNameFromUid($resArray['thumbnail'], 'tx_dlf_structures', $cPid); |
| 1330 | 1330 | // Check if this document has a structure element of the desired type. |
| 1331 | - $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="' . $strctType . '"]/@ID'); |
|
| 1331 | + $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="'.$strctType.'"]/@ID'); |
|
| 1332 | 1332 | if (!empty($strctIds)) { |
| 1333 | 1333 | $strctId = (string) $strctIds[0]; |
| 1334 | 1334 | } |
@@ -1351,7 +1351,7 @@ discard block |
||
| 1351 | 1351 | } |
| 1352 | 1352 | } |
| 1353 | 1353 | } else { |
| 1354 | - $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database'); |
|
| 1354 | + $this->logger->error('No structure of type "'.$metadata['type'][0].'" found in database'); |
|
| 1355 | 1355 | } |
| 1356 | 1356 | $this->thumbnailLoaded = true; |
| 1357 | 1357 | } |
@@ -1397,7 +1397,7 @@ discard block |
||
| 1397 | 1397 | { |
| 1398 | 1398 | if (empty($this->parentHref)) { |
| 1399 | 1399 | // Get the closest ancestor of the current document which has a MPTR child. |
| 1400 | - $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $this->toplevelId . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
| 1400 | + $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$this->toplevelId.'"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
| 1401 | 1401 | if (!empty($parentMptr)) { |
| 1402 | 1402 | $this->parentHref = (string) $parentMptr[0]->attributes('http://www.w3.org/1999/xlink')->href; |
| 1403 | 1403 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $this->initializeRepositories((int) $input->getOption('pid')); |
| 115 | 115 | |
| 116 | 116 | if ($this->storagePid == 0) { |
| 117 | - $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.'); |
|
| 117 | + $io->error('ERROR: No valid PID ('.$this->storagePid.') given.'); |
|
| 118 | 118 | return BaseCommand::FAILURE; |
| 119 | 119 | } |
| 120 | 120 | |
@@ -129,13 +129,13 @@ discard block |
||
| 129 | 129 | if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) { |
| 130 | 130 | $outputSolrCores = []; |
| 131 | 131 | foreach ($allSolrCores as $indexName => $uid) { |
| 132 | - $outputSolrCores[] = $uid . ' : ' . $indexName; |
|
| 132 | + $outputSolrCores[] = $uid.' : '.$indexName; |
|
| 133 | 133 | } |
| 134 | 134 | if (empty($outputSolrCores)) { |
| 135 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $this->storagePid . ".\n"); |
|
| 135 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$this->storagePid.".\n"); |
|
| 136 | 136 | return BaseCommand::FAILURE; |
| 137 | 137 | } else { |
| 138 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $outputSolrCores) . "\n"); |
|
| 138 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $outputSolrCores)."\n"); |
|
| 139 | 139 | return BaseCommand::FAILURE; |
| 140 | 140 | } |
| 141 | 141 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | ->setLimit((int) $input->getOption('index-limit')) |
| 166 | 166 | ->setOffset((int) $input->getOption('index-begin')) |
| 167 | 167 | ->execute(); |
| 168 | - $io->writeln($input->getOption('index-limit') . ' documents starting from ' . $input->getOption('index-begin') . ' will be indexed.'); |
|
| 168 | + $io->writeln($input->getOption('index-limit').' documents starting from '.$input->getOption('index-begin').' will be indexed.'); |
|
| 169 | 169 | } else { |
| 170 | 170 | // Get all documents. |
| 171 | 171 | $documents = $this->documentRepository->findAll(); |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | ) { |
| 188 | 188 | $documents = $this->documentRepository->findAllByCollectionsLimited($collections, (int) $input->getOption('index-limit'), (int) $input->getOption('index-begin')); |
| 189 | 189 | |
| 190 | - $io->writeln($input->getOption('index-limit') . ' documents starting from ' . $input->getOption('index-begin') . ' will be indexed.'); |
|
| 190 | + $io->writeln($input->getOption('index-limit').' documents starting from '.$input->getOption('index-begin').' will be indexed.'); |
|
| 191 | 191 | } else { |
| 192 | 192 | // Get all documents of given collections. |
| 193 | 193 | $documents = $this->documentRepository->findAllByCollectionsLimited($collections, 0); |
@@ -201,15 +201,15 @@ discard block |
||
| 201 | 201 | $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true); |
| 202 | 202 | |
| 203 | 203 | if ($doc === null) { |
| 204 | - $io->warning('WARNING: Document "' . $document->getLocation() . '" could not be loaded. Skip to next document.'); |
|
| 204 | + $io->warning('WARNING: Document "'.$document->getLocation().'" could not be loaded. Skip to next document.'); |
|
| 205 | 205 | continue; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | if ($dryRun) { |
| 209 | - $io->writeln('DRY RUN: Would index ' . ($id + 1) . '/' . count($documents) . ' with UID "' . $document->getUid() . '" ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
| 209 | + $io->writeln('DRY RUN: Would index '.($id + 1).'/'.count($documents).' with UID "'.$document->getUid().'" ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
| 210 | 210 | } else { |
| 211 | 211 | if ($io->isVerbose()) { |
| 212 | - $io->writeln(date('Y-m-d H:i:s') . ' Indexing ' . ($id + 1) . '/' . count($documents) . ' with UID "' . $document->getUid() . '" ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
| 212 | + $io->writeln(date('Y-m-d H:i:s').' Indexing '.($id + 1).'/'.count($documents).' with UID "'.$document->getUid().'" ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
| 213 | 213 | } |
| 214 | 214 | $document->setCurrentDocument($doc); |
| 215 | 215 | // save to database |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $this->initializeRepositories((int) $input->getOption('pid')); |
| 112 | 112 | |
| 113 | 113 | if ($this->storagePid == 0) { |
| 114 | - $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.'); |
|
| 114 | + $io->error('ERROR: No valid PID ('.$this->storagePid.') given.'); |
|
| 115 | 115 | return BaseCommand::FAILURE; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -129,13 +129,13 @@ discard block |
||
| 129 | 129 | if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) { |
| 130 | 130 | $outputSolrCores = []; |
| 131 | 131 | foreach ($allSolrCores as $indexName => $uid) { |
| 132 | - $outputSolrCores[] = $uid . ' : ' . $indexName; |
|
| 132 | + $outputSolrCores[] = $uid.' : '.$indexName; |
|
| 133 | 133 | } |
| 134 | 134 | if (empty($outputSolrCores)) { |
| 135 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $this->storagePid . ".\n"); |
|
| 135 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$this->storagePid.".\n"); |
|
| 136 | 136 | return BaseCommand::FAILURE; |
| 137 | 137 | } else { |
| 138 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $outputSolrCores) . "\n"); |
|
| 138 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $outputSolrCores)."\n"); |
|
| 139 | 139 | return BaseCommand::FAILURE; |
| 140 | 140 | } |
| 141 | 141 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | return BaseCommand::FAILURE; |
| 156 | 156 | } |
| 157 | 157 | if (!GeneralUtility::isValidUrl($baseUrl)) { |
| 158 | - $io->error('ERROR: No valid OAI Base URL set for library with given UID ("' . $input->getOption('lib') . '").'); |
|
| 158 | + $io->error('ERROR: No valid OAI Base URL set for library with given UID ("'.$input->getOption('lib').'").'); |
|
| 159 | 159 | return BaseCommand::FAILURE; |
| 160 | 160 | } else { |
| 161 | 161 | try { |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | if (empty($set)) { |
| 200 | - $io->error('ERROR: OAI interface does not provide a set with given setSpec ("' . $input->getOption('set') . '").'); |
|
| 200 | + $io->error('ERROR: OAI interface does not provide a set with given setSpec ("'.$input->getOption('set').'").'); |
|
| 201 | 201 | return BaseCommand::FAILURE; |
| 202 | 202 | } |
| 203 | 203 | } |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | // Process all identifiers. |
| 218 | - $baseLocation = $baseUrl . (parse_url($baseUrl, PHP_URL_QUERY) ? '&' : '?'); |
|
| 218 | + $baseLocation = $baseUrl.(parse_url($baseUrl, PHP_URL_QUERY) ? '&' : '?'); |
|
| 219 | 219 | foreach ($identifiers as $identifier) { |
| 220 | 220 | // Build OAI GetRecord URL... |
| 221 | 221 | $params = [ |
@@ -223,13 +223,13 @@ discard block |
||
| 223 | 223 | 'metadataPrefix' => 'mets', |
| 224 | 224 | 'identifier' => (string) $identifier->identifier |
| 225 | 225 | ]; |
| 226 | - $docLocation = $baseLocation . http_build_query($params); |
|
| 226 | + $docLocation = $baseLocation.http_build_query($params); |
|
| 227 | 227 | // ...index the document... |
| 228 | 228 | $document = null; |
| 229 | 229 | $doc = AbstractDocument::getInstance($docLocation, ['storagePid' => $this->storagePid], true); |
| 230 | 230 | |
| 231 | 231 | if ($doc === null) { |
| 232 | - $io->warning('WARNING: Document "' . $docLocation . '" could not be loaded. Skip to next document.'); |
|
| 232 | + $io->warning('WARNING: Document "'.$docLocation.'" could not be loaded. Skip to next document.'); |
|
| 233 | 233 | continue; |
| 234 | 234 | } |
| 235 | 235 | |
@@ -246,10 +246,10 @@ discard block |
||
| 246 | 246 | $document->setSolrcore($solrCoreUid); |
| 247 | 247 | |
| 248 | 248 | if ($dryRun) { |
| 249 | - $io->writeln('DRY RUN: Would index ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
| 249 | + $io->writeln('DRY RUN: Would index '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
| 250 | 250 | } else { |
| 251 | 251 | if ($io->isVerbose()) { |
| 252 | - $io->writeln(date('Y-m-d H:i:s') . ' Indexing ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
| 252 | + $io->writeln(date('Y-m-d H:i:s').' Indexing '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
| 253 | 253 | } |
| 254 | 254 | $document->setCurrentDocument($doc); |
| 255 | 255 | // save to database |
@@ -276,6 +276,6 @@ discard block |
||
| 276 | 276 | */ |
| 277 | 277 | protected function handleOaiError(BaseoaipmhException $exception, SymfonyStyle $io): void |
| 278 | 278 | { |
| 279 | - $io->error('ERROR: Trying to retrieve data from OAI interface resulted in error:' . "\n " . $exception->getMessage()); |
|
| 279 | + $io->error('ERROR: Trying to retrieve data from OAI interface resulted in error:'."\n ".$exception->getMessage()); |
|
| 280 | 280 | } |
| 281 | 281 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $this->initializeRepositories((int) $input->getOption('pid')); |
| 99 | 99 | |
| 100 | 100 | if ($this->storagePid == 0) { |
| 101 | - $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.'); |
|
| 101 | + $io->error('ERROR: No valid PID ('.$this->storagePid.') given.'); |
|
| 102 | 102 | return BaseCommand::FAILURE; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -113,13 +113,13 @@ discard block |
||
| 113 | 113 | if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) { |
| 114 | 114 | $outputSolrCores = []; |
| 115 | 115 | foreach ($allSolrCores as $indexName => $uid) { |
| 116 | - $outputSolrCores[] = $uid . ' : ' . $indexName; |
|
| 116 | + $outputSolrCores[] = $uid.' : '.$indexName; |
|
| 117 | 117 | } |
| 118 | 118 | if (empty($outputSolrCores)) { |
| 119 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $this->storagePid . ".\n"); |
|
| 119 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$this->storagePid.".\n"); |
|
| 120 | 120 | return BaseCommand::FAILURE; |
| 121 | 121 | } else { |
| 122 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $outputSolrCores) . "\n"); |
|
| 122 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $outputSolrCores)."\n"); |
|
| 123 | 123 | return BaseCommand::FAILURE; |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $document = $this->documentRepository->findByUid($input->getOption('doc')); |
| 160 | 160 | |
| 161 | 161 | if ($document === null) { |
| 162 | - $io->error('ERROR: Document with UID "' . $input->getOption('doc') . '" could not be found on PID ' . $this->storagePid . ' .'); |
|
| 162 | + $io->error('ERROR: Document with UID "'.$input->getOption('doc').'" could not be found on PID '.$this->storagePid.' .'); |
|
| 163 | 163 | exit(1); |
| 164 | 164 | } else { |
| 165 | 165 | $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true); |
@@ -172,31 +172,31 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | if ($doc === null) { |
| 175 | - $io->error('ERROR: Document "' . $input->getOption('doc') . '" could not be loaded.'); |
|
| 175 | + $io->error('ERROR: Document "'.$input->getOption('doc').'" could not be loaded.'); |
|
| 176 | 176 | return BaseCommand::FAILURE; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | $document->setSolrcore($solrCoreUid); |
| 180 | 180 | |
| 181 | 181 | if ($dryRun) { |
| 182 | - $io->section('DRY RUN: Would index ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
| 182 | + $io->section('DRY RUN: Would index '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
| 183 | 183 | $io->success('All done!'); |
| 184 | 184 | return BaseCommand::SUCCESS; |
| 185 | 185 | } else { |
| 186 | 186 | $document->setCurrentDocument($doc); |
| 187 | 187 | |
| 188 | 188 | if ($io->isVerbose()) { |
| 189 | - $io->section('Indexing ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . '.'); |
|
| 189 | + $io->section('Indexing '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.'.'); |
|
| 190 | 190 | } |
| 191 | 191 | $isSaved = $this->saveToDatabase($document); |
| 192 | 192 | |
| 193 | 193 | if ($isSaved) { |
| 194 | 194 | if ($io->isVerbose()) { |
| 195 | - $io->section('Indexing ' . $document->getUid() . ' ("' . $document->getLocation() . '") on Solr core ' . $solrCoreUid . '.'); |
|
| 195 | + $io->section('Indexing '.$document->getUid().' ("'.$document->getLocation().'") on Solr core '.$solrCoreUid.'.'); |
|
| 196 | 196 | } |
| 197 | 197 | $isSaved = Indexer::add($document, $this->documentRepository); |
| 198 | 198 | } else { |
| 199 | - $io->error('ERROR: Document with UID "' . $document->getUid() . '" could not be indexed on PID ' . $this->storagePid . ' . There are missing mandatory fields (at least one of those: ' . $this->extConf['requiredMetadataFields'] . ') in this document.'); |
|
| 199 | + $io->error('ERROR: Document with UID "'.$document->getUid().'" could not be indexed on PID '.$this->storagePid.' . There are missing mandatory fields (at least one of those: '.$this->extConf['requiredMetadataFields'].') in this document.'); |
|
| 200 | 200 | return BaseCommand::FAILURE; |
| 201 | 201 | } |
| 202 | 202 | |
@@ -205,8 +205,8 @@ discard block |
||
| 205 | 205 | return BaseCommand::SUCCESS; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - $io->error('ERROR: Document with UID "' . $document->getUid() . '" could not be indexed on Solr core ' . $solrCoreUid . ' . There are missing mandatory fields (at least one of those: ' . $this->extConf['requiredMetadataFields'] . ') in this document.'); |
|
| 209 | - $io->info('INFO: Document with UID "' . $document->getUid() . '" is already in database. If you want to keep the database and index consistent you need to remove it.'); |
|
| 208 | + $io->error('ERROR: Document with UID "'.$document->getUid().'" could not be indexed on Solr core '.$solrCoreUid.' . There are missing mandatory fields (at least one of those: '.$this->extConf['requiredMetadataFields'].') in this document.'); |
|
| 209 | + $io->info('INFO: Document with UID "'.$document->getUid().'" is already in database. If you want to keep the database and index consistent you need to remove it.'); |
|
| 210 | 210 | return BaseCommand::FAILURE; |
| 211 | 211 | } |
| 212 | 212 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | } elseif ($checksum == 10) { |
| 149 | 149 | //TODO: Binary operation "+" between string and 1 results in an error. |
| 150 | 150 | // @phpstan-ignore-next-line |
| 151 | - return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD'); |
|
| 151 | + return self::checkIdentifier(($digits + 1).substr($id, -2, 2), 'SWD'); |
|
| 152 | 152 | } elseif (substr($id, -1, 1) != $checksum) { |
| 153 | 153 | return false; |
| 154 | 154 | } |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
| 355 | 355 | // Merge initialization vector and encrypted data. |
| 356 | 356 | if ($encrypted !== false) { |
| 357 | - $encrypted = base64_encode($iv . $encrypted); |
|
| 357 | + $encrypted = base64_encode($iv.$encrypted); |
|
| 358 | 358 | } |
| 359 | 359 | return $encrypted; |
| 360 | 360 | } |
@@ -396,8 +396,8 @@ discard block |
||
| 396 | 396 | public static function getHookObjects(string $scriptRelPath): array |
| 397 | 397 | { |
| 398 | 398 | $hookObjects = []; |
| 399 | - if (is_array(self::getOptions()[self::$extKey . '/' . $scriptRelPath]['hookClass'])) { |
|
| 400 | - foreach (self::getOptions()[self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) { |
|
| 399 | + if (is_array(self::getOptions()[self::$extKey.'/'.$scriptRelPath]['hookClass'])) { |
|
| 400 | + foreach (self::getOptions()[self::$extKey.'/'.$scriptRelPath]['hookClass'] as $classRef) { |
|
| 401 | 401 | $hookObjects[] = GeneralUtility::makeInstance($classRef); |
| 402 | 402 | } |
| 403 | 403 | } |
@@ -426,12 +426,12 @@ discard block |
||
| 426 | 426 | // NOTE: Only use tables that don't have too many entries! |
| 427 | 427 | || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores']) |
| 428 | 428 | ) { |
| 429 | - self::log('Invalid UID "' . $uid . '" or table "' . $table . '"', LOG_SEVERITY_ERROR); |
|
| 429 | + self::log('Invalid UID "'.$uid.'" or table "'.$table.'"', LOG_SEVERITY_ERROR); |
|
| 430 | 430 | return ''; |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - $makeCacheKey = function ($pid, $uid) { |
|
| 434 | - return $pid . '.' . $uid; |
|
| 433 | + $makeCacheKey = function($pid, $uid) { |
|
| 434 | + return $pid.'.'.$uid; |
|
| 435 | 435 | }; |
| 436 | 436 | |
| 437 | 437 | static $cache = []; |
@@ -441,9 +441,9 @@ discard block |
||
| 441 | 441 | |
| 442 | 442 | $result = $queryBuilder |
| 443 | 443 | ->select( |
| 444 | - $table . '.index_name AS index_name', |
|
| 445 | - $table . '.uid AS uid', |
|
| 446 | - $table . '.pid AS pid', |
|
| 444 | + $table.'.index_name AS index_name', |
|
| 445 | + $table.'.uid AS uid', |
|
| 446 | + $table.'.pid AS pid', |
|
| 447 | 447 | ) |
| 448 | 448 | ->from($table) |
| 449 | 449 | ->execute(); |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | $result = $cache[$table][$cacheKey] ?? ''; |
| 462 | 462 | |
| 463 | 463 | if ($result === '') { |
| 464 | - self::log('No "index_name" with UID ' . $uid . ' and PID ' . $pid . ' found in table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
| 464 | + self::log('No "index_name" with UID '.$uid.' and PID '.$pid.' found in table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | return $result; |
@@ -490,11 +490,11 @@ discard block |
||
| 490 | 490 | // No ISO code, return unchanged. |
| 491 | 491 | return $code; |
| 492 | 492 | } |
| 493 | - $lang = LocalizationUtility::translate('LLL:' . $file . ':' . $code); |
|
| 493 | + $lang = LocalizationUtility::translate('LLL:'.$file.':'.$code); |
|
| 494 | 494 | if (!empty($lang)) { |
| 495 | 495 | return $lang; |
| 496 | 496 | } else { |
| 497 | - self::log('Language code "' . $code . '" not found in ISO-639 table', LOG_SEVERITY_NOTICE); |
|
| 497 | + self::log('Language code "'.$code.'" not found in ISO-639 table', LOG_SEVERITY_NOTICE); |
|
| 498 | 498 | return $code; |
| 499 | 499 | } |
| 500 | 500 | } |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | // Sanitize input. |
| 659 | 659 | $pid = max((int) $pid, 0); |
| 660 | 660 | if (!$pid) { |
| 661 | - self::log('Invalid PID ' . $pid . ' for translation', LOG_SEVERITY_WARNING); |
|
| 661 | + self::log('Invalid PID '.$pid.' for translation', LOG_SEVERITY_WARNING); |
|
| 662 | 662 | return $indexName; |
| 663 | 663 | } |
| 664 | 664 | /** @var PageRepository $pageRepository */ |
@@ -681,13 +681,13 @@ discard block |
||
| 681 | 681 | // First fetch the uid of the received index_name |
| 682 | 682 | $result = $queryBuilder |
| 683 | 683 | ->select( |
| 684 | - $table . '.uid AS uid', |
|
| 685 | - $table . '.l18n_parent AS l18n_parent' |
|
| 684 | + $table.'.uid AS uid', |
|
| 685 | + $table.'.l18n_parent AS l18n_parent' |
|
| 686 | 686 | ) |
| 687 | 687 | ->from($table) |
| 688 | 688 | ->where( |
| 689 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
| 690 | - $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($indexName)), |
|
| 689 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
| 690 | + $queryBuilder->expr()->eq($table.'.index_name', $queryBuilder->expr()->literal($indexName)), |
|
| 691 | 691 | self::whereExpression($table, true) |
| 692 | 692 | ) |
| 693 | 693 | ->setMaxResults(1) |
@@ -698,12 +698,12 @@ discard block |
||
| 698 | 698 | if ($row) { |
| 699 | 699 | // Now we use the uid of the l18_parent to fetch the index_name of the translated content element. |
| 700 | 700 | $result = $queryBuilder |
| 701 | - ->select($table . '.index_name AS index_name') |
|
| 701 | + ->select($table.'.index_name AS index_name') |
|
| 702 | 702 | ->from($table) |
| 703 | 703 | ->where( |
| 704 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
| 705 | - $queryBuilder->expr()->eq($table . '.uid', $row['l18n_parent']), |
|
| 706 | - $queryBuilder->expr()->eq($table . '.sys_language_uid', (int) $languageContentId), |
|
| 704 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
| 705 | + $queryBuilder->expr()->eq($table.'.uid', $row['l18n_parent']), |
|
| 706 | + $queryBuilder->expr()->eq($table.'.sys_language_uid', (int) $languageContentId), |
|
| 707 | 707 | self::whereExpression($table, true) |
| 708 | 708 | ) |
| 709 | 709 | ->setMaxResults(1) |
@@ -721,14 +721,14 @@ discard block |
||
| 721 | 721 | if (empty($labels[$table][$pid][$languageContentId][$indexName])) { |
| 722 | 722 | // Check if this table is allowed for translation. |
| 723 | 723 | if (in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures'])) { |
| 724 | - $additionalWhere = $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]); |
|
| 724 | + $additionalWhere = $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]); |
|
| 725 | 725 | if ($languageContentId > 0) { |
| 726 | 726 | $additionalWhere = $queryBuilder->expr()->andX( |
| 727 | 727 | $queryBuilder->expr()->orX( |
| 728 | - $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]), |
|
| 729 | - $queryBuilder->expr()->eq($table . '.sys_language_uid', (int) $languageContentId) |
|
| 728 | + $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]), |
|
| 729 | + $queryBuilder->expr()->eq($table.'.sys_language_uid', (int) $languageContentId) |
|
| 730 | 730 | ), |
| 731 | - $queryBuilder->expr()->eq($table . '.l18n_parent', 0) |
|
| 731 | + $queryBuilder->expr()->eq($table.'.l18n_parent', 0) |
|
| 732 | 732 | ); |
| 733 | 733 | } |
| 734 | 734 | |
@@ -737,7 +737,7 @@ discard block |
||
| 737 | 737 | ->select('*') |
| 738 | 738 | ->from($table) |
| 739 | 739 | ->where( |
| 740 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
| 740 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
| 741 | 741 | $additionalWhere, |
| 742 | 742 | self::whereExpression($table, true) |
| 743 | 743 | ) |
@@ -755,10 +755,10 @@ discard block |
||
| 755 | 755 | } |
| 756 | 756 | } |
| 757 | 757 | } else { |
| 758 | - self::log('No translation with PID ' . $pid . ' available in table "' . $table . '" or translation not accessible', LOG_SEVERITY_NOTICE); |
|
| 758 | + self::log('No translation with PID '.$pid.' available in table "'.$table.'" or translation not accessible', LOG_SEVERITY_NOTICE); |
|
| 759 | 759 | } |
| 760 | 760 | } else { |
| 761 | - self::log('No translations available for table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
| 761 | + self::log('No translations available for table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
| 762 | 762 | } |
| 763 | 763 | } |
| 764 | 764 | |
@@ -804,7 +804,7 @@ discard block |
||
| 804 | 804 | return GeneralUtility::makeInstance(ConnectionPool::class) |
| 805 | 805 | ->getQueryBuilderForTable($table) |
| 806 | 806 | ->expr() |
| 807 | - ->eq($table . '.' . $GLOBALS['TCA'][$table]['ctrl']['delete'], 0); |
|
| 807 | + ->eq($table.'.'.$GLOBALS['TCA'][$table]['ctrl']['delete'], 0); |
|
| 808 | 808 | } else { |
| 809 | 809 | self::log('Unexpected TYPO3_MODE', LOG_SEVERITY_ERROR); |
| 810 | 810 | return '1=-1'; |
@@ -870,7 +870,7 @@ discard block |
||
| 870 | 870 | try { |
| 871 | 871 | $response = $requestFactory->request($url, 'GET', $configuration); |
| 872 | 872 | } catch (\Exception $e) { |
| 873 | - self::log('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.', LOG_SEVERITY_WARNING); |
|
| 873 | + self::log('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.', LOG_SEVERITY_WARNING); |
|
| 874 | 874 | return false; |
| 875 | 875 | } |
| 876 | 876 | return $response->getBody()->getContents(); |