@@ -27,8 +27,7 @@ discard block |
||
| 27 | 27 | * @subpackage dlf |
| 28 | 28 | * @access public |
| 29 | 29 | */ |
| 30 | -class OaiPmh extends \Kitodo\Dlf\Common\AbstractPlugin |
|
| 31 | -{ |
|
| 30 | +class OaiPmh extends \Kitodo\Dlf\Common\AbstractPlugin { |
|
| 32 | 31 | public $scriptRelPath = 'Classes/Plugin/OaiPmh.php'; |
| 33 | 32 | |
| 34 | 33 | /** |
@@ -78,8 +77,7 @@ discard block |
||
| 78 | 77 | * |
| 79 | 78 | * @return void |
| 80 | 79 | */ |
| 81 | - protected function deleteExpiredTokens() |
|
| 82 | - { |
|
| 80 | + protected function deleteExpiredTokens() { |
|
| 83 | 81 | // Delete expired resumption tokens. |
| 84 | 82 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_dlf_tokens'); |
| 85 | 83 | |
@@ -106,8 +104,7 @@ discard block |
||
| 106 | 104 | * |
| 107 | 105 | * @return \DOMElement XML node to add to the OAI response |
| 108 | 106 | */ |
| 109 | - protected function error($type) |
|
| 110 | - { |
|
| 107 | + protected function error($type) { |
|
| 111 | 108 | $this->error = true; |
| 112 | 109 | $error = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'error', htmlspecialchars($this->pi_getLL($type, $type), ENT_NOQUOTES, 'UTF-8')); |
| 113 | 110 | $error->setAttribute('code', $type); |
@@ -121,8 +118,7 @@ discard block |
||
| 121 | 118 | * |
| 122 | 119 | * @return void |
| 123 | 120 | */ |
| 124 | - protected function getUrlParams() |
|
| 125 | - { |
|
| 121 | + protected function getUrlParams() { |
|
| 126 | 122 | $allowedParams = [ |
| 127 | 123 | 'verb', |
| 128 | 124 | 'identifier', |
@@ -152,8 +148,7 @@ discard block |
||
| 152 | 148 | * |
| 153 | 149 | * @return \DOMElement XML node to add to the OAI response |
| 154 | 150 | */ |
| 155 | - protected function getDcData(array $metadata) |
|
| 156 | - { |
|
| 151 | + protected function getDcData(array $metadata) { |
|
| 157 | 152 | $oai_dc = $this->oai->createElementNS($this->formats['oai_dc']['namespace'], 'oai_dc:dc'); |
| 158 | 153 | $oai_dc->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:dc', 'http://purl.org/dc/elements/1.1/'); |
| 159 | 154 | $oai_dc->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); |
@@ -231,8 +226,7 @@ discard block |
||
| 231 | 226 | * |
| 232 | 227 | * @return \DOMElement XML node to add to the OAI response |
| 233 | 228 | */ |
| 234 | - protected function getEpicurData(array $metadata) |
|
| 235 | - { |
|
| 229 | + protected function getEpicurData(array $metadata) { |
|
| 236 | 230 | // Define all XML elements with or without qualified namespace. |
| 237 | 231 | if (empty($this->conf['unqualified_epicur'])) { |
| 238 | 232 | $epicur = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:epicur'); |
@@ -295,8 +289,7 @@ discard block |
||
| 295 | 289 | * |
| 296 | 290 | * @return \DOMElement XML node to add to the OAI response |
| 297 | 291 | */ |
| 298 | - protected function getMetsData(array $metadata) |
|
| 299 | - { |
|
| 292 | + protected function getMetsData(array $metadata) { |
|
| 300 | 293 | $mets = null; |
| 301 | 294 | // Load METS file. |
| 302 | 295 | $xml = new \DOMDocument(); |
@@ -328,8 +321,7 @@ discard block |
||
| 328 | 321 | * |
| 329 | 322 | * @return void |
| 330 | 323 | */ |
| 331 | - public function main($content, $conf) |
|
| 332 | - { |
|
| 324 | + public function main($content, $conf) { |
|
| 333 | 325 | // Initialize plugin. |
| 334 | 326 | $this->init($conf); |
| 335 | 327 | // Turn cache off. |
@@ -420,8 +412,7 @@ discard block |
||
| 420 | 412 | * |
| 421 | 413 | * @return \DOMElement XML node to add to the OAI response |
| 422 | 414 | */ |
| 423 | - protected function resume() |
|
| 424 | - { |
|
| 415 | + protected function resume() { |
|
| 425 | 416 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
| 426 | 417 | ->getQueryBuilderForTable('tx_dlf_tokens'); |
| 427 | 418 | |
@@ -454,8 +445,7 @@ discard block |
||
| 454 | 445 | * |
| 455 | 446 | * @return \DOMElement XML node to add to the OAI response |
| 456 | 447 | */ |
| 457 | - protected function verbGetRecord() |
|
| 458 | - { |
|
| 448 | + protected function verbGetRecord() { |
|
| 459 | 449 | if (count($this->piVars) !== 3 || empty($this->piVars['metadataPrefix']) || empty($this->piVars['identifier'])) { |
| 460 | 450 | return $this->error('badArgument'); |
| 461 | 451 | } |
@@ -548,8 +538,7 @@ discard block |
||
| 548 | 538 | * |
| 549 | 539 | * @return \DOMElement XML node to add to the OAI response |
| 550 | 540 | */ |
| 551 | - protected function verbIdentify() |
|
| 552 | - { |
|
| 541 | + protected function verbIdentify() { |
|
| 553 | 542 | // Check for invalid arguments. |
| 554 | 543 | if (count($this->piVars) > 1) { |
| 555 | 544 | return $this->error('badArgument'); |
@@ -632,8 +621,7 @@ discard block |
||
| 632 | 621 | * |
| 633 | 622 | * @return \DOMElement XML node to add to the OAI response |
| 634 | 623 | */ |
| 635 | - protected function verbListIdentifiers() |
|
| 636 | - { |
|
| 624 | + protected function verbListIdentifiers() { |
|
| 637 | 625 | // If we have a resumption token we can continue our work |
| 638 | 626 | if (!empty($this->piVars['resumptionToken'])) { |
| 639 | 627 | // "resumptionToken" is an exclusive argument. |
@@ -672,8 +660,7 @@ discard block |
||
| 672 | 660 | * |
| 673 | 661 | * @return \DOMElement XML node to add to the OAI response |
| 674 | 662 | */ |
| 675 | - protected function verbListMetadataFormats() |
|
| 676 | - { |
|
| 663 | + protected function verbListMetadataFormats() { |
|
| 677 | 664 | $resArray = []; |
| 678 | 665 | // Check for invalid arguments. |
| 679 | 666 | if (count($this->piVars) > 1) { |
@@ -731,8 +718,7 @@ discard block |
||
| 731 | 718 | * |
| 732 | 719 | * @return \DOMElement XML node to add to the OAI response |
| 733 | 720 | */ |
| 734 | - protected function verbListRecords() |
|
| 735 | - { |
|
| 721 | + protected function verbListRecords() { |
|
| 736 | 722 | // Check for invalid arguments. |
| 737 | 723 | if (!empty($this->piVars['resumptionToken'])) { |
| 738 | 724 | // "resumptionToken" is an exclusive argument. |
@@ -772,8 +758,7 @@ discard block |
||
| 772 | 758 | * |
| 773 | 759 | * @return \DOMElement XML node to add to the OAI response |
| 774 | 760 | */ |
| 775 | - protected function verbListSets() |
|
| 776 | - { |
|
| 761 | + protected function verbListSets() { |
|
| 777 | 762 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
| 778 | 763 | ->getQueryBuilderForTable('tx_dlf_collections'); |
| 779 | 764 | |
@@ -829,8 +814,7 @@ discard block |
||
| 829 | 814 | * @return array Array of matching records |
| 830 | 815 | * @throws \Exception |
| 831 | 816 | */ |
| 832 | - protected function fetchDocumentUIDs() |
|
| 833 | - { |
|
| 817 | + protected function fetchDocumentUIDs() { |
|
| 834 | 818 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
| 835 | 819 | ->getQueryBuilderForTable('tx_dlf_collections'); |
| 836 | 820 | |
@@ -951,8 +935,7 @@ discard block |
||
| 951 | 935 | * |
| 952 | 936 | * @return \DOMElement XML of enriched records |
| 953 | 937 | */ |
| 954 | - protected function generateOutputForDocumentList(DocumentList $documentListSet) |
|
| 955 | - { |
|
| 938 | + protected function generateOutputForDocumentList(DocumentList $documentListSet) { |
|
| 956 | 939 | $documentsToProcess = $documentListSet->removeRange(0, (int)$this->conf['limit']); |
| 957 | 940 | $verb = $this->piVars['verb']; |
| 958 | 941 | |
@@ -1055,8 +1038,7 @@ discard block |
||
| 1055 | 1038 | * |
| 1056 | 1039 | * @return \DOMElement XML for resumption token |
| 1057 | 1040 | */ |
| 1058 | - protected function generateResumptionTokenForDocumentListSet(DocumentList $documentListSet) |
|
| 1059 | - { |
|
| 1041 | + protected function generateResumptionTokenForDocumentListSet(DocumentList $documentListSet) { |
|
| 1060 | 1042 | if ($documentListSet->count() !== 0) { |
| 1061 | 1043 | $token = uniqid('', false); |
| 1062 | 1044 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | ->delete('tx_dlf_tokens') |
| 88 | 88 | ->where( |
| 89 | 89 | $queryBuilder->expr()->eq('tx_dlf_tokens.ident', $queryBuilder->createNamedParameter('oai')), |
| 90 | - $queryBuilder->expr()->lt('tx_dlf_tokens.tstamp', $queryBuilder->createNamedParameter((int)($GLOBALS['EXEC_TIME'] - $this->conf['expired']))) |
|
| 90 | + $queryBuilder->expr()->lt('tx_dlf_tokens.tstamp', $queryBuilder->createNamedParameter((int) ($GLOBALS['EXEC_TIME'] - $this->conf['expired']))) |
|
| 91 | 91 | ) |
| 92 | 92 | ->execute(); |
| 93 | 93 | |
@@ -157,13 +157,13 @@ discard block |
||
| 157 | 157 | $oai_dc = $this->oai->createElementNS($this->formats['oai_dc']['namespace'], 'oai_dc:dc'); |
| 158 | 158 | $oai_dc->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:dc', 'http://purl.org/dc/elements/1.1/'); |
| 159 | 159 | $oai_dc->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); |
| 160 | - $oai_dc->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['oai_dc']['namespace'] . ' ' . $this->formats['oai_dc']['schema']); |
|
| 160 | + $oai_dc->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['oai_dc']['namespace'].' '.$this->formats['oai_dc']['schema']); |
|
| 161 | 161 | $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['record_id'], ENT_NOQUOTES, 'UTF-8'))); |
| 162 | 162 | if (!empty($metadata['purl'])) { |
| 163 | 163 | $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['purl'], ENT_NOQUOTES, 'UTF-8'))); |
| 164 | 164 | } |
| 165 | 165 | if (!empty($metadata['prod_id'])) { |
| 166 | - $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', 'kitodo:production:' . htmlspecialchars($metadata['prod_id'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 166 | + $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', 'kitodo:production:'.htmlspecialchars($metadata['prod_id'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 167 | 167 | } |
| 168 | 168 | if (!empty($metadata['urn'])) { |
| 169 | 169 | $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['urn'], ENT_NOQUOTES, 'UTF-8'))); |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | } |
| 261 | 261 | // Add attributes and build XML tree. |
| 262 | 262 | $epicur->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); |
| 263 | - $epicur->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['epicur']['namespace'] . ' ' . $this->formats['epicur']['schema']); |
|
| 263 | + $epicur->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['epicur']['namespace'].' '.$this->formats['epicur']['schema']); |
|
| 264 | 264 | // Do we update an URN or register a new one? |
| 265 | 265 | if ($metadata['tstamp'] == $metadata['crdate']) { |
| 266 | 266 | $update->setAttribute('type', 'urn_new'); |
@@ -307,10 +307,10 @@ discard block |
||
| 307 | 307 | // Import node into \DOMDocument. |
| 308 | 308 | $mets = $this->oai->importNode($root->item(0), true); |
| 309 | 309 | } else { |
| 310 | - $this->logger->error('No METS part found in document with location "' . $metadata['location'] . '"'); |
|
| 310 | + $this->logger->error('No METS part found in document with location "'.$metadata['location'].'"'); |
|
| 311 | 311 | } |
| 312 | 312 | } else { |
| 313 | - $this->logger->error('Could not load XML file from "' . $metadata['location'] . '"'); |
|
| 313 | + $this->logger->error('Could not load XML file from "'.$metadata['location'].'"'); |
|
| 314 | 314 | } |
| 315 | 315 | if ($mets === null) { |
| 316 | 316 | $mets = $this->oai->createElementNS('http://kitodo.org/', 'kitodo:error', htmlspecialchars($this->pi_getLL('error', 'Error!'), ENT_NOQUOTES, 'UTF-8')); |
@@ -346,15 +346,15 @@ discard block |
||
| 346 | 346 | if (strpos($this->conf['stylesheet'], 'EXT:') === 0) { |
| 347 | 347 | [$extKey, $filePath] = explode('/', substr($this->conf['stylesheet'], 4), 2); |
| 348 | 348 | if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extKey)) { |
| 349 | - $this->conf['stylesheet'] = \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($extKey)) . $filePath; |
|
| 349 | + $this->conf['stylesheet'] = \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($extKey)).$filePath; |
|
| 350 | 350 | } |
| 351 | 351 | } |
| 352 | 352 | $stylesheet = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->conf['stylesheet']); |
| 353 | 353 | } else { |
| 354 | 354 | // Use default stylesheet if no custom stylesheet is given. |
| 355 | - $stylesheet = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey)) . 'Resources/Public/Stylesheets/OaiPmh.xsl'); |
|
| 355 | + $stylesheet = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey)).'Resources/Public/Stylesheets/OaiPmh.xsl'); |
|
| 356 | 356 | } |
| 357 | - $this->oai->appendChild($this->oai->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="' . htmlspecialchars($stylesheet, ENT_NOQUOTES, 'UTF-8') . '"')); |
|
| 357 | + $this->oai->appendChild($this->oai->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="'.htmlspecialchars($stylesheet, ENT_NOQUOTES, 'UTF-8').'"')); |
|
| 358 | 358 | // Create root element. |
| 359 | 359 | $root = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'OAI-PMH'); |
| 360 | 360 | $root->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); |
@@ -405,10 +405,10 @@ discard block |
||
| 405 | 405 | // Send headers. |
| 406 | 406 | header('HTTP/1.1 200 OK'); |
| 407 | 407 | header('Cache-Control: no-cache'); |
| 408 | - header('Content-Length: ' . strlen($content)); |
|
| 408 | + header('Content-Length: '.strlen($content)); |
|
| 409 | 409 | header('Content-Type: text/xml; charset=utf-8'); |
| 410 | - header('Date: ' . date('r', $GLOBALS['EXEC_TIME'])); |
|
| 411 | - header('Expires: ' . date('r', $GLOBALS['EXEC_TIME'] + $this->conf['expired'])); |
|
| 410 | + header('Date: '.date('r', $GLOBALS['EXEC_TIME'])); |
|
| 411 | + header('Expires: '.date('r', $GLOBALS['EXEC_TIME'] + $this->conf['expired'])); |
|
| 412 | 412 | echo $content; |
| 413 | 413 | exit; |
| 414 | 414 | } |
@@ -469,16 +469,16 @@ discard block |
||
| 469 | 469 | |
| 470 | 470 | $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('tx_dlf_documents'); |
| 471 | 471 | |
| 472 | - $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` ' . |
|
| 473 | - 'FROM `tx_dlf_documents` ' . |
|
| 474 | - 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` ' . |
|
| 475 | - 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` ' . |
|
| 476 | - 'WHERE `tx_dlf_documents`.`record_id` = ? ' . |
|
| 477 | - 'AND `tx_dlf_documents`.`pid` = ? ' . |
|
| 478 | - 'AND `tx_dlf_collections`.`pid` = ? ' . |
|
| 479 | - 'AND `tx_dlf_relations`.`ident`="docs_colls" ' . |
|
| 480 | - $where . |
|
| 481 | - 'AND ' . Helper::whereExpression('tx_dlf_collections'); |
|
| 472 | + $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` '. |
|
| 473 | + 'FROM `tx_dlf_documents` '. |
|
| 474 | + 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` '. |
|
| 475 | + 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` '. |
|
| 476 | + 'WHERE `tx_dlf_documents`.`record_id` = ? '. |
|
| 477 | + 'AND `tx_dlf_documents`.`pid` = ? '. |
|
| 478 | + 'AND `tx_dlf_collections`.`pid` = ? '. |
|
| 479 | + 'AND `tx_dlf_relations`.`ident`="docs_colls" '. |
|
| 480 | + $where. |
|
| 481 | + 'AND '.Helper::whereExpression('tx_dlf_collections'); |
|
| 482 | 482 | |
| 483 | 483 | $values = [ |
| 484 | 484 | $this->piVars['identifier'], |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | $timestamp = $resArray['tstamp']; |
| 606 | 606 | $earliestDatestamp = gmdate('Y-m-d\TH:i:s\Z', $timestamp); |
| 607 | 607 | } else { |
| 608 | - $this->logger->notice('No records found with PID ' . $this->conf['pages']); |
|
| 608 | + $this->logger->notice('No records found with PID '.$this->conf['pages']); |
|
| 609 | 609 | } |
| 610 | 610 | $linkConf = [ |
| 611 | 611 | 'parameter' => $GLOBALS['TSFE']->id, |
@@ -866,9 +866,9 @@ discard block |
||
| 866 | 866 | } |
| 867 | 867 | $resArray = $allResults[0]; |
| 868 | 868 | if ($resArray['index_query'] != "") { |
| 869 | - $solr_query .= '(' . $resArray['index_query'] . ')'; |
|
| 869 | + $solr_query .= '('.$resArray['index_query'].')'; |
|
| 870 | 870 | } else { |
| 871 | - $solr_query .= 'collection:' . '"' . $resArray['index_name'] . '"'; |
|
| 871 | + $solr_query .= 'collection:'.'"'.$resArray['index_name'].'"'; |
|
| 872 | 872 | } |
| 873 | 873 | } else { |
| 874 | 874 | // If no set is specified we have to query for all collections |
@@ -876,7 +876,7 @@ discard block |
||
| 876 | 876 | } |
| 877 | 877 | // Check for required fields. |
| 878 | 878 | foreach ($this->formats[$this->piVars['metadataPrefix']]['requiredFields'] as $required) { |
| 879 | - $solr_query .= ' NOT ' . $required . ':""'; |
|
| 879 | + $solr_query .= ' NOT '.$required.':""'; |
|
| 880 | 880 | } |
| 881 | 881 | // toplevel="true" is always required |
| 882 | 882 | $solr_query .= ' AND toplevel:true'; |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | || is_array($date_array = strptime($this->piVars['from'], '%Y-%m-%d')) |
| 890 | 890 | ) { |
| 891 | 891 | $timestamp = gmmktime($date_array['tm_hour'], $date_array['tm_min'], $date_array['tm_sec'], $date_array['tm_mon'] + 1, $date_array['tm_mday'], $date_array['tm_year'] + 1900); |
| 892 | - $from = date("Y-m-d", $timestamp) . 'T' . date("H:i:s", $timestamp) . '.000Z'; |
|
| 892 | + $from = date("Y-m-d", $timestamp).'T'.date("H:i:s", $timestamp).'.000Z'; |
|
| 893 | 893 | } else { |
| 894 | 894 | throw new \Exception('badArgument'); |
| 895 | 895 | } |
@@ -903,7 +903,7 @@ discard block |
||
| 903 | 903 | || is_array($date_array = strptime($this->piVars['until'], '%Y-%m-%d')) |
| 904 | 904 | ) { |
| 905 | 905 | $timestamp = gmmktime($date_array['tm_hour'], $date_array['tm_min'], $date_array['tm_sec'], $date_array['tm_mon'] + 1, $date_array['tm_mday'], $date_array['tm_year'] + 1900); |
| 906 | - $until = date("Y-m-d", $timestamp) . 'T' . date("H:i:s", $timestamp) . '.999Z'; |
|
| 906 | + $until = date("Y-m-d", $timestamp).'T'.date("H:i:s", $timestamp).'.999Z'; |
|
| 907 | 907 | if ($from != "*" && $from > $until) { |
| 908 | 908 | throw new \Exception('badArgument'); |
| 909 | 909 | } |
@@ -920,7 +920,7 @@ discard block |
||
| 920 | 920 | throw new \Exception('badArgument'); |
| 921 | 921 | } |
| 922 | 922 | } |
| 923 | - $solr_query .= ' AND timestamp:[' . $from . ' TO ' . $until . ']'; |
|
| 923 | + $solr_query .= ' AND timestamp:['.$from.' TO '.$until.']'; |
|
| 924 | 924 | $documentSet = []; |
| 925 | 925 | $solr = Solr::getInstance($this->conf['solrcore']); |
| 926 | 926 | if (!$solr->ready) { |
@@ -957,22 +957,22 @@ discard block |
||
| 957 | 957 | */ |
| 958 | 958 | protected function generateOutputForDocumentList(DocumentList $documentListSet) |
| 959 | 959 | { |
| 960 | - $documentsToProcess = $documentListSet->removeRange(0, (int)$this->conf['limit']); |
|
| 960 | + $documentsToProcess = $documentListSet->removeRange(0, (int) $this->conf['limit']); |
|
| 961 | 961 | $verb = $this->piVars['verb']; |
| 962 | 962 | |
| 963 | 963 | $connection = GeneralUtility::makeInstance(ConnectionPool::class) |
| 964 | 964 | ->getConnectionForTable('tx_dlf_documents'); |
| 965 | 965 | |
| 966 | - $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` ' . |
|
| 967 | - 'FROM `tx_dlf_documents` ' . |
|
| 968 | - 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` ' . |
|
| 969 | - 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` ' . |
|
| 970 | - 'WHERE `tx_dlf_documents`.`uid` IN ( ? ) ' . |
|
| 971 | - 'AND `tx_dlf_documents`.`pid` = ? ' . |
|
| 972 | - 'AND `tx_dlf_collections`.`pid` = ? ' . |
|
| 973 | - 'AND `tx_dlf_relations`.`ident`="docs_colls" ' . |
|
| 974 | - 'AND ' . Helper::whereExpression('tx_dlf_collections') . ' ' . |
|
| 975 | - 'GROUP BY `tx_dlf_documents`.`uid` ' . |
|
| 966 | + $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` '. |
|
| 967 | + 'FROM `tx_dlf_documents` '. |
|
| 968 | + 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` '. |
|
| 969 | + 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` '. |
|
| 970 | + 'WHERE `tx_dlf_documents`.`uid` IN ( ? ) '. |
|
| 971 | + 'AND `tx_dlf_documents`.`pid` = ? '. |
|
| 972 | + 'AND `tx_dlf_collections`.`pid` = ? '. |
|
| 973 | + 'AND `tx_dlf_relations`.`ident`="docs_colls" '. |
|
| 974 | + 'AND '.Helper::whereExpression('tx_dlf_collections').' '. |
|
| 975 | + 'GROUP BY `tx_dlf_documents`.`uid` '. |
|
| 976 | 976 | 'LIMIT ?'; |
| 977 | 977 | |
| 978 | 978 | $values = [ |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * @var bool |
| 38 | 38 | * @access protected |
| 39 | 39 | */ |
| 40 | - protected $error = false; |
|
| 40 | + protected $error = FALSE; |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * This holds the OAI DOM object |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | protected function error($type) |
| 110 | 110 | { |
| 111 | - $this->error = true; |
|
| 111 | + $this->error = TRUE; |
|
| 112 | 112 | $error = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'error', htmlspecialchars($this->pi_getLL($type, $type), ENT_NOQUOTES, 'UTF-8')); |
| 113 | 113 | $error->setAttribute('code', $type); |
| 114 | 114 | return $error; |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | */ |
| 298 | 298 | protected function getMetsData(array $metadata) |
| 299 | 299 | { |
| 300 | - $mets = null; |
|
| 300 | + $mets = NULL; |
|
| 301 | 301 | // Load METS file. |
| 302 | 302 | $xml = new \DOMDocument(); |
| 303 | 303 | if ($xml->load($metadata['location'])) { |
@@ -305,14 +305,14 @@ discard block |
||
| 305 | 305 | $root = $xml->getElementsByTagNameNS($this->formats['mets']['namespace'], 'mets'); |
| 306 | 306 | if ($root->item(0) instanceof \DOMNode) { |
| 307 | 307 | // Import node into \DOMDocument. |
| 308 | - $mets = $this->oai->importNode($root->item(0), true); |
|
| 308 | + $mets = $this->oai->importNode($root->item(0), TRUE); |
|
| 309 | 309 | } else { |
| 310 | 310 | $this->logger->error('No METS part found in document with location "' . $metadata['location'] . '"'); |
| 311 | 311 | } |
| 312 | 312 | } else { |
| 313 | 313 | $this->logger->error('Could not load XML file from "' . $metadata['location'] . '"'); |
| 314 | 314 | } |
| 315 | - if ($mets === null) { |
|
| 315 | + if ($mets === NULL) { |
|
| 316 | 316 | $mets = $this->oai->createElementNS('http://kitodo.org/', 'kitodo:error', htmlspecialchars($this->pi_getLL('error', 'Error!'), ENT_NOQUOTES, 'UTF-8')); |
| 317 | 317 | } |
| 318 | 318 | return $mets; |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | // Initialize plugin. |
| 334 | 334 | $this->init($conf); |
| 335 | 335 | // Turn cache off. |
| 336 | - $this->setCache(false); |
|
| 336 | + $this->setCache(FALSE); |
|
| 337 | 337 | // Get GET and POST variables. |
| 338 | 338 | $this->getUrlParams(); |
| 339 | 339 | // Delete expired resumption tokens. |
@@ -1062,7 +1062,7 @@ discard block |
||
| 1062 | 1062 | protected function generateResumptionTokenForDocumentListSet(DocumentList $documentListSet) |
| 1063 | 1063 | { |
| 1064 | 1064 | if ($documentListSet->count() !== 0) { |
| 1065 | - $token = uniqid('', false); |
|
| 1065 | + $token = uniqid('', FALSE); |
|
| 1066 | 1066 | |
| 1067 | 1067 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_dlf_tokens'); |
| 1068 | 1068 | $affectedRows = $queryBuilder |
@@ -24,8 +24,8 @@ |
||
| 24 | 24 | 'suggests' => [] |
| 25 | 25 | ], |
| 26 | 26 | 'state' => 'stable', |
| 27 | - 'uploadfolder' => false, |
|
| 28 | - 'clearCacheOnLoad' => false, |
|
| 27 | + 'uploadfolder' => FALSE, |
|
| 28 | + 'clearCacheOnLoad' => FALSE, |
|
| 29 | 29 | 'author' => 'Sebastian Meyer (Maintainer)', |
| 30 | 30 | 'author_email' => '[email protected]', |
| 31 | 31 | 'author_company' => 'Kitodo. Key to digital objects e. V.', |
@@ -23,10 +23,8 @@ |
||
| 23 | 23 | * @subpackage dlf |
| 24 | 24 | * @access public |
| 25 | 25 | */ |
| 26 | -class DocumentTypeProvider extends AbstractProvider |
|
| 27 | -{ |
|
| 28 | - public function __construct() |
|
| 29 | - { |
|
| 26 | +class DocumentTypeProvider extends AbstractProvider { |
|
| 27 | + public function __construct() { |
|
| 30 | 28 | $this->expressionLanguageProviders = [ |
| 31 | 29 | DocumentTypeFunctionProvider::class |
| 32 | 30 | ]; |
@@ -205,21 +205,21 @@ |
||
| 205 | 205 | ); |
| 206 | 206 | // Register tools for toolbox plugin. |
| 207 | 207 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'] = []; |
| 208 | -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_fulltexttool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.fulltexttool'; |
|
| 209 | -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_annotationtool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.annotationtool'; |
|
| 210 | -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_fulltextdownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.fulltextdownloadtool'; |
|
| 211 | -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_imagedownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.imagedownloadtool'; |
|
| 212 | -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_imagemanipulationtool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.imagemanipulationtool'; |
|
| 213 | -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_pdfdownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.pdfdownloadtool'; |
|
| 214 | -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_searchindocumenttool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.searchindocumenttool'; |
|
| 208 | +$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_fulltexttool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.fulltexttool'; |
|
| 209 | +$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_annotationtool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.annotationtool'; |
|
| 210 | +$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_fulltextdownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.fulltextdownloadtool'; |
|
| 211 | +$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_imagedownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.imagedownloadtool'; |
|
| 212 | +$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_imagemanipulationtool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.imagemanipulationtool'; |
|
| 213 | +$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_pdfdownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.pdfdownloadtool'; |
|
| 214 | +$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_searchindocumenttool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.searchindocumenttool'; |
|
| 215 | 215 | // Register hooks. |
| 216 | 216 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = \Kitodo\Dlf\Hooks\DataHandler::class; |
| 217 | 217 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'][] = \Kitodo\Dlf\Hooks\DataHandler::class; |
| 218 | 218 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Common/MetsDocument.php']['hookClass'][] = \Kitodo\Dlf\Hooks\KitodoProductionHacks::class; |
| 219 | 219 | // Register AJAX eID handlers. |
| 220 | -$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_search_suggest'] = \Kitodo\Dlf\Plugin\Eid\SearchSuggest::class . '::main'; |
|
| 221 | -$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_search_in_document'] = \Kitodo\Dlf\Plugin\Eid\SearchInDocument::class . '::main'; |
|
| 222 | -$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_pageview_proxy'] = \Kitodo\Dlf\Plugin\Eid\PageViewProxy::class . '::main'; |
|
| 220 | +$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_search_suggest'] = \Kitodo\Dlf\Plugin\Eid\SearchSuggest::class.'::main'; |
|
| 221 | +$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_search_in_document'] = \Kitodo\Dlf\Plugin\Eid\SearchInDocument::class.'::main'; |
|
| 222 | +$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_pageview_proxy'] = \Kitodo\Dlf\Plugin\Eid\PageViewProxy::class.'::main'; |
|
| 223 | 223 | // Use Caching Framework for Solr queries |
| 224 | 224 | if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_dlf_solr'])) { |
| 225 | 225 | $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_dlf_solr'] = []; |
@@ -22,8 +22,7 @@ discard block |
||
| 22 | 22 | * @subpackage dlf |
| 23 | 23 | * @access public |
| 24 | 24 | */ |
| 25 | -class FulltextDownloadTool extends \Kitodo\Dlf\Common\AbstractPlugin |
|
| 26 | -{ |
|
| 25 | +class FulltextDownloadTool extends \Kitodo\Dlf\Common\AbstractPlugin { |
|
| 27 | 26 | public $scriptRelPath = 'Classes/Plugin/Tools/FulltextDownloadTool.php'; |
| 28 | 27 | |
| 29 | 28 | /** |
@@ -36,8 +35,7 @@ discard block |
||
| 36 | 35 | * |
| 37 | 36 | * @return string The content that is displayed on the website |
| 38 | 37 | */ |
| 39 | - public function main($content, $conf) |
|
| 40 | - { |
|
| 38 | + public function main($content, $conf) { |
|
| 41 | 39 | $this->init($conf); |
| 42 | 40 | // Merge configuration with conf array of toolbox. |
| 43 | 41 | if (!empty($this->cObj->data['conf'])) { |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | // Load current document. |
| 48 | 48 | $this->loadDocument(); |
| 49 | 49 | if ( |
| 50 | - $this->doc === null |
|
| 50 | + $this->doc === NULL |
|
| 51 | 51 | || $this->doc->numPages < 1 |
| 52 | 52 | || empty($this->conf['fileGrpFulltext']) |
| 53 | 53 | ) { |
@@ -83,9 +83,9 @@ |
||
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | if (!empty($fullTextFile)) { |
| 86 | - $markerArray['###FULLTEXT_DOWNLOAD###'] = '<a href="#" id="tx-dlf-tools-fulltextdownload" title="' . htmlspecialchars($this->pi_getLL('download-current-page', '')) . '">' . htmlspecialchars($this->pi_getLL('download-current-page', '')) . '</a>'; |
|
| 86 | + $markerArray['###FULLTEXT_DOWNLOAD###'] = '<a href="#" id="tx-dlf-tools-fulltextdownload" title="'.htmlspecialchars($this->pi_getLL('download-current-page', '')).'">'.htmlspecialchars($this->pi_getLL('download-current-page', '')).'</a>'; |
|
| 87 | 87 | } else { |
| 88 | - $markerArray['###FULLTEXT_DOWNLOAD###'] = '<span class="no-fulltext">' . htmlspecialchars($this->pi_getLL('fulltext-not-available', '')) . '</span>'; |
|
| 88 | + $markerArray['###FULLTEXT_DOWNLOAD###'] = '<span class="no-fulltext">'.htmlspecialchars($this->pi_getLL('fulltext-not-available', '')).'</span>'; |
|
| 89 | 89 | } |
| 90 | 90 | $content .= $this->templateService->substituteMarkerArray($this->template, $markerArray); |
| 91 | 91 | return $this->pi_wrapInBaseClass($content); |
@@ -384,9 +384,9 @@ |
||
| 384 | 384 | $query = $solr->service->createCoreAdmin(); |
| 385 | 385 | $action = $query->createUnload(); |
| 386 | 386 | $action->setCore($resArray['core']); |
| 387 | - $action->setDeleteDataDir(true); |
|
| 388 | - $action->setDeleteIndex(true); |
|
| 389 | - $action->setDeleteInstanceDir(true); |
|
| 387 | + $action->setDeleteDataDir(TRUE); |
|
| 388 | + $action->setDeleteIndex(TRUE); |
|
| 389 | + $action->setDeleteInstanceDir(TRUE); |
|
| 390 | 390 | $query->setAction($action); |
| 391 | 391 | try { |
| 392 | 392 | $response = $solr->service->coreAdmin($query); |
@@ -123,10 +123,10 @@ discard block |
||
| 123 | 123 | ) { |
| 124 | 124 | // Get current configuration. |
| 125 | 125 | $result = $queryBuilder |
| 126 | - ->select($table . '.is_listed AS is_listed') |
|
| 126 | + ->select($table.'.is_listed AS is_listed') |
|
| 127 | 127 | ->from($table) |
| 128 | 128 | ->where( |
| 129 | - $queryBuilder->expr()->eq($table . '.uid', intval($id)), |
|
| 129 | + $queryBuilder->expr()->eq($table.'.uid', intval($id)), |
|
| 130 | 130 | Helper::whereExpression($table) |
| 131 | 131 | ) |
| 132 | 132 | ->setMaxResults(1) |
@@ -148,10 +148,10 @@ discard block |
||
| 148 | 148 | ) { |
| 149 | 149 | // Get current configuration. |
| 150 | 150 | $result = $queryBuilder |
| 151 | - ->select($table . '.index_autocomplete AS index_autocomplete') |
|
| 151 | + ->select($table.'.index_autocomplete AS index_autocomplete') |
|
| 152 | 152 | ->from($table) |
| 153 | 153 | ->where( |
| 154 | - $queryBuilder->expr()->eq($table . '.uid', intval($id)), |
|
| 154 | + $queryBuilder->expr()->eq($table.'.uid', intval($id)), |
|
| 155 | 155 | Helper::whereExpression($table) |
| 156 | 156 | ) |
| 157 | 157 | ->setMaxResults(1) |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | if ($solr->ready) { |
| 230 | 230 | // Delete Solr document. |
| 231 | 231 | $updateQuery = $solr->service->createUpdate(); |
| 232 | - $updateQuery->addDeleteQuery('uid:' . $id); |
|
| 232 | + $updateQuery->addDeleteQuery('uid:'.$id); |
|
| 233 | 233 | $updateQuery->addCommit(); |
| 234 | 234 | $solr->service->update($updateQuery); |
| 235 | 235 | } |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | if ($doc->ready) { |
| 240 | 240 | Indexer::add($doc, $resArray['core']); |
| 241 | 241 | } else { |
| 242 | - $this->logger->error('Failed to re-index document with UID ' . $id); |
|
| 242 | + $this->logger->error('Failed to re-index document with UID '.$id); |
|
| 243 | 243 | } |
| 244 | 244 | } |
| 245 | 245 | } |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | if ($solr->ready) { |
| 310 | 310 | // Delete Solr document. |
| 311 | 311 | $updateQuery = $solr->service->createUpdate(); |
| 312 | - $updateQuery->addDeleteQuery('uid:' . $id); |
|
| 312 | + $updateQuery->addDeleteQuery('uid:'.$id); |
|
| 313 | 313 | $updateQuery->addCommit(); |
| 314 | 314 | $solr->service->update($updateQuery); |
| 315 | 315 | if ($command == 'delete') { |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | if ($doc->ready) { |
| 323 | 323 | Indexer::add($doc, $resArray['core']); |
| 324 | 324 | } else { |
| 325 | - $this->logger->error('Failed to re-index document with UID ' . $id); |
|
| 325 | + $this->logger->error('Failed to re-index document with UID '.$id); |
|
| 326 | 326 | } |
| 327 | 327 | break; |
| 328 | 328 | } |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | // Nothing to do here. |
| 377 | 377 | } |
| 378 | 378 | } |
| 379 | - $this->logger->warning('Core ' . $resArray['core'] . ' could not be deleted from Apache Solr'); |
|
| 379 | + $this->logger->warning('Core '.$resArray['core'].' could not be deleted from Apache Solr'); |
|
| 380 | 380 | } |
| 381 | 381 | } |
| 382 | 382 | } |
@@ -31,8 +31,7 @@ discard block |
||
| 31 | 31 | * @subpackage dlf |
| 32 | 32 | * @access public |
| 33 | 33 | */ |
| 34 | -class DataHandler implements LoggerAwareInterface |
|
| 35 | -{ |
|
| 34 | +class DataHandler implements LoggerAwareInterface { |
|
| 36 | 35 | use LoggerAwareTrait; |
| 37 | 36 | |
| 38 | 37 | /** |
@@ -47,8 +46,7 @@ discard block |
||
| 47 | 46 | * |
| 48 | 47 | * @return void |
| 49 | 48 | */ |
| 50 | - public function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray) |
|
| 51 | - { |
|
| 49 | + public function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray) { |
|
| 52 | 50 | if ($status == 'new') { |
| 53 | 51 | switch ($table) { |
| 54 | 52 | // Field post-processing for table "tx_dlf_documents". |
@@ -179,8 +177,7 @@ discard block |
||
| 179 | 177 | * |
| 180 | 178 | * @return void |
| 181 | 179 | */ |
| 182 | - public function processDatamap_afterDatabaseOperations($status, $table, $id, &$fieldArray) |
|
| 183 | - { |
|
| 180 | + public function processDatamap_afterDatabaseOperations($status, $table, $id, &$fieldArray) { |
|
| 184 | 181 | if ($status == 'update') { |
| 185 | 182 | switch ($table) { |
| 186 | 183 | // After database operations for table "tx_dlf_documents". |
@@ -260,8 +257,7 @@ discard block |
||
| 260 | 257 | * |
| 261 | 258 | * @return void |
| 262 | 259 | */ |
| 263 | - public function processCmdmap_postProcess($command, $table, $id) |
|
| 264 | - { |
|
| 260 | + public function processCmdmap_postProcess($command, $table, $id) { |
|
| 265 | 261 | if ( |
| 266 | 262 | in_array($command, ['move', 'delete', 'undelete']) |
| 267 | 263 | && $table == 'tx_dlf_documents' |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | if ($solr->ready) { |
| 56 | 56 | $query = $solr->service->createSelect(); |
| 57 | 57 | $query->setFields(['id', 'uid', 'page']); |
| 58 | - $query->setQuery('fulltext:(' . Solr::escapeQuery((string) $parameters['q']) . ') AND uid:' . intval($parameters['uid'])); |
|
| 58 | + $query->setQuery('fulltext:('.Solr::escapeQuery((string) $parameters['q']).') AND uid:'.intval($parameters['uid'])); |
|
| 59 | 59 | $query->setStart($count)->setRows(20); |
| 60 | 60 | $hl = $query->getHighlighting(); |
| 61 | 61 | $hl->setFields(['fulltext']); |
@@ -27,16 +27,14 @@ |
||
| 27 | 27 | * @subpackage dlf |
| 28 | 28 | * @access public |
| 29 | 29 | */ |
| 30 | -class SearchInDocument |
|
| 31 | -{ |
|
| 30 | +class SearchInDocument { |
|
| 32 | 31 | /** |
| 33 | 32 | * The main method of the eID script |
| 34 | 33 | * |
| 35 | 34 | * @param ServerRequestInterface $request |
| 36 | 35 | * @return ResponseInterface JSON response of search suggestions |
| 37 | 36 | */ |
| 38 | - public function main(ServerRequestInterface $request) |
|
| 39 | - { |
|
| 37 | + public function main(ServerRequestInterface $request) { |
|
| 40 | 38 | $output = [ |
| 41 | 39 | 'documents' => [], |
| 42 | 40 | 'numFound' => 0 |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | $query->setStart($count)->setRows(20); |
| 60 | 60 | $hl = $query->getHighlighting(); |
| 61 | 61 | $hl->setFields(['fulltext']); |
| 62 | - $hl->setUseFastVectorHighlighter(true); |
|
| 62 | + $hl->setUseFastVectorHighlighter(TRUE); |
|
| 63 | 63 | $results = $solr->service->select($query); |
| 64 | 64 | $output['numFound'] = $results->getNumFound(); |
| 65 | 65 | $highlighting = $results->getHighlighting(); |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | 'max' => 255, |
| 50 | 50 | 'eval' => 'alphanum,nospace,required,unique', |
| 51 | 51 | 'default' => '', |
| 52 | - 'readOnly' => true, |
|
| 52 | + 'readOnly' => TRUE, |
|
| 53 | 53 | 'fieldInformation' => [ |
| 54 | 54 | 'solrCoreStatus' => [ |
| 55 | 55 | 'renderType' => 'solrCoreStatus', |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | $uptimeInSeconds = floor($response->getUptime() / 1000); |
| 56 | 56 | $dateTimeFrom = new \DateTime('@0'); |
| 57 | 57 | $dateTimeTo = new \DateTime("@$uptimeInSeconds"); |
| 58 | - $uptime = $dateTimeFrom->diff($dateTimeTo)->format('%a ' . $GLOBALS['LANG']->getLL('flash.days') . ', %H:%I:%S'); |
|
| 58 | + $uptime = $dateTimeFrom->diff($dateTimeTo)->format('%a '.$GLOBALS['LANG']->getLL('flash.days').', %H:%I:%S'); |
|
| 59 | 59 | $numDocuments = $response->getNumberOfDocuments(); |
| 60 | 60 | $startTime = $response->getStartTime() ? strftime('%c', $response->getStartTime()->getTimestamp()) : 'N/A'; |
| 61 | 61 | $lastModified = $response->getLastModified() ? strftime('%c', $response->getLastModified()->getTimestamp()) : 'N/A'; |
@@ -24,8 +24,7 @@ |
||
| 24 | 24 | * @subpackage dlf |
| 25 | 25 | * @access public |
| 26 | 26 | */ |
| 27 | -class SolrCoreStatus extends AbstractNode |
|
| 28 | -{ |
|
| 27 | +class SolrCoreStatus extends AbstractNode { |
|
| 29 | 28 | /** |
| 30 | 29 | * Shows Solr core status for given 'index_name' |
| 31 | 30 | * |