@@ -27,8 +27,7 @@ discard block |
||
| 27 | 27 | * @subpackage dlf |
| 28 | 28 | * @access public |
| 29 | 29 | */ |
| 30 | -class ConfigurationForm |
|
| 31 | -{ |
|
| 30 | +class ConfigurationForm { |
|
| 32 | 31 | /** |
| 33 | 32 | * This holds the current configuration |
| 34 | 33 | * |
@@ -44,8 +43,7 @@ discard block |
||
| 44 | 43 | * |
| 45 | 44 | * @return string Message informing the user of success or failure |
| 46 | 45 | */ |
| 47 | - public function checkSolrConnection() |
|
| 48 | - { |
|
| 46 | + public function checkSolrConnection() { |
|
| 49 | 47 | $solr = Solr::getInstance(); |
| 50 | 48 | if ($solr->ready) { |
| 51 | 49 | Helper::addMessage( |
@@ -70,8 +68,7 @@ discard block |
||
| 70 | 68 | * |
| 71 | 69 | * @return string Message informing the user of success or failure |
| 72 | 70 | */ |
| 73 | - public function checkMetadataFormats() |
|
| 74 | - { |
|
| 71 | + public function checkMetadataFormats() { |
|
| 75 | 72 | // We need to do some bootstrapping manually as of TYPO3 9. |
| 76 | 73 | if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version(), '9.0.0', '>=')) { |
| 77 | 74 | // Load table configuration array into $GLOBALS['TCA']. |
@@ -202,8 +199,7 @@ discard block |
||
| 202 | 199 | * |
| 203 | 200 | * @return void |
| 204 | 201 | */ |
| 205 | - public function __construct() |
|
| 206 | - { |
|
| 202 | + public function __construct() { |
|
| 207 | 203 | // Load localization file. |
| 208 | 204 | $GLOBALS['LANG']->includeLLFile('EXT:dlf/Resources/Private/Language/FlashMessages.xml'); |
| 209 | 205 | // Get current configuration. |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | // We need to do some bootstrapping manually as of TYPO3 9. |
| 76 | 76 | if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version(), '9.0.0', '>=')) { |
| 77 | 77 | // Load table configuration array into $GLOBALS['TCA']. |
| 78 | - ExtensionManagementUtility::loadBaseTca(false); |
|
| 78 | + ExtensionManagementUtility::loadBaseTca(FALSE); |
|
| 79 | 79 | // Get extension configuration from dlf/ext_localconf.php. |
| 80 | - ExtensionManagementUtility::loadExtLocalconf(false); |
|
| 80 | + ExtensionManagementUtility::loadExtLocalconf(FALSE); |
|
| 81 | 81 | // Initialize backend user into $GLOBALS['BE_USER']. |
| 82 | 82 | Bootstrap::initializeBackendUser(); |
| 83 | 83 | // Initialize backend and ensure authenticated access. |
@@ -85,12 +85,12 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | $nsDefined = [ |
| 88 | - 'MODS' => false, |
|
| 89 | - 'TEIHDR' => false, |
|
| 90 | - 'ALTO' => false, |
|
| 91 | - 'IIIF1' => false, |
|
| 92 | - 'IIIF2' => false, |
|
| 93 | - 'IIIF3' => false |
|
| 88 | + 'MODS' => FALSE, |
|
| 89 | + 'TEIHDR' => FALSE, |
|
| 90 | + 'ALTO' => FALSE, |
|
| 91 | + 'IIIF1' => FALSE, |
|
| 92 | + 'IIIF2' => FALSE, |
|
| 93 | + 'IIIF3' => FALSE |
|
| 94 | 94 | ]; |
| 95 | 95 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
| 96 | 96 | ->getQueryBuilderForTable('tx_dlf_formats'); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | ->execute(); |
| 106 | 106 | |
| 107 | 107 | while ($resArray = $result->fetch()) { |
| 108 | - $nsDefined[$resArray['type']] = true; |
|
| 108 | + $nsDefined[$resArray['type']] = TRUE; |
|
| 109 | 109 | } |
| 110 | 110 | // Build data array. |
| 111 | 111 | $data = []; |
@@ -118,10 +118,10 @@ discard block |
||
| 118 | 118 | ) { |
| 119 | 119 | // Get current configuration. |
| 120 | 120 | $result = $queryBuilder |
| 121 | - ->select($table . '.is_listed AS is_listed') |
|
| 121 | + ->select($table.'.is_listed AS is_listed') |
|
| 122 | 122 | ->from($table) |
| 123 | 123 | ->where( |
| 124 | - $queryBuilder->expr()->eq($table . '.uid', intval($id)), |
|
| 124 | + $queryBuilder->expr()->eq($table.'.uid', intval($id)), |
|
| 125 | 125 | Helper::whereExpression($table) |
| 126 | 126 | ) |
| 127 | 127 | ->setMaxResults(1) |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | ) { |
| 144 | 144 | // Get current configuration. |
| 145 | 145 | $result = $queryBuilder |
| 146 | - ->select($table . '.index_autocomplete AS index_autocomplete') |
|
| 146 | + ->select($table.'.index_autocomplete AS index_autocomplete') |
|
| 147 | 147 | ->from($table) |
| 148 | 148 | ->where( |
| 149 | - $queryBuilder->expr()->eq($table . '.uid', intval($id)), |
|
| 149 | + $queryBuilder->expr()->eq($table.'.uid', intval($id)), |
|
| 150 | 150 | Helper::whereExpression($table) |
| 151 | 151 | ) |
| 152 | 152 | ->setMaxResults(1) |
@@ -167,10 +167,10 @@ discard block |
||
| 167 | 167 | } else { |
| 168 | 168 | // Get current index name. |
| 169 | 169 | $result = $queryBuilder |
| 170 | - ->select($table . '.index_autocomplete AS index_autocomplete') |
|
| 170 | + ->select($table.'.index_autocomplete AS index_autocomplete') |
|
| 171 | 171 | ->from($table) |
| 172 | 172 | ->where( |
| 173 | - $queryBuilder->expr()->eq($table . '.uid', intval($id)), |
|
| 173 | + $queryBuilder->expr()->eq($table.'.uid', intval($id)), |
|
| 174 | 174 | Helper::whereExpression($table) |
| 175 | 175 | ) |
| 176 | 176 | ->setMaxResults(1) |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | $fieldArray['index_indexed'] = $resArray['index_autocomplete']; |
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | - Helper::devLog('Prevented change of index_name for UID ' . $id . ' in table "' . $table . '"', DEVLOG_SEVERITY_NOTICE); |
|
| 184 | + Helper::devLog('Prevented change of index_name for UID '.$id.' in table "'.$table.'"', DEVLOG_SEVERITY_NOTICE); |
|
| 185 | 185 | } |
| 186 | 186 | break; |
| 187 | 187 | } |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | if ($solr->ready) { |
| 251 | 251 | // Delete Solr document. |
| 252 | 252 | $updateQuery = $solr->service->createUpdate(); |
| 253 | - $updateQuery->addDeleteQuery('uid:' . $id); |
|
| 253 | + $updateQuery->addDeleteQuery('uid:'.$id); |
|
| 254 | 254 | $updateQuery->addCommit(); |
| 255 | 255 | $solr->service->update($updateQuery); |
| 256 | 256 | } |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | if ($doc->ready) { |
| 261 | 261 | Indexer::add($doc, $resArray['core']); |
| 262 | 262 | } else { |
| 263 | - Helper::devLog('Failed to re-index document with UID ' . $id, DEVLOG_SEVERITY_ERROR); |
|
| 263 | + Helper::devLog('Failed to re-index document with UID '.$id, DEVLOG_SEVERITY_ERROR); |
|
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | } |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | if ($solr->ready) { |
| 331 | 331 | // Delete Solr document. |
| 332 | 332 | $updateQuery = $solr->service->createUpdate(); |
| 333 | - $updateQuery->addDeleteQuery('uid:' . $id); |
|
| 333 | + $updateQuery->addDeleteQuery('uid:'.$id); |
|
| 334 | 334 | $updateQuery->addCommit(); |
| 335 | 335 | $solr->service->update($updateQuery); |
| 336 | 336 | if ($command == 'delete') { |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | if ($doc->ready) { |
| 344 | 344 | Indexer::add($doc, $resArray['core']); |
| 345 | 345 | } else { |
| 346 | - Helper::devLog('Failed to re-index document with UID ' . $id, DEVLOG_SEVERITY_ERROR); |
|
| 346 | + Helper::devLog('Failed to re-index document with UID '.$id, DEVLOG_SEVERITY_ERROR); |
|
| 347 | 347 | } |
| 348 | 348 | break; |
| 349 | 349 | } |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | // Nothing to do here. |
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | - Helper::devLog('Core ' . $resArray['core'] . ' could not be deleted from Apache Solr', DEVLOG_SEVERITY_WARNING); |
|
| 400 | + Helper::devLog('Core '.$resArray['core'].' could not be deleted from Apache Solr', DEVLOG_SEVERITY_WARNING); |
|
| 401 | 401 | } |
| 402 | 402 | } |
| 403 | 403 | } |
@@ -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); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | { |
| 129 | 129 | // Get next available core name if none given. |
| 130 | 130 | if (empty($core)) { |
| 131 | - $core = 'dlfCore' . self::getNextCoreNumber(); |
|
| 131 | + $core = 'dlfCore'.self::getNextCoreNumber(); |
|
| 132 | 132 | } |
| 133 | 133 | // Get Solr service instance. |
| 134 | 134 | $solr = self::getInstance($core); |
@@ -224,13 +224,13 @@ discard block |
||
| 224 | 224 | ->execute(); |
| 225 | 225 | |
| 226 | 226 | while ($resArray = $result->fetch()) { |
| 227 | - $fields[] = $resArray['index_name'] . '_' . ($resArray['index_tokenized'] ? 't' : 'u') . ($resArray['index_stored'] ? 's' : 'u') . 'i'; |
|
| 227 | + $fields[] = $resArray['index_name'].'_'.($resArray['index_tokenized'] ? 't' : 'u').($resArray['index_stored'] ? 's' : 'u').'i'; |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | // Check if queried field is valid. |
| 231 | 231 | $splitQuery = explode(':', $query, 2); |
| 232 | 232 | if (in_array($splitQuery[0], $fields)) { |
| 233 | - $query = $splitQuery[0] . ':(' . self::escapeQuery(trim($splitQuery[1], '()')) . ')'; |
|
| 233 | + $query = $splitQuery[0].':('.self::escapeQuery(trim($splitQuery[1], '()')).')'; |
|
| 234 | 234 | } else { |
| 235 | 235 | $query = self::escapeQuery($query); |
| 236 | 236 | } |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | { |
| 295 | 295 | $number = max(intval($number), 0); |
| 296 | 296 | // Check if core already exists. |
| 297 | - $solr = self::getInstance('dlfCore' . $number); |
|
| 297 | + $solr = self::getInstance('dlfCore'.$number); |
|
| 298 | 298 | if (!$solr->ready) { |
| 299 | 299 | return $number; |
| 300 | 300 | } else { |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | $config['path'] .= '/'; |
| 331 | 331 | } |
| 332 | 332 | // Set connection timeout lower than PHP's max_execution_time. |
| 333 | - $max_execution_time = intval(ini_get('max_execution_time')) ?: 30; |
|
| 333 | + $max_execution_time = intval(ini_get('max_execution_time')) ? : 30; |
|
| 334 | 334 | $config['timeout'] = MathUtility::forceIntegerInRange($conf['solrTimeout'], 1, $max_execution_time, 10); |
| 335 | 335 | $this->config = $config; |
| 336 | 336 | } |
@@ -364,13 +364,13 @@ discard block |
||
| 364 | 364 | // Extend filter query to get all documents with the same uids. |
| 365 | 365 | foreach ($params['filterquery'] as $key => $value) { |
| 366 | 366 | if (isset($value['query'])) { |
| 367 | - $params['filterquery'][$key]['query'] = '{!join from=uid to=uid}' . $value['query']; |
|
| 367 | + $params['filterquery'][$key]['query'] = '{!join from=uid to=uid}'.$value['query']; |
|
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | // Set filter query to just get toplevel documents. |
| 371 | 371 | $params['filterquery'][] = ['query' => 'toplevel:true']; |
| 372 | 372 | // Set join query to get all documents with the same uids. |
| 373 | - $params['query'] = '{!join from=uid to=uid}' . $params['query']; |
|
| 373 | + $params['query'] = '{!join from=uid to=uid}'.$params['query']; |
|
| 374 | 374 | // Perform search to determine the total number of toplevel hits and fetch the required rows. |
| 375 | 375 | $selectQuery = $this->service->createSelect($params); |
| 376 | 376 | $results = $this->service->select($selectQuery); |
@@ -560,12 +560,12 @@ discard block |
||
| 560 | 560 | */ |
| 561 | 561 | public function __get($var) |
| 562 | 562 | { |
| 563 | - $method = '_get' . ucfirst($var); |
|
| 563 | + $method = '_get'.ucfirst($var); |
|
| 564 | 564 | if ( |
| 565 | 565 | !property_exists($this, $var) |
| 566 | 566 | || !method_exists($this, $method) |
| 567 | 567 | ) { |
| 568 | - Helper::devLog('There is no getter function for property "' . $var . '"', DEVLOG_SEVERITY_WARNING); |
|
| 568 | + Helper::devLog('There is no getter function for property "'.$var.'"', DEVLOG_SEVERITY_WARNING); |
|
| 569 | 569 | return; |
| 570 | 570 | } else { |
| 571 | 571 | return $this->$method(); |
@@ -598,12 +598,12 @@ discard block |
||
| 598 | 598 | */ |
| 599 | 599 | public function __set($var, $value) |
| 600 | 600 | { |
| 601 | - $method = '_set' . ucfirst($var); |
|
| 601 | + $method = '_set'.ucfirst($var); |
|
| 602 | 602 | if ( |
| 603 | 603 | !property_exists($this, $var) |
| 604 | 604 | || !method_exists($this, $method) |
| 605 | 605 | ) { |
| 606 | - Helper::devLog('There is no setter function for property "' . $var . '"', DEVLOG_SEVERITY_WARNING); |
|
| 606 | + Helper::devLog('There is no setter function for property "'.$var.'"', DEVLOG_SEVERITY_WARNING); |
|
| 607 | 607 | } else { |
| 608 | 608 | $this->$method($value); |
| 609 | 609 | } |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | 'scheme' => $this->config['scheme'], |
| 639 | 639 | 'host' => $this->config['host'], |
| 640 | 640 | 'port' => $this->config['port'], |
| 641 | - 'path' => '/' . $this->config['path'], |
|
| 641 | + 'path' => '/'.$this->config['path'], |
|
| 642 | 642 | 'core' => $core, |
| 643 | 643 | 'username' => $this->config['username'], |
| 644 | 644 | 'password' => $this->config['password'] |
@@ -33,8 +33,7 @@ discard block |
||
| 33 | 33 | * @property-read bool $ready Is the Solr service instantiated successfully? |
| 34 | 34 | * @property-read \Solarium\Client $service This holds the Solr service object |
| 35 | 35 | */ |
| 36 | -class Solr |
|
| 37 | -{ |
|
| 36 | +class Solr { |
|
| 38 | 37 | /** |
| 39 | 38 | * This holds the Solr configuration |
| 40 | 39 | * |
@@ -124,8 +123,7 @@ discard block |
||
| 124 | 123 | * |
| 125 | 124 | * @return string The name of the new core |
| 126 | 125 | */ |
| 127 | - public static function createCore($core = '') |
|
| 128 | - { |
|
| 126 | + public static function createCore($core = '') { |
|
| 129 | 127 | // Get next available core name if none given. |
| 130 | 128 | if (empty($core)) { |
| 131 | 129 | $core = 'dlfCore' . self::getNextCoreNumber(); |
@@ -172,8 +170,7 @@ discard block |
||
| 172 | 170 | * |
| 173 | 171 | * @return string The escaped query string |
| 174 | 172 | */ |
| 175 | - public static function escapeQuery($query) |
|
| 176 | - { |
|
| 173 | + public static function escapeQuery($query) { |
|
| 177 | 174 | $helper = GeneralUtility::makeInstance(\Solarium\Core\Query\Helper::class); |
| 178 | 175 | // Escape query phrase or term. |
| 179 | 176 | if (preg_match('/^".*"$/', $query)) { |
@@ -196,8 +193,7 @@ discard block |
||
| 196 | 193 | * |
| 197 | 194 | * @return string The escaped query string |
| 198 | 195 | */ |
| 199 | - public static function escapeQueryKeepField($query, $pid) |
|
| 200 | - { |
|
| 196 | + public static function escapeQueryKeepField($query, $pid) { |
|
| 201 | 197 | // Is there a field query? |
| 202 | 198 | if (preg_match('/^[[:alnum:]]+_[tu][su]i:\(?.*\)?$/', $query)) { |
| 203 | 199 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
@@ -249,8 +245,7 @@ discard block |
||
| 249 | 245 | * |
| 250 | 246 | * @return \Kitodo\Dlf\Common\Solr Instance of this class |
| 251 | 247 | */ |
| 252 | - public static function getInstance($core = null) |
|
| 253 | - { |
|
| 248 | + public static function getInstance($core = null) { |
|
| 254 | 249 | // Get core name if UID is given. |
| 255 | 250 | if (MathUtility::canBeInterpretedAsInteger($core)) { |
| 256 | 251 | $core = Helper::getIndexNameFromUid($core, 'tx_dlf_solrcores'); |
@@ -290,8 +285,7 @@ discard block |
||
| 290 | 285 | * |
| 291 | 286 | * @return int First unused core number found |
| 292 | 287 | */ |
| 293 | - public static function getNextCoreNumber($number = 0) |
|
| 294 | - { |
|
| 288 | + public static function getNextCoreNumber($number = 0) { |
|
| 295 | 289 | $number = max(intval($number), 0); |
| 296 | 290 | // Check if core already exists. |
| 297 | 291 | $solr = self::getInstance('dlfCore' . $number); |
@@ -309,8 +303,7 @@ discard block |
||
| 309 | 303 | * |
| 310 | 304 | * @return void |
| 311 | 305 | */ |
| 312 | - protected function loadSolrConnectionInfo() |
|
| 313 | - { |
|
| 306 | + protected function loadSolrConnectionInfo() { |
|
| 314 | 307 | if (empty($this->config)) { |
| 315 | 308 | $config = []; |
| 316 | 309 | // Extract extension configuration. |
@@ -343,8 +336,7 @@ discard block |
||
| 343 | 336 | * |
| 344 | 337 | * @return \Kitodo\Dlf\Common\DocumentList The result list |
| 345 | 338 | */ |
| 346 | - public function search() |
|
| 347 | - { |
|
| 339 | + public function search() { |
|
| 348 | 340 | $toplevel = []; |
| 349 | 341 | // Take over query parameters. |
| 350 | 342 | $params = $this->params; |
@@ -419,8 +411,7 @@ discard block |
||
| 419 | 411 | * |
| 420 | 412 | * @return array The Apache Solr Documents that were fetched |
| 421 | 413 | */ |
| 422 | - public function search_raw($query = '', $parameters = []) |
|
| 423 | - { |
|
| 414 | + public function search_raw($query = '', $parameters = []) { |
|
| 424 | 415 | // Set additional query parameters. |
| 425 | 416 | $parameters['start'] = 0; |
| 426 | 417 | $parameters['rows'] = $this->limit; |
@@ -454,8 +445,7 @@ discard block |
||
| 454 | 445 | * |
| 455 | 446 | * @return string|null The core name of the current query endpoint or null if core admin endpoint |
| 456 | 447 | */ |
| 457 | - protected function _getCore() |
|
| 458 | - { |
|
| 448 | + protected function _getCore() { |
|
| 459 | 449 | return $this->core; |
| 460 | 450 | } |
| 461 | 451 | |
@@ -466,8 +456,7 @@ discard block |
||
| 466 | 456 | * |
| 467 | 457 | * @return int The max number of results |
| 468 | 458 | */ |
| 469 | - protected function _getLimit() |
|
| 470 | - { |
|
| 459 | + protected function _getLimit() { |
|
| 471 | 460 | return $this->limit; |
| 472 | 461 | } |
| 473 | 462 | |
@@ -478,8 +467,7 @@ discard block |
||
| 478 | 467 | * |
| 479 | 468 | * @return int Total number of hits for last search |
| 480 | 469 | */ |
| 481 | - protected function _getNumberOfHits() |
|
| 482 | - { |
|
| 470 | + protected function _getNumberOfHits() { |
|
| 483 | 471 | return $this->numberOfHits; |
| 484 | 472 | } |
| 485 | 473 | |
@@ -490,8 +478,7 @@ discard block |
||
| 490 | 478 | * |
| 491 | 479 | * @return bool Is the search instantiated successfully? |
| 492 | 480 | */ |
| 493 | - protected function _getReady() |
|
| 494 | - { |
|
| 481 | + protected function _getReady() { |
|
| 495 | 482 | return $this->ready; |
| 496 | 483 | } |
| 497 | 484 | |
@@ -502,8 +489,7 @@ discard block |
||
| 502 | 489 | * |
| 503 | 490 | * @return \Solarium\Client Apache Solr service object |
| 504 | 491 | */ |
| 505 | - protected function _getService() |
|
| 506 | - { |
|
| 492 | + protected function _getService() { |
|
| 507 | 493 | return $this->service; |
| 508 | 494 | } |
| 509 | 495 | |
@@ -516,8 +502,7 @@ discard block |
||
| 516 | 502 | * |
| 517 | 503 | * @return void |
| 518 | 504 | */ |
| 519 | - protected function _setCPid($value) |
|
| 520 | - { |
|
| 505 | + protected function _setCPid($value) { |
|
| 521 | 506 | $this->cPid = max(intval($value), 0); |
| 522 | 507 | } |
| 523 | 508 | |
@@ -530,8 +515,7 @@ discard block |
||
| 530 | 515 | * |
| 531 | 516 | * @return void |
| 532 | 517 | */ |
| 533 | - protected function _setLimit($value) |
|
| 534 | - { |
|
| 518 | + protected function _setLimit($value) { |
|
| 535 | 519 | $this->limit = max(intval($value), 0); |
| 536 | 520 | } |
| 537 | 521 | |
@@ -544,8 +528,7 @@ discard block |
||
| 544 | 528 | * |
| 545 | 529 | * @return void |
| 546 | 530 | */ |
| 547 | - protected function _setParams(array $value) |
|
| 548 | - { |
|
| 531 | + protected function _setParams(array $value) { |
|
| 549 | 532 | $this->params = $value; |
| 550 | 533 | } |
| 551 | 534 | |
@@ -558,8 +541,7 @@ discard block |
||
| 558 | 541 | * |
| 559 | 542 | * @return mixed Value of $this->$var |
| 560 | 543 | */ |
| 561 | - public function __get($var) |
|
| 562 | - { |
|
| 544 | + public function __get($var) { |
|
| 563 | 545 | $method = '_get' . ucfirst($var); |
| 564 | 546 | if ( |
| 565 | 547 | !property_exists($this, $var) |
@@ -581,8 +563,7 @@ discard block |
||
| 581 | 563 | * |
| 582 | 564 | * @return bool true if variable is set and not empty, false otherwise |
| 583 | 565 | */ |
| 584 | - public function __isset($var) |
|
| 585 | - { |
|
| 566 | + public function __isset($var) { |
|
| 586 | 567 | return !empty($this->__get($var)); |
| 587 | 568 | } |
| 588 | 569 | |
@@ -596,8 +577,7 @@ discard block |
||
| 596 | 577 | * |
| 597 | 578 | * @return void |
| 598 | 579 | */ |
| 599 | - public function __set($var, $value) |
|
| 600 | - { |
|
| 580 | + public function __set($var, $value) { |
|
| 601 | 581 | $method = '_set' . ucfirst($var); |
| 602 | 582 | if ( |
| 603 | 583 | !property_exists($this, $var) |
@@ -618,8 +598,7 @@ discard block |
||
| 618 | 598 | * |
| 619 | 599 | * @return void |
| 620 | 600 | */ |
| 621 | - protected function __construct($core) |
|
| 622 | - { |
|
| 601 | + protected function __construct($core) { |
|
| 623 | 602 | // Get Solr connection parameters from configuration. |
| 624 | 603 | $this->loadSolrConnectionInfo(); |
| 625 | 604 | // Configure connection adapter. |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @var string|null |
| 50 | 50 | * @access protected |
| 51 | 51 | */ |
| 52 | - protected $core = null; |
|
| 52 | + protected $core = NULL; |
|
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | 55 | * This holds the PID for the configuration |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * @var bool |
| 98 | 98 | * @access protected |
| 99 | 99 | */ |
| 100 | - protected $ready = false; |
|
| 100 | + protected $ready = FALSE; |
|
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | 103 | * This holds the singleton search objects with their core as array key |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | * |
| 250 | 250 | * @return \Kitodo\Dlf\Common\Solr Instance of this class |
| 251 | 251 | */ |
| 252 | - public static function getInstance($core = null) |
|
| 252 | + public static function getInstance($core = NULL) |
|
| 253 | 253 | { |
| 254 | 254 | // Get core name if UID is given. |
| 255 | 255 | if (MathUtility::canBeInterpretedAsInteger($core)) { |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | // Check if core is set or null. |
| 259 | 259 | if ( |
| 260 | 260 | empty($core) |
| 261 | - && $core !== null |
|
| 261 | + && $core !== NULL |
|
| 262 | 262 | ) { |
| 263 | 263 | Helper::devLog('Invalid core UID or name given for Apache Solr', DEVLOG_SEVERITY_ERROR); |
| 264 | 264 | } |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | 'core' => $this->core, |
| 402 | 402 | 'pid' => $this->cPid, |
| 403 | 403 | 'order' => 'score', |
| 404 | - 'order.asc' => true, |
|
| 404 | + 'order.asc' => TRUE, |
|
| 405 | 405 | 'numberOfHits' => $this->numberOfHits, |
| 406 | 406 | 'numberOfToplevelHits' => $numberOfToplevelHits |
| 407 | 407 | ] |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
| 433 | 433 | |
| 434 | 434 | $resultSet = []; |
| 435 | - if (($entry = $cache->get($cacheIdentifier)) === false) { |
|
| 435 | + if (($entry = $cache->get($cacheIdentifier)) === FALSE) { |
|
| 436 | 436 | $selectQuery = $this->service->createSelect(array_merge($this->params, $parameters)); |
| 437 | 437 | $result = $this->service->select($selectQuery); |
| 438 | 438 | foreach ($result as $doc) { |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | // we have to provide an PSR-14 Event Dispatcher instead of |
| 631 | 631 | // "null". |
| 632 | 632 | // $eventDispatcher = GeneralUtility::makeInstance(\TYPO3\CMS\Core\EventDispatcher\EventDispatcher::class); |
| 633 | - $eventDispatcher = null; |
|
| 633 | + $eventDispatcher = NULL; |
|
| 634 | 634 | // Configure endpoint. |
| 635 | 635 | $config = [ |
| 636 | 636 | 'endpoint' => [ |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | // Check if connection is established. |
| 651 | 651 | $query = $this->service->createCoreAdmin(); |
| 652 | 652 | $action = $query->createStatus(); |
| 653 | - if ($core !== null) { |
|
| 653 | + if ($core !== NULL) { |
|
| 654 | 654 | $action->setCore($core); |
| 655 | 655 | } |
| 656 | 656 | $query->setAction($action); |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | $response = $this->service->coreAdmin($query); |
| 659 | 659 | if ($response->getWasSuccessful()) { |
| 660 | 660 | // Solr is reachable, but is the core as well? |
| 661 | - if ($core !== null) { |
|
| 661 | + if ($core !== NULL) { |
|
| 662 | 662 | $result = $response->getStatusResult(); |
| 663 | 663 | if ( |
| 664 | 664 | $result instanceof \Solarium\QueryType\Server\CoreAdmin\Result\StatusResult |
@@ -672,7 +672,7 @@ discard block |
||
| 672 | 672 | } |
| 673 | 673 | } |
| 674 | 674 | // Instantiation successful! |
| 675 | - $this->ready = true; |
|
| 675 | + $this->ready = TRUE; |
|
| 676 | 676 | } |
| 677 | 677 | } catch (\Exception $e) { |
| 678 | 678 | // Nothing to do here. |
@@ -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 | - Helper::devLog('No METS part found in document with location "' . $metadata['location'] . '"', DEVLOG_SEVERITY_ERROR); |
|
| 310 | + Helper::devLog('No METS part found in document with location "'.$metadata['location'].'"', DEVLOG_SEVERITY_ERROR); |
|
| 311 | 311 | } |
| 312 | 312 | } else { |
| 313 | - Helper::devLog('Could not load XML file from "' . $metadata['location'] . '"', DEVLOG_SEVERITY_ERROR); |
|
| 313 | + Helper::devLog('Could not load XML file from "'.$metadata['location'].'"', DEVLOG_SEVERITY_ERROR); |
|
| 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 | - Helper::devLog('No records found with PID ' . $this->conf['pages'], DEVLOG_SEVERITY_NOTICE); |
|
| 608 | + Helper::devLog('No records found with PID '.$this->conf['pages'], DEVLOG_SEVERITY_NOTICE); |
|
| 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 = [ |
@@ -28,16 +28,14 @@ |
||
| 28 | 28 | * @subpackage dlf |
| 29 | 29 | * @access public |
| 30 | 30 | */ |
| 31 | -class SearchSuggest |
|
| 32 | -{ |
|
| 31 | +class SearchSuggest { |
|
| 33 | 32 | /** |
| 34 | 33 | * The main method of the eID script |
| 35 | 34 | * |
| 36 | 35 | * @param ServerRequestInterface $request |
| 37 | 36 | * @return ResponseInterface XML response of search suggestions |
| 38 | 37 | */ |
| 39 | - public function main(ServerRequestInterface $request) |
|
| 40 | - { |
|
| 38 | + public function main(ServerRequestInterface $request) { |
|
| 41 | 39 | $output = []; |
| 42 | 40 | // Get input parameters and decrypt core name. |
| 43 | 41 | $parameters = $request->getParsedBody(); |
@@ -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(); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | foreach ($rows as $row) { |
| 118 | 118 | if ($row['format'] === 0 && $row['xpath']) { |
| 119 | - $uids[] = (int)$row['uid']; |
|
| 119 | + $uids[] = (int) $row['uid']; |
|
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | return $uids; |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | $result = $queryBuilder |
| 225 | 225 | ->select('COLUMN_NAME') |
| 226 | 226 | ->from('INFORMATION_SCHEMA.COLUMNS') |
| 227 | - ->where('TABLE_NAME="tx_dlf_documents" AND TABLE_SCHEMA="' . $database . '" AND COLUMN_NAME="document_format"') |
|
| 227 | + ->where('TABLE_NAME="tx_dlf_documents" AND TABLE_SCHEMA="'.$database.'" AND COLUMN_NAME="document_format"') |
|
| 228 | 228 | ->execute(); |
| 229 | 229 | while ($resArray = $result->fetch()) { |
| 230 | 230 | if ($resArray['COLUMN_NAME'] === 'document_format') { |
@@ -43,21 +43,21 @@ discard block |
||
| 43 | 43 | public function access(): bool |
| 44 | 44 | { |
| 45 | 45 | if (count($this->getMetadataConfig())) { |
| 46 | - return true; |
|
| 46 | + return TRUE; |
|
| 47 | 47 | } |
| 48 | 48 | if ($this->oldIndexRelatedTableNames()) { |
| 49 | - return true; |
|
| 49 | + return TRUE; |
|
| 50 | 50 | } |
| 51 | 51 | if ($this->solariumSolrUpdateRequired()) { |
| 52 | - return true; |
|
| 52 | + return TRUE; |
|
| 53 | 53 | } |
| 54 | 54 | if (count($this->oldFormatClasses())) { |
| 55 | - return true; |
|
| 55 | + return TRUE; |
|
| 56 | 56 | } |
| 57 | 57 | if ($this->hasNoFormatForDocument()) { |
| 58 | - return true; |
|
| 58 | + return TRUE; |
|
| 59 | 59 | } |
| 60 | - return false; |
|
| 60 | + return FALSE; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -142,10 +142,10 @@ discard block |
||
| 142 | 142 | // Instantiate search object. |
| 143 | 143 | $solr = Solr::getInstance($resArray['index_name']); |
| 144 | 144 | if (!$solr->ready) { |
| 145 | - return true; |
|
| 145 | + return TRUE; |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | - return false; |
|
| 148 | + return FALSE; |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
@@ -201,10 +201,10 @@ discard block |
||
| 201 | 201 | || $resArray['column_name'] === 'boost' |
| 202 | 202 | || $resArray['column_name'] === 'autocomplete' |
| 203 | 203 | ) { |
| 204 | - return true; |
|
| 204 | + return TRUE; |
|
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | - return false; |
|
| 207 | + return FALSE; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | /** |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | * @param bool $checkStructureOnly |
| 215 | 215 | * @return bool |
| 216 | 216 | */ |
| 217 | - protected function hasNoFormatForDocument($checkStructureOnly = false): bool |
|
| 217 | + protected function hasNoFormatForDocument($checkStructureOnly = FALSE): bool |
|
| 218 | 218 | { |
| 219 | 219 | // Check if column "document_format" exists. |
| 220 | 220 | $database = $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['dbname']; |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | while ($resArray = $result->fetch()) { |
| 230 | 230 | if ($resArray['COLUMN_NAME'] === 'document_format') { |
| 231 | 231 | if ($checkStructureOnly) { |
| 232 | - return false; |
|
| 232 | + return FALSE; |
|
| 233 | 233 | } |
| 234 | 234 | // Check if column has empty fields. |
| 235 | 235 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('INFORMATION_SCHEMA.COLUMNS'); |
@@ -241,11 +241,11 @@ discard block |
||
| 241 | 241 | ->fetchColumn(0); |
| 242 | 242 | |
| 243 | 243 | if ($count === 0) { |
| 244 | - return false; |
|
| 244 | + return FALSE; |
|
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | - return true; |
|
| 248 | + return TRUE; |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /** |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | */ |
| 396 | 396 | protected function doSolariumSolrUpdate(): void |
| 397 | 397 | { |
| 398 | - $error = false; |
|
| 398 | + $error = FALSE; |
|
| 399 | 399 | // Get all Solr cores that were not deleted. |
| 400 | 400 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_dlf_solrcores'); |
| 401 | 401 | $result = $queryBuilder |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR |
| 413 | 413 | ); |
| 414 | 414 | $this->content .= Helper::renderFlashMessages(); |
| 415 | - $error = true; |
|
| 415 | + $error = TRUE; |
|
| 416 | 416 | } |
| 417 | 417 | } |
| 418 | 418 | if (!$error) { |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | ->update('tx_dlf_documents') |
| 440 | 440 | ->where( |
| 441 | 441 | $queryBuilder->expr()->orX( |
| 442 | - $queryBuilder->expr()->eq('document_format', $queryBuilder->createNamedParameter(null)), |
|
| 442 | + $queryBuilder->expr()->eq('document_format', $queryBuilder->createNamedParameter(NULL)), |
|
| 443 | 443 | $queryBuilder->expr()->eq('document_format', $queryBuilder->createNamedParameter('')) |
| 444 | 444 | ) |
| 445 | 445 | ) |