@@ -26,8 +26,7 @@ |
||
| 26 | 26 | * @subpackage dlf |
| 27 | 27 | * @access public |
| 28 | 28 | */ |
| 29 | -class BaseCommand extends Command |
|
| 30 | -{ |
|
| 29 | +class BaseCommand extends Command { |
|
| 31 | 30 | /** |
| 32 | 31 | * Return starting point for indexing command. |
| 33 | 32 | * |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $startingPoint = $this->getStartingPoint($input->getOption('pid')); |
| 98 | 98 | |
| 99 | 99 | if ($startingPoint == 0) { |
| 100 | - $io->error('ERROR: No valid PID (' . $startingPoint . ') given.'); |
|
| 100 | + $io->error('ERROR: No valid PID ('.$startingPoint.') given.'); |
|
| 101 | 101 | exit(1); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) { |
| 113 | 113 | $output_solrCores = []; |
| 114 | 114 | foreach ($allSolrCores as $index_name => $uid) { |
| 115 | - $output_solrCores[] = $uid . ' : ' . $index_name; |
|
| 115 | + $output_solrCores[] = $uid.' : '.$index_name; |
|
| 116 | 116 | } |
| 117 | 117 | if (empty($output_solrCores)) { |
| 118 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $startingPoint . ".\n"); |
|
| 118 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$startingPoint.".\n"); |
|
| 119 | 119 | exit(1); |
| 120 | 120 | } else { |
| 121 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $output_solrCores) . "\n"); |
|
| 121 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $output_solrCores)."\n"); |
|
| 122 | 122 | exit(1); |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -149,18 +149,18 @@ discard block |
||
| 149 | 149 | $doc = Document::getInstance($document, $startingPoint, true); |
| 150 | 150 | if ($doc->ready) { |
| 151 | 151 | if ($dryRun) { |
| 152 | - $io->writeln('DRY RUN: Would index ' . $id . '/' . count($documents) . ' ' . $doc->uid . ' ("' . $doc->location . '") on UID ' . $startingPoint . ' and Solr core ' . $solrCoreUid . '.'); |
|
| 152 | + $io->writeln('DRY RUN: Would index '.$id.'/'.count($documents).' '.$doc->uid.' ("'.$doc->location.'") on UID '.$startingPoint.' and Solr core '.$solrCoreUid.'.'); |
|
| 153 | 153 | } else { |
| 154 | 154 | if ($io->isVerbose()) { |
| 155 | - $io->writeln(date('Y-m-d H:i:s') . ' Indexing ' . $id . '/' . count($documents) . ' ' . $doc->uid . ' ("' . $doc->location . '") on UID ' . $startingPoint . ' and Solr core ' . $solrCoreUid . '.'); |
|
| 155 | + $io->writeln(date('Y-m-d H:i:s').' Indexing '.$id.'/'.count($documents).' '.$doc->uid.' ("'.$doc->location.'") on UID '.$startingPoint.' and Solr core '.$solrCoreUid.'.'); |
|
| 156 | 156 | } |
| 157 | 157 | // ...and save it to the database... |
| 158 | 158 | if (!$doc->save($startingPoint, $solrCoreUid)) { |
| 159 | - $io->error('ERROR: Document "' . $id . '" not saved and indexed.'); |
|
| 159 | + $io->error('ERROR: Document "'.$id.'" not saved and indexed.'); |
|
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | } else { |
| 163 | - $io->error('ERROR: Document "' . $id . '" could not be loaded.'); |
|
| 163 | + $io->error('ERROR: Document "'.$id.'" could not be loaded.'); |
|
| 164 | 164 | } |
| 165 | 165 | // Clear document registry to prevent memory exhaustion. |
| 166 | 166 | Document::clearRegistry(); |
@@ -32,15 +32,13 @@ discard block |
||
| 32 | 32 | * @subpackage dlf |
| 33 | 33 | * @access public |
| 34 | 34 | */ |
| 35 | -class ReindexCommand extends BaseCommand |
|
| 36 | -{ |
|
| 35 | +class ReindexCommand extends BaseCommand { |
|
| 37 | 36 | /** |
| 38 | 37 | * Configure the command by defining the name, options and arguments |
| 39 | 38 | * |
| 40 | 39 | * @return void |
| 41 | 40 | */ |
| 42 | - public function configure() |
|
| 43 | - { |
|
| 41 | + public function configure() { |
|
| 44 | 42 | $this |
| 45 | 43 | ->setDescription('Reindex a collection into database and Solr.') |
| 46 | 44 | ->setHelp('') |
@@ -84,8 +82,7 @@ discard block |
||
| 84 | 82 | * |
| 85 | 83 | * @return void |
| 86 | 84 | */ |
| 87 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
| 88 | - { |
|
| 85 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 89 | 86 | // Make sure the _cli_ user is loaded |
| 90 | 87 | Bootstrap::getInstance()->initializeBackendAuthentication(); |
| 91 | 88 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $startingPoint = $this->getStartingPoint($input->getOption('pid')); |
| 91 | 91 | |
| 92 | 92 | if ($startingPoint == 0) { |
| 93 | - $io->error('ERROR: No valid PID (' . $startingPoint . ') given.'); |
|
| 93 | + $io->error('ERROR: No valid PID ('.$startingPoint.') given.'); |
|
| 94 | 94 | exit(1); |
| 95 | 95 | } |
| 96 | 96 | |
@@ -105,13 +105,13 @@ discard block |
||
| 105 | 105 | if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) { |
| 106 | 106 | $output_solrCores = []; |
| 107 | 107 | foreach ($allSolrCores as $index_name => $uid) { |
| 108 | - $output_solrCores[] = $uid . ' : ' . $index_name; |
|
| 108 | + $output_solrCores[] = $uid.' : '.$index_name; |
|
| 109 | 109 | } |
| 110 | 110 | if (empty($output_solrCores)) { |
| 111 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $startingPoint . ".\n"); |
|
| 111 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$startingPoint.".\n"); |
|
| 112 | 112 | exit(1); |
| 113 | 113 | } else { |
| 114 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $output_solrCores) . "\n"); |
|
| 114 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $output_solrCores)."\n"); |
|
| 115 | 115 | exit(1); |
| 116 | 116 | } |
| 117 | 117 | } |
@@ -136,19 +136,19 @@ discard block |
||
| 136 | 136 | $doc = Document::getInstance($input->getOption('doc'), $startingPoint, true); |
| 137 | 137 | if ($doc->ready) { |
| 138 | 138 | if ($dryRun) { |
| 139 | - $io->section('DRY RUN: Would index ' . $doc->uid . ' ("' . $doc->location . '") on UID ' . $startingPoint . ' and Solr core ' . $solrCoreUid . '.'); |
|
| 139 | + $io->section('DRY RUN: Would index '.$doc->uid.' ("'.$doc->location.'") on UID '.$startingPoint.' and Solr core '.$solrCoreUid.'.'); |
|
| 140 | 140 | } else { |
| 141 | 141 | if ($io->isVerbose()) { |
| 142 | - $io->section('Indexing ' . $doc->uid . ' ("' . $doc->location . '") on UID ' . $startingPoint . ' and Solr core ' . $solrCoreUid . '.'); |
|
| 142 | + $io->section('Indexing '.$doc->uid.' ("'.$doc->location.'") on UID '.$startingPoint.' and Solr core '.$solrCoreUid.'.'); |
|
| 143 | 143 | } |
| 144 | 144 | // ...and save it to the database... |
| 145 | 145 | if (!$doc->save($startingPoint, $solrCoreUid)) { |
| 146 | - $io->error('ERROR: Document "' . $input->getOption('doc') . '" not saved and indexed.'); |
|
| 146 | + $io->error('ERROR: Document "'.$input->getOption('doc').'" not saved and indexed.'); |
|
| 147 | 147 | exit(1); |
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | } else { |
| 151 | - $io->error('ERROR: Document "' . $input->getOption('doc') . '" could not be loaded.'); |
|
| 151 | + $io->error('ERROR: Document "'.$input->getOption('doc').'" could not be loaded.'); |
|
| 152 | 152 | exit(1); |
| 153 | 153 | } |
| 154 | 154 | |
@@ -31,15 +31,13 @@ discard block |
||
| 31 | 31 | * @subpackage dlf |
| 32 | 32 | * @access public |
| 33 | 33 | */ |
| 34 | -class IndexCommand extends BaseCommand |
|
| 35 | -{ |
|
| 34 | +class IndexCommand extends BaseCommand { |
|
| 36 | 35 | /** |
| 37 | 36 | * Configure the command by defining the name, options and arguments |
| 38 | 37 | * |
| 39 | 38 | * @return void |
| 40 | 39 | */ |
| 41 | - public function configure() |
|
| 42 | - { |
|
| 40 | + public function configure() { |
|
| 43 | 41 | $this |
| 44 | 42 | ->setDescription('Index single document into database and Solr.') |
| 45 | 43 | ->setHelp('') |
@@ -77,8 +75,7 @@ discard block |
||
| 77 | 75 | * |
| 78 | 76 | * @return void |
| 79 | 77 | */ |
| 80 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
| 81 | - { |
|
| 78 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 82 | 79 | // Make sure the _cli_ user is loaded |
| 83 | 80 | Bootstrap::getInstance()->initializeBackendAuthentication(); |
| 84 | 81 | |