@@ -30,8 +30,7 @@ |
||
| 30 | 30 | * |
| 31 | 31 | * @access public |
| 32 | 32 | */ |
| 33 | -class ReindexCommand extends BaseCommand |
|
| 34 | -{ |
|
| 33 | +class ReindexCommand extends BaseCommand { |
|
| 35 | 34 | /** |
| 36 | 35 | * Configure the command by defining the name, options and arguments |
| 37 | 36 | * |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $this->initializeRepositories((int) $input->getOption('pid')); |
| 115 | 115 | |
| 116 | 116 | if ($this->storagePid == 0) { |
| 117 | - $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.'); |
|
| 117 | + $io->error('ERROR: No valid PID ('.$this->storagePid.') given.'); |
|
| 118 | 118 | return BaseCommand::FAILURE; |
| 119 | 119 | } |
| 120 | 120 | |
@@ -129,13 +129,13 @@ discard block |
||
| 129 | 129 | if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) { |
| 130 | 130 | $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 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | ->setLimit((int) $input->getOption('index-limit')) |
| 166 | 166 | ->setOffset((int) $input->getOption('index-begin')) |
| 167 | 167 | ->execute(); |
| 168 | - $io->writeln($input->getOption('index-limit') . ' documents starting from ' . $input->getOption('index-begin') . ' will be indexed.'); |
|
| 168 | + $io->writeln($input->getOption('index-limit').' documents starting from '.$input->getOption('index-begin').' will be indexed.'); |
|
| 169 | 169 | } else { |
| 170 | 170 | // Get all documents. |
| 171 | 171 | $documents = $this->documentRepository->findAll(); |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | ) { |
| 188 | 188 | $documents = $this->documentRepository->findAllByCollectionsLimited($collections, (int) $input->getOption('index-limit'), (int) $input->getOption('index-begin')); |
| 189 | 189 | |
| 190 | - $io->writeln($input->getOption('index-limit') . ' documents starting from ' . $input->getOption('index-begin') . ' will be indexed.'); |
|
| 190 | + $io->writeln($input->getOption('index-limit').' documents starting from '.$input->getOption('index-begin').' will be indexed.'); |
|
| 191 | 191 | } else { |
| 192 | 192 | // Get all documents of given collections. |
| 193 | 193 | $documents = $this->documentRepository->findAllByCollectionsLimited($collections, 0); |
@@ -201,15 +201,15 @@ discard block |
||
| 201 | 201 | $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true); |
| 202 | 202 | |
| 203 | 203 | if ($doc === null) { |
| 204 | - $io->warning('WARNING: Document "' . $document->getLocation() . '" could not be loaded. Skip to next document.'); |
|
| 204 | + $io->warning('WARNING: Document "'.$document->getLocation().'" could not be loaded. Skip to next document.'); |
|
| 205 | 205 | continue; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | if ($dryRun) { |
| 209 | - $io->writeln('DRY RUN: Would index ' . ($id + 1) . '/' . count($documents) . ' with UID "' . $document->getUid() . '" ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
| 209 | + $io->writeln('DRY RUN: Would index '.($id + 1).'/'.count($documents).' with UID "'.$document->getUid().'" ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
| 210 | 210 | } else { |
| 211 | 211 | if ($io->isVerbose()) { |
| 212 | - $io->writeln(date('Y-m-d H:i:s') . ' Indexing ' . ($id + 1) . '/' . count($documents) . ' with UID "' . $document->getUid() . '" ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
| 212 | + $io->writeln(date('Y-m-d H:i:s').' Indexing '.($id + 1).'/'.count($documents).' with UID "'.$document->getUid().'" ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
| 213 | 213 | } |
| 214 | 214 | $document->setCurrentDocument($doc); |
| 215 | 215 | // save to database |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | ->setHelp('') |
| 47 | 47 | ->addOption( |
| 48 | 48 | 'dry-run', |
| 49 | - null, |
|
| 49 | + NULL, |
|
| 50 | 50 | InputOption::VALUE_NONE, |
| 51 | 51 | 'If this option is set, the files will not actually be processed but the location URI is shown.' |
| 52 | 52 | ) |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | protected function execute(InputInterface $input, OutputInterface $output): int |
| 108 | 108 | { |
| 109 | - $dryRun = $input->getOption('dry-run') != false ? true : false; |
|
| 109 | + $dryRun = $input->getOption('dry-run') != FALSE ? TRUE : FALSE; |
|
| 110 | 110 | |
| 111 | 111 | $io = new SymfonyStyle($input, $output); |
| 112 | 112 | $io->title($this->getDescription()); |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | $this->owner = $this->libraryRepository->findOneByIndexName((string) $input->getOption('owner')); |
| 152 | 152 | } |
| 153 | 153 | } else { |
| 154 | - $this->owner = null; |
|
| 154 | + $this->owner = NULL; |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (!empty($input->getOption('all'))) { |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | !empty($input->getOption('coll')) |
| 175 | 175 | && !is_array($input->getOption('coll')) |
| 176 | 176 | ) { |
| 177 | - $collections = GeneralUtility::intExplode(',', $input->getOption('coll'), true); |
|
| 177 | + $collections = GeneralUtility::intExplode(',', $input->getOption('coll'), TRUE); |
|
| 178 | 178 | // "coll" may be a single integer or a comma-separated list of integers. |
| 179 | 179 | if (empty(array_filter($collections))) { |
| 180 | 180 | $io->error('ERROR: Parameter --coll|-c is not a valid comma-separated list of collection UIDs.'); |
@@ -198,9 +198,9 @@ discard block |
||
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | foreach ($documents as $id => $document) { |
| 201 | - $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true); |
|
| 201 | + $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], TRUE); |
|
| 202 | 202 | |
| 203 | - if ($doc === null) { |
|
| 203 | + if ($doc === NULL) { |
|
| 204 | 204 | $io->warning('WARNING: Document "' . $document->getLocation() . '" could not be loaded. Skip to next document.'); |
| 205 | 205 | continue; |
| 206 | 206 | } |
@@ -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 |
@@ -40,8 +40,7 @@ |
||
| 40 | 40 | * |
| 41 | 41 | * @access public |
| 42 | 42 | */ |
| 43 | -class BaseCommand extends Command |
|
| 44 | -{ |
|
| 43 | +class BaseCommand extends Command { |
|
| 45 | 44 | /** |
| 46 | 45 | * @access protected |
| 47 | 46 | * @var CollectionRepository |
@@ -201,8 +201,8 @@ discard block |
||
| 201 | 201 | protected function saveToDatabase(Document $document): bool |
| 202 | 202 | { |
| 203 | 203 | $doc = $document->getCurrentDocument(); |
| 204 | - if ($doc === null) { |
|
| 205 | - return false; |
|
| 204 | + if ($doc === NULL) { |
|
| 205 | + return FALSE; |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | $doc->cPid = $this->storagePid; |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | $document->setPartof($this->getParentDocumentUidForSaving($document)); |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - if ($document->getUid() === null) { |
|
| 261 | + if ($document->getUid() === NULL) { |
|
| 262 | 262 | // new document |
| 263 | 263 | $this->documentRepository->add($document); |
| 264 | 264 | } else { |
@@ -268,10 +268,10 @@ discard block |
||
| 268 | 268 | |
| 269 | 269 | $this->persistenceManager->persistAll(); |
| 270 | 270 | |
| 271 | - return true; |
|
| 271 | + return TRUE; |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - return false; |
|
| 274 | + return FALSE; |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | /** |
@@ -288,14 +288,14 @@ discard block |
||
| 288 | 288 | { |
| 289 | 289 | $doc = $document->getCurrentDocument(); |
| 290 | 290 | |
| 291 | - if ($doc !== null && !empty($doc->parentHref)) { |
|
| 291 | + if ($doc !== NULL && !empty($doc->parentHref)) { |
|
| 292 | 292 | // find document object by record_id of parent |
| 293 | 293 | $parent = AbstractDocument::getInstance($doc->parentHref, ['storagePid' => $this->storagePid]); |
| 294 | 294 | |
| 295 | 295 | if ($parent->recordId) { |
| 296 | 296 | $parentDocument = $this->documentRepository->findOneByRecordId($parent->recordId); |
| 297 | 297 | |
| 298 | - if ($parentDocument === null) { |
|
| 298 | + if ($parentDocument === NULL) { |
|
| 299 | 299 | // create new Document object |
| 300 | 300 | $parentDocument = GeneralUtility::makeInstance(Document::class); |
| 301 | 301 | } |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | |
| 308 | 308 | $success = $this->saveToDatabase($parentDocument); |
| 309 | 309 | |
| 310 | - if ($success === true) { |
|
| 310 | + if ($success === TRUE) { |
|
| 311 | 311 | // add to index |
| 312 | 312 | Indexer::add($parentDocument, $this->documentRepository); |
| 313 | 313 | return $parentDocument->getUid(); |
@@ -33,8 +33,7 @@ |
||
| 33 | 33 | * |
| 34 | 34 | * @access public |
| 35 | 35 | */ |
| 36 | -class HarvestCommand extends BaseCommand |
|
| 37 | -{ |
|
| 36 | +class HarvestCommand extends BaseCommand { |
|
| 38 | 37 | /** |
| 39 | 38 | * Configure the command by defining the name, options and arguments |
| 40 | 39 | * |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | ->setHelp('') |
| 50 | 50 | ->addOption( |
| 51 | 51 | 'dry-run', |
| 52 | - null, |
|
| 52 | + NULL, |
|
| 53 | 53 | InputOption::VALUE_NONE, |
| 54 | 54 | 'If this option is set, the files will not actually be processed but the location URIs are shown.' |
| 55 | 55 | ) |
@@ -73,19 +73,19 @@ discard block |
||
| 73 | 73 | ) |
| 74 | 74 | ->addOption( |
| 75 | 75 | 'from', |
| 76 | - null, |
|
| 76 | + NULL, |
|
| 77 | 77 | InputOption::VALUE_OPTIONAL, |
| 78 | 78 | 'Datestamp (YYYY-MM-DD) to begin harvesting from.' |
| 79 | 79 | ) |
| 80 | 80 | ->addOption( |
| 81 | 81 | 'until', |
| 82 | - null, |
|
| 82 | + NULL, |
|
| 83 | 83 | InputOption::VALUE_OPTIONAL, |
| 84 | 84 | 'Datestamp (YYYY-MM-DD) to end harvesting on.' |
| 85 | 85 | ) |
| 86 | 86 | ->addOption( |
| 87 | 87 | 'set', |
| 88 | - null, |
|
| 88 | + NULL, |
|
| 89 | 89 | InputOption::VALUE_OPTIONAL, |
| 90 | 90 | 'Name of the set to limit harvesting to.' |
| 91 | 91 | ); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | protected function execute(InputInterface $input, OutputInterface $output): int |
| 105 | 105 | { |
| 106 | - $dryRun = $input->getOption('dry-run') != false ? true : false; |
|
| 106 | + $dryRun = $input->getOption('dry-run') != FALSE ? TRUE : FALSE; |
|
| 107 | 107 | |
| 108 | 108 | $io = new SymfonyStyle($input, $output); |
| 109 | 109 | $io->title($this->getDescription()); |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | ) { |
| 172 | 172 | $from = new \DateTime($input->getOption('from')); |
| 173 | 173 | } else { |
| 174 | - $from = null; |
|
| 174 | + $from = NULL; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | if ( |
@@ -180,10 +180,10 @@ discard block |
||
| 180 | 180 | ) { |
| 181 | 181 | $until = new \DateTime($input->getOption('until')); |
| 182 | 182 | } else { |
| 183 | - $until = null; |
|
| 183 | + $until = NULL; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - $set = null; |
|
| 186 | + $set = NULL; |
|
| 187 | 187 | if ( |
| 188 | 188 | !is_array($input->getOption('set')) |
| 189 | 189 | && !empty($input->getOption('set')) |
@@ -225,10 +225,10 @@ discard block |
||
| 225 | 225 | ]; |
| 226 | 226 | $docLocation = $baseLocation . http_build_query($params); |
| 227 | 227 | // ...index the document... |
| 228 | - $document = null; |
|
| 229 | - $doc = AbstractDocument::getInstance($docLocation, ['storagePid' => $this->storagePid], true); |
|
| 228 | + $document = NULL; |
|
| 229 | + $doc = AbstractDocument::getInstance($docLocation, ['storagePid' => $this->storagePid], TRUE); |
|
| 230 | 230 | |
| 231 | - if ($doc === null) { |
|
| 231 | + if ($doc === NULL) { |
|
| 232 | 232 | $io->warning('WARNING: Document "' . $docLocation . '" could not be loaded. Skip to next document.'); |
| 233 | 233 | continue; |
| 234 | 234 | } |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | $document = $this->documentRepository->findOneByRecordId($doc->recordId); |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - if ($document === null) { |
|
| 240 | + if ($document === NULL) { |
|
| 241 | 241 | // create new Document object |
| 242 | 242 | $document = GeneralUtility::makeInstance(Document::class); |
| 243 | 243 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $this->initializeRepositories((int) $input->getOption('pid')); |
| 112 | 112 | |
| 113 | 113 | if ($this->storagePid == 0) { |
| 114 | - $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.'); |
|
| 114 | + $io->error('ERROR: No valid PID ('.$this->storagePid.') given.'); |
|
| 115 | 115 | return BaseCommand::FAILURE; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -129,13 +129,13 @@ discard block |
||
| 129 | 129 | if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) { |
| 130 | 130 | $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 | } |
@@ -31,8 +31,7 @@ |
||
| 31 | 31 | * |
| 32 | 32 | * @access public |
| 33 | 33 | */ |
| 34 | -class IndexCommand extends BaseCommand |
|
| 35 | -{ |
|
| 34 | +class IndexCommand extends BaseCommand { |
|
| 36 | 35 | |
| 37 | 36 | /** |
| 38 | 37 | * Configure the command by defining the name, options and arguments |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | ->setHelp('') |
| 49 | 49 | ->addOption( |
| 50 | 50 | 'dry-run', |
| 51 | - null, |
|
| 51 | + NULL, |
|
| 52 | 52 | InputOption::VALUE_NONE, |
| 53 | 53 | 'If this option is set, the files will not actually be processed but the location URI is shown.' |
| 54 | 54 | ) |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | protected function execute(InputInterface $input, OutputInterface $output): int |
| 92 | 92 | { |
| 93 | - $dryRun = $input->getOption('dry-run') != false ? true : false; |
|
| 93 | + $dryRun = $input->getOption('dry-run') != FALSE ? TRUE : FALSE; |
|
| 94 | 94 | |
| 95 | 95 | $io = new SymfonyStyle($input, $output); |
| 96 | 96 | $io->title($this->getDescription()); |
@@ -147,31 +147,31 @@ discard block |
||
| 147 | 147 | $this->owner = $this->libraryRepository->findOneByIndexName((string) $input->getOption('owner')); |
| 148 | 148 | } |
| 149 | 149 | } else { |
| 150 | - $this->owner = null; |
|
| 150 | + $this->owner = NULL; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - $document = null; |
|
| 154 | - $doc = null; |
|
| 153 | + $document = NULL; |
|
| 154 | + $doc = NULL; |
|
| 155 | 155 | |
| 156 | 156 | // Try to find existing document in database |
| 157 | 157 | if (MathUtility::canBeInterpretedAsInteger($input->getOption('doc'))) { |
| 158 | 158 | |
| 159 | 159 | $document = $this->documentRepository->findByUid($input->getOption('doc')); |
| 160 | 160 | |
| 161 | - if ($document === null) { |
|
| 161 | + if ($document === NULL) { |
|
| 162 | 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 | - $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true); |
|
| 165 | + $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], TRUE); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | } else if (GeneralUtility::isValidUrl($input->getOption('doc'))) { |
| 169 | - $doc = AbstractDocument::getInstance($input->getOption('doc'), ['storagePid' => $this->storagePid], true); |
|
| 169 | + $doc = AbstractDocument::getInstance($input->getOption('doc'), ['storagePid' => $this->storagePid], TRUE); |
|
| 170 | 170 | |
| 171 | 171 | $document = $this->getDocumentFromUrl($doc, $input->getOption('doc')); |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - if ($doc === null) { |
|
| 174 | + if ($doc === NULL) { |
|
| 175 | 175 | $io->error('ERROR: Document "' . $input->getOption('doc') . '" could not be loaded.'); |
| 176 | 176 | return BaseCommand::FAILURE; |
| 177 | 177 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | private function getDocumentFromUrl($doc, string $url): Document |
| 210 | 210 | { |
| 211 | - $document = null; |
|
| 211 | + $document = NULL; |
|
| 212 | 212 | |
| 213 | 213 | if ($doc->recordId) { |
| 214 | 214 | $document = $this->documentRepository->findOneByRecordId($doc->recordId); |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | $document = $this->documentRepository->findOneByLocation($url); |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - if ($document === null) { |
|
| 219 | + if ($document === NULL) { |
|
| 220 | 220 | // create new Document object |
| 221 | 221 | $document = GeneralUtility::makeInstance(Document::class); |
| 222 | 222 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $this->initializeRepositories((int) $input->getOption('pid')); |
| 99 | 99 | |
| 100 | 100 | if ($this->storagePid == 0) { |
| 101 | - $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.'); |
|
| 101 | + $io->error('ERROR: No valid PID ('.$this->storagePid.') given.'); |
|
| 102 | 102 | return BaseCommand::FAILURE; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -113,13 +113,13 @@ discard block |
||
| 113 | 113 | if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) { |
| 114 | 114 | $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,31 +172,31 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | if ($doc === null) { |
| 175 | - $io->error('ERROR: Document "' . $input->getOption('doc') . '" could not be loaded.'); |
|
| 175 | + $io->error('ERROR: Document "'.$input->getOption('doc').'" could not be loaded.'); |
|
| 176 | 176 | return BaseCommand::FAILURE; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | $document->setSolrcore($solrCoreUid); |
| 180 | 180 | |
| 181 | 181 | if ($dryRun) { |
| 182 | - $io->section('DRY RUN: Would index ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
| 182 | + $io->section('DRY RUN: Would index '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
| 183 | 183 | $io->success('All done!'); |
| 184 | 184 | return BaseCommand::SUCCESS; |
| 185 | 185 | } else { |
| 186 | 186 | $document->setCurrentDocument($doc); |
| 187 | 187 | |
| 188 | 188 | if ($io->isVerbose()) { |
| 189 | - $io->section('Indexing ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . '.'); |
|
| 189 | + $io->section('Indexing '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.'.'); |
|
| 190 | 190 | } |
| 191 | 191 | $isSaved = $this->saveToDatabase($document); |
| 192 | 192 | |
| 193 | 193 | if ($isSaved) { |
| 194 | 194 | if ($io->isVerbose()) { |
| 195 | - $io->section('Indexing ' . $document->getUid() . ' ("' . $document->getLocation() . '") on Solr core ' . $solrCoreUid . '.'); |
|
| 195 | + $io->section('Indexing '.$document->getUid().' ("'.$document->getLocation().'") on Solr core '.$solrCoreUid.'.'); |
|
| 196 | 196 | } |
| 197 | 197 | $isSaved = Indexer::add($document, $this->documentRepository); |
| 198 | 198 | } else { |
| 199 | - $io->error('ERROR: Document with UID "' . $document->getUid() . '" could not be indexed on PID ' . $this->storagePid . ' . There are missing mandatory fields (at least one of those: ' . $this->extConf['requiredMetadataFields'] . ') in this document.'); |
|
| 199 | + $io->error('ERROR: Document with UID "'.$document->getUid().'" could not be indexed on PID '.$this->storagePid.' . There are missing mandatory fields (at least one of those: '.$this->extConf['requiredMetadataFields'].') in this document.'); |
|
| 200 | 200 | return BaseCommand::FAILURE; |
| 201 | 201 | } |
| 202 | 202 | |
@@ -205,8 +205,8 @@ discard block |
||
| 205 | 205 | return BaseCommand::SUCCESS; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - $io->error('ERROR: Document with UID "' . $document->getUid() . '" could not be indexed on Solr core ' . $solrCoreUid . ' . There are missing mandatory fields (at least one of those: ' . $this->extConf['requiredMetadataFields'] . ') in this document.'); |
|
| 209 | - $io->info('INFO: Document with UID "' . $document->getUid() . '" is already in database. If you want to keep the database and index consistent you need to remove it.'); |
|
| 208 | + $io->error('ERROR: Document with UID "'.$document->getUid().'" could not be indexed on Solr core '.$solrCoreUid.' . There are missing mandatory fields (at least one of those: '.$this->extConf['requiredMetadataFields'].') in this document.'); |
|
| 209 | + $io->info('INFO: Document with UID "'.$document->getUid().'" is already in database. If you want to keep the database and index consistent you need to remove it.'); |
|
| 210 | 210 | return BaseCommand::FAILURE; |
| 211 | 211 | } |
| 212 | 212 | } |
@@ -22,7 +22,6 @@ |
||
| 22 | 22 | * |
| 23 | 23 | * @access public |
| 24 | 24 | */ |
| 25 | -class StructureRepository extends Repository |
|
| 26 | -{ |
|
| 25 | +class StructureRepository extends Repository { |
|
| 27 | 26 | |
| 28 | 27 | } |
@@ -24,8 +24,7 @@ |
||
| 24 | 24 | * |
| 25 | 25 | * @access public |
| 26 | 26 | */ |
| 27 | -class MetadataRepository extends Repository |
|
| 28 | -{ |
|
| 27 | +class MetadataRepository extends Repository { |
|
| 29 | 28 | /** |
| 30 | 29 | * Finds all collection for the given settings |
| 31 | 30 | * |
@@ -41,11 +41,11 @@ |
||
| 41 | 41 | |
| 42 | 42 | $constraints = []; |
| 43 | 43 | |
| 44 | - if (isset($settings['is_listed']) && $settings['is_listed'] == true) { |
|
| 44 | + if (isset($settings['is_listed']) && $settings['is_listed'] == TRUE) { |
|
| 45 | 45 | $constraints[] = $query->equals('is_listed', 1); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - if (isset($settings['is_sortable']) && $settings['is_sortable'] == true) { |
|
| 48 | + if (isset($settings['is_sortable']) && $settings['is_sortable'] == TRUE) { |
|
| 49 | 49 | $constraints[] = $query->equals('is_sortable', 1); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -22,7 +22,6 @@ |
||
| 22 | 22 | * |
| 23 | 23 | * @access public |
| 24 | 24 | */ |
| 25 | -class FormatRepository extends Repository |
|
| 26 | -{ |
|
| 25 | +class FormatRepository extends Repository { |
|
| 27 | 26 | |
| 28 | 27 | } |
@@ -22,8 +22,7 @@ |
||
| 22 | 22 | * |
| 23 | 23 | * @access public |
| 24 | 24 | */ |
| 25 | -class TokenRepository extends Repository |
|
| 26 | -{ |
|
| 25 | +class TokenRepository extends Repository { |
|
| 27 | 26 | /** |
| 28 | 27 | * Delete all expired token |
| 29 | 28 | * |
@@ -22,7 +22,6 @@ |
||
| 22 | 22 | * |
| 23 | 23 | * @access public |
| 24 | 24 | */ |
| 25 | -class SolrCoreRepository extends Repository |
|
| 26 | -{ |
|
| 25 | +class SolrCoreRepository extends Repository { |
|
| 27 | 26 | |
| 28 | 27 | } |