@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | // in which case metadata of toplevel entry isn't yet filled. |
| 221 | 221 | if (empty($document['metadata'])) { |
| 222 | 222 | $document['metadata'] = $this->fetchToplevelMetadataFromSolr([ |
| 223 | - 'query' => 'uid:' . $document['uid'], |
|
| 223 | + 'query' => 'uid:'.$document['uid'], |
|
| 224 | 224 | 'start' => 0, |
| 225 | 225 | 'rows' => 1, |
| 226 | 226 | 'sort' => ['score' => 'desc'], |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | if (empty($document['title']) && $document['partOf'] > 0) { |
| 232 | 232 | $superiorTitle = AbstractDocument::getTitle($document['partOf'], true); |
| 233 | 233 | if (!empty($superiorTitle)) { |
| 234 | - $document['title'] = '[' . $superiorTitle . ']'; |
|
| 234 | + $document['title'] = '['.$superiorTitle.']'; |
|
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | } |
@@ -366,13 +366,13 @@ discard block |
||
| 366 | 366 | // Set search query. |
| 367 | 367 | if ( |
| 368 | 368 | (!empty($this->searchParams['fulltext'])) |
| 369 | - || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($this->searchParams['query']), $matches) |
|
| 369 | + || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($this->searchParams['query']), $matches) |
|
| 370 | 370 | ) { |
| 371 | 371 | // If the query already is a fulltext query e.g using the facets |
| 372 | 372 | $this->searchParams['query'] = empty($matches[1]) ? $this->searchParams['query'] : $matches[1]; |
| 373 | 373 | // Search in fulltext field if applicable. Query must not be empty! |
| 374 | 374 | if (!empty($this->searchParams['query'])) { |
| 375 | - $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($this->searchParams['query'])) . ')'; |
|
| 375 | + $query = $fields['fulltext'].':('.Solr::escapeQuery(trim($this->searchParams['query'])).')'; |
|
| 376 | 376 | } |
| 377 | 377 | $params['fulltext'] = true; |
| 378 | 378 | } else { |
@@ -395,9 +395,9 @@ discard block |
||
| 395 | 395 | in_array($this->searchParams['extOperator'][$i], $allowedOperators) |
| 396 | 396 | ) { |
| 397 | 397 | if (!empty($query)) { |
| 398 | - $query .= ' ' . $this->searchParams['extOperator'][$i] . ' '; |
|
| 398 | + $query .= ' '.$this->searchParams['extOperator'][$i].' '; |
|
| 399 | 399 | } |
| 400 | - $query .= Indexer::getIndexFieldName($this->searchParams['extField'][$i], $this->settings['storagePid']) . ':(' . Solr::escapeQuery($this->searchParams['extQuery'][$i]) . ')'; |
|
| 400 | + $query .= Indexer::getIndexFieldName($this->searchParams['extField'][$i], $this->settings['storagePid']).':('.Solr::escapeQuery($this->searchParams['extQuery'][$i]).')'; |
|
| 401 | 401 | } |
| 402 | 402 | } |
| 403 | 403 | } |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | // Add filter query for date search |
| 407 | 407 | if (!empty($this->searchParams['dateFrom']) && !empty($this->searchParams['dateTo'])) { |
| 408 | 408 | // combine dateFrom and dateTo into range search |
| 409 | - $params['filterquery'][]['query'] = '{!join from=' . $fields['uid'] . ' to=' . $fields['uid'] . '}'. $fields['date'] . ':[' . $this->searchParams['dateFrom'] . ' TO ' . $this->searchParams['dateTo'] . ']'; |
|
| 409 | + $params['filterquery'][]['query'] = '{!join from='.$fields['uid'].' to='.$fields['uid'].'}'.$fields['date'].':['.$this->searchParams['dateFrom'].' TO '.$this->searchParams['dateTo'].']'; |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | // Add filter query for faceting. |
@@ -423,12 +423,12 @@ discard block |
||
| 423 | 423 | ) { |
| 424 | 424 | // Search in document and all subordinates (valid for up to three levels of hierarchy). |
| 425 | 425 | $params['filterquery'][]['query'] = '_query_:"{!join from=' |
| 426 | - . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
| 427 | - . $fields['uid'] . ':{!join from=' . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
| 428 | - . $fields['uid'] . ':' . $this->searchParams['documentId'] . '"' . ' OR {!join from=' |
|
| 429 | - . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
| 430 | - . $fields['uid'] . ':' . $this->searchParams['documentId'] . ' OR ' |
|
| 431 | - . $fields['uid'] . ':' . $this->searchParams['documentId']; |
|
| 426 | + . $fields['uid'].' to='.$fields['partof'].'}' |
|
| 427 | + . $fields['uid'].':{!join from='.$fields['uid'].' to='.$fields['partof'].'}' |
|
| 428 | + . $fields['uid'].':'.$this->searchParams['documentId'].'"'.' OR {!join from=' |
|
| 429 | + . $fields['uid'].' to='.$fields['partof'].'}' |
|
| 430 | + . $fields['uid'].':'.$this->searchParams['documentId'].' OR ' |
|
| 431 | + . $fields['uid'].':'.$this->searchParams['documentId']; |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | // if collections are given, we prepare the collection query string |
@@ -448,8 +448,8 @@ discard block |
||
| 448 | 448 | if ($this->listedMetadata) { |
| 449 | 449 | foreach ($this->listedMetadata as $metadata) { |
| 450 | 450 | if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) { |
| 451 | - $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u'); |
|
| 452 | - $params['fields'] .= ',' . $listMetadataRecord; |
|
| 451 | + $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u'); |
|
| 452 | + $params['fields'] .= ','.$listMetadataRecord; |
|
| 453 | 453 | $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord; |
| 454 | 454 | } |
| 455 | 455 | } |
@@ -524,8 +524,8 @@ discard block |
||
| 524 | 524 | if ($this->searchParams['fulltext'] == '1') { |
| 525 | 525 | $searchResult['snippet'] = $doc['snippet']; |
| 526 | 526 | $searchResult['highlight'] = $doc['highlight']; |
| 527 | - $searchResult['highlight_word'] = preg_replace('/^;|;$/', '', // remove ; at beginning or end |
|
| 528 | - preg_replace('/;+/', ';', // replace any multiple of ; with a single ; |
|
| 527 | + $searchResult['highlight_word'] = preg_replace('/^;|;$/', '', // remove ; at beginning or end |
|
| 528 | + preg_replace('/;+/', ';', // replace any multiple of ; with a single ; |
|
| 529 | 529 | preg_replace('/[{~\d*}{\s+}{^=*\d+.*\d*}`~!@#$%\^&*()_|+-=?;:\'",.<>\{\}\[\]\\\]/', ';', $this->searchParams['query']))); // replace search operators and special characters with ; |
| 530 | 530 | } |
| 531 | 531 | $documents[$doc['uid']]['searchResults'][] = $searchResult; |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | |
| 550 | 550 | // Fetch metadata for the current batch |
| 551 | 551 | $metadataOf = $this->fetchToplevelMetadataFromSolr([ |
| 552 | - 'query' => 'partof:' . $doc['uid'], |
|
| 552 | + 'query' => 'partof:'.$doc['uid'], |
|
| 553 | 553 | 'start' => $start, |
| 554 | 554 | 'rows' => min($batchSize, $totalChildren - $start), |
| 555 | 555 | ]); |
@@ -601,8 +601,8 @@ discard block |
||
| 601 | 601 | if ($this->listedMetadata) { |
| 602 | 602 | foreach ($this->listedMetadata as $metadata) { |
| 603 | 603 | if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) { |
| 604 | - $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u'); |
|
| 605 | - $params['fields'] .= ',' . $listMetadataRecord; |
|
| 604 | + $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u'); |
|
| 605 | + $params['fields'] .= ','.$listMetadataRecord; |
|
| 606 | 606 | $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord; |
| 607 | 607 | } |
| 608 | 608 | } |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | $cache = null; |
| 654 | 654 | // Calculate cache identifier. |
| 655 | 655 | if ($enableCache === true) { |
| 656 | - $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, true)); |
|
| 656 | + $cacheIdentifier = Helper::digest($solr->core.print_r($parameters, true)); |
|
| 657 | 657 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
| 658 | 658 | } |
| 659 | 659 | $resultSet = [ |
@@ -742,24 +742,24 @@ discard block |
||
| 742 | 742 | foreach ($this->collections as $collection) { |
| 743 | 743 | // check for virtual collections query string |
| 744 | 744 | if ($collection->getIndexSearch()) { |
| 745 | - $virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '(' . $collection->getIndexSearch() . ')' : ' OR (' . $collection->getIndexSearch() . ')'; |
|
| 745 | + $virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '('.$collection->getIndexSearch().')' : ' OR ('.$collection->getIndexSearch().')'; |
|
| 746 | 746 | } else { |
| 747 | - $collectionsQueryString .= empty($collectionsQueryString) ? '"' . $collection->getIndexName() . '"' : ' OR "' . $collection->getIndexName() . '"'; |
|
| 747 | + $collectionsQueryString .= empty($collectionsQueryString) ? '"'.$collection->getIndexName().'"' : ' OR "'.$collection->getIndexName().'"'; |
|
| 748 | 748 | } |
| 749 | 749 | } |
| 750 | 750 | |
| 751 | 751 | // distinguish between simple collection browsing and actual searching within the collection(s) |
| 752 | 752 | if (!empty($collectionsQueryString)) { |
| 753 | 753 | if (empty($query)) { |
| 754 | - $collectionsQueryString = '(collection_faceting:(' . $collectionsQueryString . ') AND toplevel:true AND partof:0)'; |
|
| 754 | + $collectionsQueryString = '(collection_faceting:('.$collectionsQueryString.') AND toplevel:true AND partof:0)'; |
|
| 755 | 755 | } else { |
| 756 | - $collectionsQueryString = '(collection_faceting:(' . $collectionsQueryString . '))'; |
|
| 756 | + $collectionsQueryString = '(collection_faceting:('.$collectionsQueryString.'))'; |
|
| 757 | 757 | } |
| 758 | 758 | } |
| 759 | 759 | |
| 760 | 760 | // virtual collections might query documents that are neither toplevel:true nor partof:0 and need to be searched separately |
| 761 | 761 | if (!empty($virtualCollectionsQueryString)) { |
| 762 | - $virtualCollectionsQueryString = '(' . $virtualCollectionsQueryString . ')'; |
|
| 762 | + $virtualCollectionsQueryString = '('.$virtualCollectionsQueryString.')'; |
|
| 763 | 763 | } |
| 764 | 764 | |
| 765 | 765 | // combine both query strings into a single filterquery via OR if both are given, otherwise pass either of those |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | private function translateLanguageCode(&$doc): void |
| 838 | 838 | { |
| 839 | 839 | if ($doc['metadata']['language']) { |
| 840 | - foreach($doc['metadata']['language'] as $indexName => $language) { |
|
| 840 | + foreach ($doc['metadata']['language'] as $indexName => $language) { |
|
| 841 | 841 | $doc['metadata']['language'][$indexName] = Helper::getLanguageName($language); |
| 842 | 842 | } |
| 843 | 843 | } |
@@ -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); |
| 193 | 193 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
| 194 | 194 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
@@ -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]) || isset($hasMetadataSection['dmdSec'])) { |
| 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 | } |
@@ -674,13 +674,13 @@ discard block |
||
| 674 | 674 | if ($resArray['format'] > 0 && !empty($resArray['xpath_sorting'])) { |
| 675 | 675 | $values = $domXPath->evaluate($resArray['xpath_sorting'], $domNode); |
| 676 | 676 | if ($values instanceof \DOMNodeList && $values->length > 0) { |
| 677 | - $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
| 677 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
| 678 | 678 | } elseif (!($values instanceof \DOMNodeList)) { |
| 679 | - $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values); |
|
| 679 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values); |
|
| 680 | 680 | } |
| 681 | 681 | } |
| 682 | - if (empty($metadata[$resArray['index_name'] . '_sorting'][0])) { |
|
| 683 | - $metadata[$resArray['index_name'] . '_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
| 682 | + if (empty($metadata[$resArray['index_name'].'_sorting'][0])) { |
|
| 683 | + $metadata[$resArray['index_name'].'_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
| 684 | 684 | } |
| 685 | 685 | } |
| 686 | 686 | } |
@@ -740,11 +740,11 @@ discard block |
||
| 740 | 740 | return true; |
| 741 | 741 | } |
| 742 | 742 | } else { |
| 743 | - $this->logger->warning('Invalid class/method "' . $class . '->extractMetadata()" for metadata format "' . $this->mdSec[$dmdId]['type'] . '"'); |
|
| 743 | + $this->logger->warning('Invalid class/method "'.$class.'->extractMetadata()" for metadata format "'.$this->mdSec[$dmdId]['type'].'"'); |
|
| 744 | 744 | } |
| 745 | 745 | } |
| 746 | 746 | } else { |
| 747 | - $this->logger->notice('Unsupported metadata format "' . $this->mdSec[$dmdId]['type'] . '" in ' . $mdSectionType . ' with @ID "' . $dmdId . '"'); |
|
| 747 | + $this->logger->notice('Unsupported metadata format "'.$this->mdSec[$dmdId]['type'].'" in '.$mdSectionType.' with @ID "'.$dmdId.'"'); |
|
| 748 | 748 | } |
| 749 | 749 | return false; |
| 750 | 750 | } |
@@ -851,7 +851,7 @@ discard block |
||
| 851 | 851 | $dmdIds = $this->logicalUnits[$id]['dmdId'] ?? ''; |
| 852 | 852 | $admIds = $this->logicalUnits[$id]['admId'] ?? ''; |
| 853 | 853 | } else { |
| 854 | - $mdSec = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]')[0]; |
|
| 854 | + $mdSec = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]')[0]; |
|
| 855 | 855 | if ($mdSec) { |
| 856 | 856 | $dmdIds = (string) $mdSec->attributes()->DMDID; |
| 857 | 857 | $admIds = (string) $mdSec->attributes()->ADMID; |
@@ -881,7 +881,7 @@ discard block |
||
| 881 | 881 | |
| 882 | 882 | return array_filter( |
| 883 | 883 | $allMdIds, |
| 884 | - function ($element) { |
|
| 884 | + function($element) { |
|
| 885 | 885 | return !empty($element); |
| 886 | 886 | } |
| 887 | 887 | ); |
@@ -907,7 +907,7 @@ discard block |
||
| 907 | 907 | */ |
| 908 | 908 | public function getStructureDepth(string $logId) |
| 909 | 909 | { |
| 910 | - $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
|
| 910 | + $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*'); |
|
| 911 | 911 | if (!empty($ancestors)) { |
| 912 | 912 | return count($ancestors); |
| 913 | 913 | } else { |
@@ -931,9 +931,9 @@ discard block |
||
| 931 | 931 | $this->registerNamespaces($this->mets); |
| 932 | 932 | } else { |
| 933 | 933 | if (!empty($location)) { |
| 934 | - $this->logger->error('No METS part found in document with location "' . $location . '".'); |
|
| 934 | + $this->logger->error('No METS part found in document with location "'.$location.'".'); |
|
| 935 | 935 | } elseif (!empty($this->recordId)) { |
| 936 | - $this->logger->error('No METS part found in document with recordId "' . $this->recordId . '".'); |
|
| 936 | + $this->logger->error('No METS part found in document with recordId "'.$this->recordId.'".'); |
|
| 937 | 937 | } else { |
| 938 | 938 | $this->logger->error('No METS part found in current document.'); |
| 939 | 939 | } |
@@ -954,7 +954,7 @@ discard block |
||
| 954 | 954 | return true; |
| 955 | 955 | } |
| 956 | 956 | } |
| 957 | - $this->logger->error('Could not load XML file from "' . $location . '"'); |
|
| 957 | + $this->logger->error('Could not load XML file from "'.$location.'"'); |
|
| 958 | 958 | return false; |
| 959 | 959 | } |
| 960 | 960 | |
@@ -1077,10 +1077,10 @@ discard block |
||
| 1077 | 1077 | |
| 1078 | 1078 | if (!empty($mdType) && !empty($this->formats[(string) $mdType[0]])) { |
| 1079 | 1079 | $type = (string) $mdType[0]; |
| 1080 | - $xml = $element->xpath('./mets:mdWrap[@MDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
| 1080 | + $xml = $element->xpath('./mets:mdWrap[@MDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
| 1081 | 1081 | } elseif (!empty($otherMdType) && !empty($this->formats[(string) $otherMdType[0]])) { |
| 1082 | 1082 | $type = (string) $otherMdType[0]; |
| 1083 | - $xml = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
| 1083 | + $xml = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
| 1084 | 1084 | } |
| 1085 | 1085 | |
| 1086 | 1086 | if (empty($xml)) { |
@@ -1273,9 +1273,9 @@ discard block |
||
| 1273 | 1273 | || $forceReload |
| 1274 | 1274 | ) { |
| 1275 | 1275 | // Retain current PID. |
| 1276 | - $cPid = $this->cPid ?: $this->pid; |
|
| 1276 | + $cPid = $this->cPid ? : $this->pid; |
|
| 1277 | 1277 | if (!$cPid) { |
| 1278 | - $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions'); |
|
| 1278 | + $this->logger->error('Invalid PID '.$cPid.' for structure definitions'); |
|
| 1279 | 1279 | $this->thumbnailLoaded = true; |
| 1280 | 1280 | return $this->thumbnail; |
| 1281 | 1281 | } |
@@ -1312,7 +1312,7 @@ discard block |
||
| 1312 | 1312 | if (!empty($resArray['thumbnail'])) { |
| 1313 | 1313 | $strctType = Helper::getIndexNameFromUid($resArray['thumbnail'], 'tx_dlf_structures', $cPid); |
| 1314 | 1314 | // Check if this document has a structure element of the desired type. |
| 1315 | - $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="' . $strctType . '"]/@ID'); |
|
| 1315 | + $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="'.$strctType.'"]/@ID'); |
|
| 1316 | 1316 | if (!empty($strctIds)) { |
| 1317 | 1317 | $strctId = (string) $strctIds[0]; |
| 1318 | 1318 | } |
@@ -1335,7 +1335,7 @@ discard block |
||
| 1335 | 1335 | } |
| 1336 | 1336 | } |
| 1337 | 1337 | } else { |
| 1338 | - $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database'); |
|
| 1338 | + $this->logger->error('No structure of type "'.$metadata['type'][0].'" found in database'); |
|
| 1339 | 1339 | } |
| 1340 | 1340 | $this->thumbnailLoaded = true; |
| 1341 | 1341 | } |
@@ -1381,7 +1381,7 @@ discard block |
||
| 1381 | 1381 | { |
| 1382 | 1382 | if (empty($this->parentHref)) { |
| 1383 | 1383 | // Get the closest ancestor of the current document which has a MPTR child. |
| 1384 | - $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $this->toplevelId . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
| 1384 | + $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$this->toplevelId.'"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
| 1385 | 1385 | if (!empty($parentMptr)) { |
| 1386 | 1386 | $this->parentHref = (string) $parentMptr[0]->attributes('http://www.w3.org/1999/xlink')->href; |
| 1387 | 1387 | } |
@@ -664,14 +664,14 @@ discard block |
||
| 664 | 664 | if ($fileContent !== false) { |
| 665 | 665 | $textFormat = $this->getTextFormat($fileContent); |
| 666 | 666 | } else { |
| 667 | - $this->logger->warning('Couldn\'t load full text file for structure node @ID "' . $id . '"'); |
|
| 667 | + $this->logger->warning('Couldn\'t load full text file for structure node @ID "'.$id.'"'); |
|
| 668 | 668 | return $fullText; |
| 669 | 669 | } |
| 670 | 670 | break; |
| 671 | 671 | } |
| 672 | 672 | } |
| 673 | 673 | } else { |
| 674 | - $this->logger->warning('Invalid structure node @ID "' . $id . '"'); |
|
| 674 | + $this->logger->warning('Invalid structure node @ID "'.$id.'"'); |
|
| 675 | 675 | return $fullText; |
| 676 | 676 | } |
| 677 | 677 | // Is this text format supported? |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | } |
| 684 | 684 | $fullText = $textMiniOcr; |
| 685 | 685 | } else { |
| 686 | - $this->logger->warning('Unsupported text format "' . $textFormat . '" in physical node with @ID "' . $id . '"'); |
|
| 686 | + $this->logger->warning('Unsupported text format "'.$textFormat.'" in physical node with @ID "'.$id.'"'); |
|
| 687 | 687 | } |
| 688 | 688 | return $fullText; |
| 689 | 689 | } |
@@ -712,10 +712,10 @@ discard block |
||
| 712 | 712 | $textMiniOcr = $obj->getTextAsMiniOcr($ocrTextXml); |
| 713 | 713 | $this->rawTextArray[$id] = $textMiniOcr; |
| 714 | 714 | } else { |
| 715 | - $this->logger->warning('Invalid class/method "' . $class . '->getRawText()" for text format "' . $textFormat . '"'); |
|
| 715 | + $this->logger->warning('Invalid class/method "'.$class.'->getRawText()" for text format "'.$textFormat.'"'); |
|
| 716 | 716 | } |
| 717 | 717 | } else { |
| 718 | - $this->logger->warning('Class "' . $class . ' does not exists for "' . $textFormat . ' text format"'); |
|
| 718 | + $this->logger->warning('Class "'.$class.' does not exists for "'.$textFormat.' text format"'); |
|
| 719 | 719 | } |
| 720 | 720 | return $textMiniOcr; |
| 721 | 721 | } |
@@ -790,10 +790,10 @@ discard block |
||
| 790 | 790 | $title = self::getTitle($partof, true); |
| 791 | 791 | } |
| 792 | 792 | } else { |
| 793 | - Helper::log('No document with UID ' . $uid . ' found or document not accessible', LOG_SEVERITY_WARNING); |
|
| 793 | + Helper::log('No document with UID '.$uid.' found or document not accessible', LOG_SEVERITY_WARNING); |
|
| 794 | 794 | } |
| 795 | 795 | } else { |
| 796 | - Helper::log('Invalid UID ' . $uid . ' for document', LOG_SEVERITY_ERROR); |
|
| 796 | + Helper::log('Invalid UID '.$uid.' for document', LOG_SEVERITY_ERROR); |
|
| 797 | 797 | } |
| 798 | 798 | return $title; |
| 799 | 799 | } |
@@ -883,7 +883,7 @@ discard block |
||
| 883 | 883 | // the actual loading is format specific |
| 884 | 884 | return $this->loadLocation($location); |
| 885 | 885 | } else { |
| 886 | - $this->logger->error('Invalid file location "' . $location . '" for document loading'); |
|
| 886 | + $this->logger->error('Invalid file location "'.$location.'" for document loading'); |
|
| 887 | 887 | } |
| 888 | 888 | return false; |
| 889 | 889 | } |
@@ -1035,7 +1035,7 @@ discard block |
||
| 1035 | 1035 | // Set metadata definitions' PID. |
| 1036 | 1036 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
| 1037 | 1037 | if (!$cPid) { |
| 1038 | - $this->logger->error('Invalid PID ' . $cPid . ' for metadata definitions'); |
|
| 1038 | + $this->logger->error('Invalid PID '.$cPid.' for metadata definitions'); |
|
| 1039 | 1039 | return []; |
| 1040 | 1040 | } |
| 1041 | 1041 | if ( |
@@ -1212,12 +1212,12 @@ discard block |
||
| 1212 | 1212 | */ |
| 1213 | 1213 | public function __get(string $var) |
| 1214 | 1214 | { |
| 1215 | - $method = 'magicGet' . ucfirst($var); |
|
| 1215 | + $method = 'magicGet'.ucfirst($var); |
|
| 1216 | 1216 | if ( |
| 1217 | 1217 | !property_exists($this, $var) |
| 1218 | 1218 | || !method_exists($this, $method) |
| 1219 | 1219 | ) { |
| 1220 | - $this->logger->warning('There is no getter function for property "' . $var . '"'); |
|
| 1220 | + $this->logger->warning('There is no getter function for property "'.$var.'"'); |
|
| 1221 | 1221 | return null; |
| 1222 | 1222 | } else { |
| 1223 | 1223 | return $this->$method(); |
@@ -1250,12 +1250,12 @@ discard block |
||
| 1250 | 1250 | */ |
| 1251 | 1251 | public function __set(string $var, $value): void |
| 1252 | 1252 | { |
| 1253 | - $method = '_set' . ucfirst($var); |
|
| 1253 | + $method = '_set'.ucfirst($var); |
|
| 1254 | 1254 | if ( |
| 1255 | 1255 | !property_exists($this, $var) |
| 1256 | 1256 | || !method_exists($this, $method) |
| 1257 | 1257 | ) { |
| 1258 | - $this->logger->warning('There is no setter function for property "' . $var . '"'); |
|
| 1258 | + $this->logger->warning('There is no setter function for property "'.$var.'"'); |
|
| 1259 | 1259 | } else { |
| 1260 | 1260 | $this->$method($value); |
| 1261 | 1261 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | } elseif ($checksum == 10) { |
| 147 | 147 | //TODO: Binary operation "+" between string and 1 results in an error. |
| 148 | 148 | // @phpstan-ignore-next-line |
| 149 | - return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD'); |
|
| 149 | + return self::checkIdentifier(($digits + 1).substr($id, -2, 2), 'SWD'); |
|
| 150 | 150 | } elseif (substr($id, -1, 1) != $checksum) { |
| 151 | 151 | return false; |
| 152 | 152 | } |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
| 346 | 346 | // Merge initialization vector and encrypted data. |
| 347 | 347 | if ($encrypted !== false) { |
| 348 | - $encrypted = base64_encode($iv . $encrypted); |
|
| 348 | + $encrypted = base64_encode($iv.$encrypted); |
|
| 349 | 349 | } |
| 350 | 350 | return $encrypted; |
| 351 | 351 | } |
@@ -404,8 +404,8 @@ discard block |
||
| 404 | 404 | public static function getHookObjects(string $scriptRelPath): array |
| 405 | 405 | { |
| 406 | 406 | $hookObjects = []; |
| 407 | - if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) { |
|
| 408 | - foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) { |
|
| 407 | + if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'])) { |
|
| 408 | + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'] as $classRef) { |
|
| 409 | 409 | $hookObjects[] = GeneralUtility::makeInstance($classRef); |
| 410 | 410 | } |
| 411 | 411 | } |
@@ -434,12 +434,12 @@ discard block |
||
| 434 | 434 | // NOTE: Only use tables that don't have too many entries! |
| 435 | 435 | || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores']) |
| 436 | 436 | ) { |
| 437 | - self::log('Invalid UID "' . $uid . '" or table "' . $table . '"', LOG_SEVERITY_ERROR); |
|
| 437 | + self::log('Invalid UID "'.$uid.'" or table "'.$table.'"', LOG_SEVERITY_ERROR); |
|
| 438 | 438 | return ''; |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | - $makeCacheKey = function ($pid, $uid) { |
|
| 442 | - return $pid . '.' . $uid; |
|
| 441 | + $makeCacheKey = function($pid, $uid) { |
|
| 442 | + return $pid.'.'.$uid; |
|
| 443 | 443 | }; |
| 444 | 444 | |
| 445 | 445 | static $cache = []; |
@@ -449,9 +449,9 @@ discard block |
||
| 449 | 449 | |
| 450 | 450 | $result = $queryBuilder |
| 451 | 451 | ->select( |
| 452 | - $table . '.index_name AS index_name', |
|
| 453 | - $table . '.uid AS uid', |
|
| 454 | - $table . '.pid AS pid', |
|
| 452 | + $table.'.index_name AS index_name', |
|
| 453 | + $table.'.uid AS uid', |
|
| 454 | + $table.'.pid AS pid', |
|
| 455 | 455 | ) |
| 456 | 456 | ->from($table) |
| 457 | 457 | ->execute(); |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | $result = $cache[$table][$cacheKey] ?? ''; |
| 470 | 470 | |
| 471 | 471 | if ($result === '') { |
| 472 | - self::log('No "index_name" with UID ' . $uid . ' and PID ' . $pid . ' found in table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
| 472 | + self::log('No "index_name" with UID '.$uid.' and PID '.$pid.' found in table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | return $result; |
@@ -498,11 +498,11 @@ discard block |
||
| 498 | 498 | // No ISO code, return unchanged. |
| 499 | 499 | return $code; |
| 500 | 500 | } |
| 501 | - $lang = LocalizationUtility::translate('LLL:' . $file . ':' . $code); |
|
| 501 | + $lang = LocalizationUtility::translate('LLL:'.$file.':'.$code); |
|
| 502 | 502 | if (!empty($lang)) { |
| 503 | 503 | return $lang; |
| 504 | 504 | } else { |
| 505 | - self::log('Language code "' . $code . '" not found in ISO-639 table', LOG_SEVERITY_NOTICE); |
|
| 505 | + self::log('Language code "'.$code.'" not found in ISO-639 table', LOG_SEVERITY_NOTICE); |
|
| 506 | 506 | return $code; |
| 507 | 507 | } |
| 508 | 508 | } |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | '-' => 39, |
| 604 | 604 | ':' => 17, |
| 605 | 605 | ]; |
| 606 | - $urn = strtolower($base . $id); |
|
| 606 | + $urn = strtolower($base.$id); |
|
| 607 | 607 | if (preg_match('/[^a-z\d:-]/', $urn)) { |
| 608 | 608 | self::log('Invalid chars in given parameters', LOG_SEVERITY_WARNING); |
| 609 | 609 | return ''; |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | $checksum += ($i + 1) * (int) substr($digits, $i, 1); |
| 618 | 618 | } |
| 619 | 619 | $checksum = substr((string) floor($checksum / (int) substr($digits, -1, 1)), -1, 1); |
| 620 | - return $base . $id . $checksum; |
|
| 620 | + return $base.$id.$checksum; |
|
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | /** |
@@ -724,7 +724,7 @@ discard block |
||
| 724 | 724 | // Sanitize input. |
| 725 | 725 | $pid = max((int) $pid, 0); |
| 726 | 726 | if (!$pid) { |
| 727 | - self::log('Invalid PID ' . $pid . ' for translation', LOG_SEVERITY_WARNING); |
|
| 727 | + self::log('Invalid PID '.$pid.' for translation', LOG_SEVERITY_WARNING); |
|
| 728 | 728 | return $indexName; |
| 729 | 729 | } |
| 730 | 730 | /** @var PageRepository $pageRepository */ |
@@ -747,13 +747,13 @@ discard block |
||
| 747 | 747 | // First fetch the uid of the received index_name |
| 748 | 748 | $result = $queryBuilder |
| 749 | 749 | ->select( |
| 750 | - $table . '.uid AS uid', |
|
| 751 | - $table . '.l18n_parent AS l18n_parent' |
|
| 750 | + $table.'.uid AS uid', |
|
| 751 | + $table.'.l18n_parent AS l18n_parent' |
|
| 752 | 752 | ) |
| 753 | 753 | ->from($table) |
| 754 | 754 | ->where( |
| 755 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
| 756 | - $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($indexName)), |
|
| 755 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
| 756 | + $queryBuilder->expr()->eq($table.'.index_name', $queryBuilder->expr()->literal($indexName)), |
|
| 757 | 757 | self::whereExpression($table, true) |
| 758 | 758 | ) |
| 759 | 759 | ->setMaxResults(1) |
@@ -764,12 +764,12 @@ discard block |
||
| 764 | 764 | if ($row) { |
| 765 | 765 | // Now we use the uid of the l18_parent to fetch the index_name of the translated content element. |
| 766 | 766 | $result = $queryBuilder |
| 767 | - ->select($table . '.index_name AS index_name') |
|
| 767 | + ->select($table.'.index_name AS index_name') |
|
| 768 | 768 | ->from($table) |
| 769 | 769 | ->where( |
| 770 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
| 771 | - $queryBuilder->expr()->eq($table . '.uid', $row['l18n_parent']), |
|
| 772 | - $queryBuilder->expr()->eq($table . '.sys_language_uid', (int) $languageContentId), |
|
| 770 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
| 771 | + $queryBuilder->expr()->eq($table.'.uid', $row['l18n_parent']), |
|
| 772 | + $queryBuilder->expr()->eq($table.'.sys_language_uid', (int) $languageContentId), |
|
| 773 | 773 | self::whereExpression($table, true) |
| 774 | 774 | ) |
| 775 | 775 | ->setMaxResults(1) |
@@ -787,14 +787,14 @@ discard block |
||
| 787 | 787 | if (empty($labels[$table][$pid][$languageContentId][$indexName])) { |
| 788 | 788 | // Check if this table is allowed for translation. |
| 789 | 789 | if (in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures'])) { |
| 790 | - $additionalWhere = $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]); |
|
| 790 | + $additionalWhere = $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]); |
|
| 791 | 791 | if ($languageContentId > 0) { |
| 792 | 792 | $additionalWhere = $queryBuilder->expr()->andX( |
| 793 | 793 | $queryBuilder->expr()->orX( |
| 794 | - $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]), |
|
| 795 | - $queryBuilder->expr()->eq($table . '.sys_language_uid', (int) $languageContentId) |
|
| 794 | + $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]), |
|
| 795 | + $queryBuilder->expr()->eq($table.'.sys_language_uid', (int) $languageContentId) |
|
| 796 | 796 | ), |
| 797 | - $queryBuilder->expr()->eq($table . '.l18n_parent', 0) |
|
| 797 | + $queryBuilder->expr()->eq($table.'.l18n_parent', 0) |
|
| 798 | 798 | ); |
| 799 | 799 | } |
| 800 | 800 | |
@@ -803,7 +803,7 @@ discard block |
||
| 803 | 803 | ->select('*') |
| 804 | 804 | ->from($table) |
| 805 | 805 | ->where( |
| 806 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
| 806 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
| 807 | 807 | $additionalWhere, |
| 808 | 808 | self::whereExpression($table, true) |
| 809 | 809 | ) |
@@ -821,10 +821,10 @@ discard block |
||
| 821 | 821 | } |
| 822 | 822 | } |
| 823 | 823 | } else { |
| 824 | - self::log('No translation with PID ' . $pid . ' available in table "' . $table . '" or translation not accessible', LOG_SEVERITY_NOTICE); |
|
| 824 | + self::log('No translation with PID '.$pid.' available in table "'.$table.'" or translation not accessible', LOG_SEVERITY_NOTICE); |
|
| 825 | 825 | } |
| 826 | 826 | } else { |
| 827 | - self::log('No translations available for table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
| 827 | + self::log('No translations available for table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
| 828 | 828 | } |
| 829 | 829 | } |
| 830 | 830 | |
@@ -870,7 +870,7 @@ discard block |
||
| 870 | 870 | return GeneralUtility::makeInstance(ConnectionPool::class) |
| 871 | 871 | ->getQueryBuilderForTable($table) |
| 872 | 872 | ->expr() |
| 873 | - ->eq($table . '.' . $GLOBALS['TCA'][$table]['ctrl']['delete'], 0); |
|
| 873 | + ->eq($table.'.'.$GLOBALS['TCA'][$table]['ctrl']['delete'], 0); |
|
| 874 | 874 | } else { |
| 875 | 875 | self::log('Unexpected TYPO3_MODE', LOG_SEVERITY_ERROR); |
| 876 | 876 | return '1=-1'; |
@@ -936,7 +936,7 @@ discard block |
||
| 936 | 936 | try { |
| 937 | 937 | $response = $requestFactory->request($url, 'GET', $configuration); |
| 938 | 938 | } catch (\Exception $e) { |
| 939 | - self::log('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.', LOG_SEVERITY_WARNING); |
|
| 939 | + self::log('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.', LOG_SEVERITY_WARNING); |
|
| 940 | 940 | return false; |
| 941 | 941 | } |
| 942 | 942 | return $response->getBody()->getContents(); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $this->initializeRepositories($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 | $output_solrCores = []; |
| 131 | 131 | foreach ($allSolrCores as $index_name => $uid) { |
| 132 | - $output_solrCores[] = $uid . ' : ' . $index_name; |
|
| 132 | + $output_solrCores[] = $uid.' : '.$index_name; |
|
| 133 | 133 | } |
| 134 | 134 | if (empty($output_solrCores)) { |
| 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", $output_solrCores) . "\n"); |
|
| 138 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $output_solrCores)."\n"); |
|
| 139 | 139 | return BaseCommand::FAILURE; |
| 140 | 140 | } |
| 141 | 141 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | ->setOffset((int) $input->getOption('index-begin')) |
| 169 | 169 | ->execute(); |
| 170 | 170 | |
| 171 | - $io->writeln($input->getOption('index-limit') . ' documents starting from ' . $input->getOption('index-begin') . ' will be indexed.'); |
|
| 171 | + $io->writeln($input->getOption('index-limit').' documents starting from '.$input->getOption('index-begin').' will be indexed.'); |
|
| 172 | 172 | } elseif ( |
| 173 | 173 | !empty($input->getOption('coll')) |
| 174 | 174 | && !is_array($input->getOption('coll')) |
@@ -189,15 +189,15 @@ discard block |
||
| 189 | 189 | $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true); |
| 190 | 190 | |
| 191 | 191 | if ($doc === null) { |
| 192 | - $io->warning('WARNING: Document "' . $document->getLocation() . '" could not be loaded. Skip to next document.'); |
|
| 192 | + $io->warning('WARNING: Document "'.$document->getLocation().'" could not be loaded. Skip to next document.'); |
|
| 193 | 193 | continue; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | if ($dryRun) { |
| 197 | - $io->writeln('DRY RUN: Would index ' . ($id + 1) . '/' . count($documents) . ' with UID "' . $document->getUid() . '" ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
| 197 | + $io->writeln('DRY RUN: Would index '.($id + 1).'/'.count($documents).' with UID "'.$document->getUid().'" ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
| 198 | 198 | } else { |
| 199 | 199 | if ($io->isVerbose()) { |
| 200 | - $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 . '.'); |
|
| 200 | + $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.'.'); |
|
| 201 | 201 | } |
| 202 | 202 | $document->setCurrentDocument($doc); |
| 203 | 203 | // save to database |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | * |
| 335 | 335 | * @return void |
| 336 | 336 | */ |
| 337 | - private function addCollections(Document &$document, array $collections): void |
|
| 337 | + private function addCollections(Document & $document, array $collections): void |
|
| 338 | 338 | { |
| 339 | 339 | foreach ($collections as $collection) { |
| 340 | 340 | $documentCollection = $this->collectionRepository->findOneByIndexName($collection); |
@@ -376,11 +376,11 @@ discard block |
||
| 376 | 376 | |
| 377 | 377 | for ($i = 0; $i < $count; $i++) { |
| 378 | 378 | // Build the next part to add |
| 379 | - $nextPart = ($i === 0 ? '' : $delimiter) . $metadataAuthor[$i]; |
|
| 379 | + $nextPart = ($i === 0 ? '' : $delimiter).$metadataAuthor[$i]; |
|
| 380 | 380 | // Check if adding this part and ellipsis in future would exceed the character limit |
| 381 | - if (strlen($authors . $nextPart . $delimiter . $ellipsis) > 255) { |
|
| 381 | + if (strlen($authors.$nextPart.$delimiter.$ellipsis) > 255) { |
|
| 382 | 382 | // Add ellipsis and stop adding more authors |
| 383 | - $authors .= $delimiter . $ellipsis; |
|
| 383 | + $authors .= $delimiter.$ellipsis; |
|
| 384 | 384 | break; |
| 385 | 385 | } |
| 386 | 386 | // Add the part to the main string |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $this->initializeRepositories($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 | $output_solrCores = []; |
| 131 | 131 | foreach ($allSolrCores as $index_name => $uid) { |
| 132 | - $output_solrCores[] = $uid . ' : ' . $index_name; |
|
| 132 | + $output_solrCores[] = $uid.' : '.$index_name; |
|
| 133 | 133 | } |
| 134 | 134 | if (empty($output_solrCores)) { |
| 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", $output_solrCores) . "\n"); |
|
| 138 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $output_solrCores)."\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($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 | $output_solrCores = []; |
| 115 | 115 | foreach ($allSolrCores as $index_name => $uid) { |
| 116 | - $output_solrCores[] = $uid . ' : ' . $index_name; |
|
| 116 | + $output_solrCores[] = $uid.' : '.$index_name; |
|
| 117 | 117 | } |
| 118 | 118 | if (empty($output_solrCores)) { |
| 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", $output_solrCores) . "\n"); |
|
| 122 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $output_solrCores)."\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,17 +172,17 @@ 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 | } else { |
| 184 | 184 | if ($io->isVerbose()) { |
| 185 | - $io->section('Indexing ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
| 185 | + $io->section('Indexing '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
| 186 | 186 | } |
| 187 | 187 | $document->setCurrentDocument($doc); |
| 188 | 188 | // save to database |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | |
| 385 | 385 | $excludeOtherWhere = ''; |
| 386 | 386 | if ($settings['excludeOther']) { |
| 387 | - $excludeOtherWhere = 'tx_dlf_documents.pid=' . intval($settings['storagePid']); |
|
| 387 | + $excludeOtherWhere = 'tx_dlf_documents.pid='.intval($settings['storagePid']); |
|
| 388 | 388 | } |
| 389 | 389 | // Check if there are any metadata to suggest. |
| 390 | 390 | return $queryBuilder |
@@ -438,12 +438,12 @@ discard block |
||
| 438 | 438 | $connection = GeneralUtility::makeInstance(ConnectionPool::class) |
| 439 | 439 | ->getConnectionForTable('tx_dlf_documents'); |
| 440 | 440 | |
| 441 | - $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` ' . |
|
| 442 | - 'FROM `tx_dlf_documents` ' . |
|
| 443 | - 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` ' . |
|
| 444 | - 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` ' . |
|
| 445 | - 'WHERE `tx_dlf_documents`.`record_id` = ? ' . |
|
| 446 | - 'AND `tx_dlf_relations`.`ident`="docs_colls" ' . |
|
| 441 | + $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` '. |
|
| 442 | + 'FROM `tx_dlf_documents` '. |
|
| 443 | + 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` '. |
|
| 444 | + 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` '. |
|
| 445 | + 'WHERE `tx_dlf_documents`.`record_id` = ? '. |
|
| 446 | + 'AND `tx_dlf_relations`.`ident`="docs_colls" '. |
|
| 447 | 447 | $where; |
| 448 | 448 | |
| 449 | 449 | $values = [ |
@@ -474,13 +474,13 @@ discard block |
||
| 474 | 474 | $connection = GeneralUtility::makeInstance(ConnectionPool::class) |
| 475 | 475 | ->getConnectionForTable('tx_dlf_documents'); |
| 476 | 476 | |
| 477 | - $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` ' . |
|
| 478 | - 'FROM `tx_dlf_documents` ' . |
|
| 479 | - 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` ' . |
|
| 480 | - 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` ' . |
|
| 481 | - 'WHERE `tx_dlf_documents`.`uid` IN ( ? ) ' . |
|
| 482 | - 'AND `tx_dlf_relations`.`ident`="docs_colls" ' . |
|
| 483 | - 'AND ' . Helper::whereExpression('tx_dlf_collections') . ' ' . |
|
| 477 | + $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` '. |
|
| 478 | + 'FROM `tx_dlf_documents` '. |
|
| 479 | + 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` '. |
|
| 480 | + 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` '. |
|
| 481 | + 'WHERE `tx_dlf_documents`.`uid` IN ( ? ) '. |
|
| 482 | + 'AND `tx_dlf_relations`.`ident`="docs_colls" '. |
|
| 483 | + 'AND '.Helper::whereExpression('tx_dlf_collections').' '. |
|
| 484 | 484 | 'GROUP BY `tx_dlf_documents`.`uid` '; |
| 485 | 485 | |
| 486 | 486 | $values = [ |