@@ -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 = [ |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | $output = []; |
| 56 | 56 | $solrCore = (string) $parameters['solrcore']; |
| 57 | 57 | $uHash = (string) $parameters['uHash']; |
| 58 | - if (hash_equals(GeneralUtility::hmac((string) (new Typo3Version()) . Environment::getExtensionsPath(), 'SearchSuggest'), $uHash) === false) { |
|
| 58 | + if (hash_equals(GeneralUtility::hmac((string) (new Typo3Version()).Environment::getExtensionsPath(), 'SearchSuggest'), $uHash) === false) { |
|
| 59 | 59 | throw new \InvalidArgumentException('No valid parameter passed!', 1580585079); |
| 60 | 60 | } |
| 61 | 61 | // Perform Solr query. |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | $encrypted = (string) $parameters['encrypted']; |
| 73 | 73 | if (empty($encrypted)) { |
| 74 | - throw new \InvalidArgumentException('No valid parameter passed: ' . $parameters['middleware'] . ' ' . $parameters['encrypted'] . '!', 1580585079); |
|
| 74 | + throw new \InvalidArgumentException('No valid parameter passed: '.$parameters['middleware'].' '.$parameters['encrypted'].'!', 1580585079); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $output = [ |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | private function getQuery(array $parameters): string |
| 176 | 176 | { |
| 177 | - return $this->fields['fulltext'] . ':(' . Solr::escapeQuery((string) $parameters['q']) . ') AND ' . $this->fields['uid'] . ':' . $this->getUid($parameters['uid']); |
|
| 177 | + return $this->fields['fulltext'].':('.Solr::escapeQuery((string) $parameters['q']).') AND '.$this->fields['uid'].':'.$this->getUid($parameters['uid']); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | /** |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public function extractAuthorsIfNoAutRoleTermAssigned(): void |
| 62 | 62 | { |
| 63 | - $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/Format/modsAuthorNoAutRoleTerm.xml'); |
|
| 63 | + $xml = simplexml_load_file(__DIR__.'/../../Fixtures/Format/modsAuthorNoAutRoleTerm.xml'); |
|
| 64 | 64 | $mods = new Mods(); |
| 65 | 65 | |
| 66 | 66 | $mods->extractMetadata($xml, $this->metadata, false); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function extractAuthorsWithAutRoleTermAssigned(): void |
| 82 | 82 | { |
| 83 | - $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/Format/modsAuthorWithAutRoleTerm.xml'); |
|
| 83 | + $xml = simplexml_load_file(__DIR__.'/../../Fixtures/Format/modsAuthorWithAutRoleTerm.xml'); |
|
| 84 | 84 | $mods = new Mods(); |
| 85 | 85 | |
| 86 | 86 | $mods->extractMetadata($xml, $this->metadata, false); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function extractPlaces(): void |
| 104 | 104 | { |
| 105 | - $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/Format/modsOriginInfo.xml'); |
|
| 105 | + $xml = simplexml_load_file(__DIR__.'/../../Fixtures/Format/modsOriginInfo.xml'); |
|
| 106 | 106 | $mods = new Mods(); |
| 107 | 107 | |
| 108 | 108 | $mods->extractMetadata($xml, $this->metadata, false); |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | public function extractYears(): void |
| 133 | 133 | { |
| 134 | - $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/Format/modsOriginInfo.xml'); |
|
| 134 | + $xml = simplexml_load_file(__DIR__.'/../../Fixtures/Format/modsOriginInfo.xml'); |
|
| 135 | 135 | $mods = new Mods(); |
| 136 | 136 | |
| 137 | 137 | $mods->extractMetadata($xml, $this->metadata, false); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public function extractPlacesWithElectronicEdInside(): void |
| 162 | 162 | { |
| 163 | - $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/Format/modsOriginInfoWithEditionElectronicEd.xml'); |
|
| 163 | + $xml = simplexml_load_file(__DIR__.'/../../Fixtures/Format/modsOriginInfoWithEditionElectronicEd.xml'); |
|
| 164 | 164 | $mods = new Mods(); |
| 165 | 165 | |
| 166 | 166 | $mods->extractMetadata($xml, $this->metadata, false); |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | public function extractYearsWithElectronicEdInside(): void |
| 191 | 191 | { |
| 192 | - $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/Format/modsOriginInfoWithEditionElectronicEd.xml'); |
|
| 192 | + $xml = simplexml_load_file(__DIR__.'/../../Fixtures/Format/modsOriginInfoWithEditionElectronicEd.xml'); |
|
| 193 | 193 | $mods = new Mods(); |
| 194 | 194 | |
| 195 | 195 | $mods->extractMetadata($xml, $this->metadata, false); |