@@ -20,8 +20,7 @@ discard block |
||
20 | 20 | * @subpackage dlf |
21 | 21 | * @access public |
22 | 22 | */ |
23 | -class Region |
|
24 | -{ |
|
23 | +class Region { |
|
25 | 24 | |
26 | 25 | /** |
27 | 26 | * The identifier of the region |
@@ -105,8 +104,7 @@ discard block |
||
105 | 104 | * |
106 | 105 | * @return void |
107 | 106 | */ |
108 | - public function __construct($id, $region) |
|
109 | - { |
|
107 | + public function __construct($id, $region) { |
|
110 | 108 | $this->id = $id; |
111 | 109 | $this->pageId = $region['pageIdx']; |
112 | 110 | $this->xBeginPosition = $region['ulx']; |
@@ -125,8 +123,7 @@ discard block |
||
125 | 123 | * |
126 | 124 | * @return int The region's identifier |
127 | 125 | */ |
128 | - public function getId() |
|
129 | - { |
|
126 | + public function getId() { |
|
130 | 127 | return $this->id; |
131 | 128 | } |
132 | 129 | |
@@ -137,8 +134,7 @@ discard block |
||
137 | 134 | * |
138 | 135 | * @return int The region's page identifier |
139 | 136 | */ |
140 | - public function getPageId() |
|
141 | - { |
|
137 | + public function getPageId() { |
|
142 | 138 | return $this->pageId; |
143 | 139 | } |
144 | 140 | |
@@ -149,8 +145,7 @@ discard block |
||
149 | 145 | * |
150 | 146 | * @return int The region's horizontal beginning position |
151 | 147 | */ |
152 | - public function getXBeginPosition() |
|
153 | - { |
|
148 | + public function getXBeginPosition() { |
|
154 | 149 | return $this->xBeginPosition; |
155 | 150 | } |
156 | 151 | |
@@ -161,8 +156,7 @@ discard block |
||
161 | 156 | * |
162 | 157 | * @return int The region's horizontal ending position |
163 | 158 | */ |
164 | - public function getXEndPosition() |
|
165 | - { |
|
159 | + public function getXEndPosition() { |
|
166 | 160 | return $this->xEndPosition; |
167 | 161 | } |
168 | 162 | |
@@ -173,8 +167,7 @@ discard block |
||
173 | 167 | * |
174 | 168 | * @return int The region's vertical beginning position |
175 | 169 | */ |
176 | - public function getYBeginPosition() |
|
177 | - { |
|
170 | + public function getYBeginPosition() { |
|
178 | 171 | return $this->yBeginPosition; |
179 | 172 | } |
180 | 173 | |
@@ -185,8 +178,7 @@ discard block |
||
185 | 178 | * |
186 | 179 | * @return int The region's vertical ending position |
187 | 180 | */ |
188 | - public function getYEndPosition() |
|
189 | - { |
|
181 | + public function getYEndPosition() { |
|
190 | 182 | return $this->yEndPosition; |
191 | 183 | } |
192 | 184 | |
@@ -197,8 +189,7 @@ discard block |
||
197 | 189 | * |
198 | 190 | * @return int The region's width |
199 | 191 | */ |
200 | - public function getWidth() |
|
201 | - { |
|
192 | + public function getWidth() { |
|
202 | 193 | return $this->width; |
203 | 194 | } |
204 | 195 | |
@@ -209,8 +200,7 @@ discard block |
||
209 | 200 | * |
210 | 201 | * @return int The region's height |
211 | 202 | */ |
212 | - public function getHeight() |
|
213 | - { |
|
203 | + public function getHeight() { |
|
214 | 204 | return $this->height; |
215 | 205 | } |
216 | 206 | |
@@ -221,8 +211,7 @@ discard block |
||
221 | 211 | * |
222 | 212 | * @return string The region's text |
223 | 213 | */ |
224 | - public function getText() |
|
225 | - { |
|
214 | + public function getText() { |
|
226 | 215 | return $this->text; |
227 | 216 | } |
228 | 217 | } |
@@ -105,7 +105,7 @@ |
||
105 | 105 | $this->yEndPosition = $highlight['lry']; |
106 | 106 | $this->width = $highlight['lrx'] - $highlight['ulx']; |
107 | 107 | $this->height = $highlight['lry'] - $highlight['uly']; |
108 | - $this->id = $this->width . '_' . $this->height . '_' . $this->xBeginPosition . '_' . $this->yBeginPosition; |
|
108 | + $this->id = $this->width.'_'.$this->height.'_'.$this->xBeginPosition.'_'.$this->yBeginPosition; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -20,8 +20,7 @@ discard block |
||
20 | 20 | * @subpackage dlf |
21 | 21 | * @access public |
22 | 22 | */ |
23 | -class Highlight |
|
24 | -{ |
|
23 | +class Highlight { |
|
25 | 24 | |
26 | 25 | /** |
27 | 26 | * The identifier in form 'w_h_x_y' |
@@ -96,8 +95,7 @@ discard block |
||
96 | 95 | * |
97 | 96 | * @return void |
98 | 97 | */ |
99 | - public function __construct($highlight) |
|
100 | - { |
|
98 | + public function __construct($highlight) { |
|
101 | 99 | $this->parentRegionId = $highlight['parentRegionIdx']; |
102 | 100 | $this->xBeginPosition = $highlight['ulx']; |
103 | 101 | $this->xEndPosition = $highlight['lrx']; |
@@ -115,8 +113,7 @@ discard block |
||
115 | 113 | * |
116 | 114 | * @return string The highlight's identifier |
117 | 115 | */ |
118 | - public function getId() |
|
119 | - { |
|
116 | + public function getId() { |
|
120 | 117 | return $this->id; |
121 | 118 | } |
122 | 119 | |
@@ -127,8 +124,7 @@ discard block |
||
127 | 124 | * |
128 | 125 | * @return int The highlight's horizontal beginning position |
129 | 126 | */ |
130 | - public function getXBeginPosition() |
|
131 | - { |
|
127 | + public function getXBeginPosition() { |
|
132 | 128 | return $this->xBeginPosition; |
133 | 129 | } |
134 | 130 | |
@@ -139,8 +135,7 @@ discard block |
||
139 | 135 | * |
140 | 136 | * @return int The highlight's horizontal ending position |
141 | 137 | */ |
142 | - public function getXEndPosition() |
|
143 | - { |
|
138 | + public function getXEndPosition() { |
|
144 | 139 | return $this->xEndPosition; |
145 | 140 | } |
146 | 141 | |
@@ -151,8 +146,7 @@ discard block |
||
151 | 146 | * |
152 | 147 | * @return int The highlight's vertical beginning position |
153 | 148 | */ |
154 | - public function getYBeginPosition() |
|
155 | - { |
|
149 | + public function getYBeginPosition() { |
|
156 | 150 | return $this->yBeginPosition; |
157 | 151 | } |
158 | 152 | |
@@ -163,8 +157,7 @@ discard block |
||
163 | 157 | * |
164 | 158 | * @return int The highlight's vertical ending position |
165 | 159 | */ |
166 | - public function getYEndPosition() |
|
167 | - { |
|
160 | + public function getYEndPosition() { |
|
168 | 161 | return $this->yEndPosition; |
169 | 162 | } |
170 | 163 | |
@@ -175,8 +168,7 @@ discard block |
||
175 | 168 | * |
176 | 169 | * @return int The highlight's width |
177 | 170 | */ |
178 | - public function getWidth() |
|
179 | - { |
|
171 | + public function getWidth() { |
|
180 | 172 | return $this->width; |
181 | 173 | } |
182 | 174 | |
@@ -187,8 +179,7 @@ discard block |
||
187 | 179 | * |
188 | 180 | * @return int The highlight's height |
189 | 181 | */ |
190 | - public function getHeight() |
|
191 | - { |
|
182 | + public function getHeight() { |
|
192 | 183 | return $this->height; |
193 | 184 | } |
194 | 185 | } |
@@ -20,8 +20,7 @@ discard block |
||
20 | 20 | * @subpackage dlf |
21 | 21 | * @access public |
22 | 22 | */ |
23 | -class Page |
|
24 | -{ |
|
23 | +class Page { |
|
25 | 24 | |
26 | 25 | /** |
27 | 26 | * The identifier of the page |
@@ -65,8 +64,7 @@ discard block |
||
65 | 64 | * |
66 | 65 | * @return void |
67 | 66 | */ |
68 | - public function __construct($id, $page) |
|
69 | - { |
|
67 | + public function __construct($id, $page) { |
|
70 | 68 | $this->id = $id; |
71 | 69 | $this->name = $page['id']; |
72 | 70 | $this->width = $page['width']; |
@@ -80,8 +78,7 @@ discard block |
||
80 | 78 | * |
81 | 79 | * @return int The page's identifier |
82 | 80 | */ |
83 | - public function getId() |
|
84 | - { |
|
81 | + public function getId() { |
|
85 | 82 | return $this->id; |
86 | 83 | } |
87 | 84 | |
@@ -92,8 +89,7 @@ discard block |
||
92 | 89 | * |
93 | 90 | * @return string The page's name |
94 | 91 | */ |
95 | - public function getName() |
|
96 | - { |
|
92 | + public function getName() { |
|
97 | 93 | return $this->name; |
98 | 94 | } |
99 | 95 | |
@@ -104,8 +100,7 @@ discard block |
||
104 | 100 | * |
105 | 101 | * @return int The page's width |
106 | 102 | */ |
107 | - public function getWidth() |
|
108 | - { |
|
103 | + public function getWidth() { |
|
109 | 104 | return $this->width; |
110 | 105 | } |
111 | 106 | |
@@ -116,8 +111,7 @@ discard block |
||
116 | 111 | * |
117 | 112 | * @return int The page's height |
118 | 113 | */ |
119 | - public function getHeight() |
|
120 | - { |
|
114 | + public function getHeight() { |
|
121 | 115 | return $this->height; |
122 | 116 | } |
123 | 117 | } |
@@ -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(); |
@@ -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 | * |
@@ -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 |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $startingPoint = $this->getStartingPoint($input->getOption('pid')); |
104 | 104 | |
105 | 105 | if ($startingPoint == 0) { |
106 | - $io->error('ERROR: No valid PID (' . $startingPoint . ') given.'); |
|
106 | + $io->error('ERROR: No valid PID ('.$startingPoint.') given.'); |
|
107 | 107 | exit(1); |
108 | 108 | } |
109 | 109 | |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) { |
119 | 119 | $output_solrCores = []; |
120 | 120 | foreach ($allSolrCores as $index_name => $uid) { |
121 | - $output_solrCores[] = $uid . ' : ' . $index_name; |
|
121 | + $output_solrCores[] = $uid.' : '.$index_name; |
|
122 | 122 | } |
123 | 123 | if (empty($output_solrCores)) { |
124 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $startingPoint . ".\n"); |
|
124 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$startingPoint.".\n"); |
|
125 | 125 | exit(1); |
126 | 126 | } else { |
127 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $output_solrCores) . "\n"); |
|
127 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $output_solrCores)."\n"); |
|
128 | 128 | exit(1); |
129 | 129 | } |
130 | 130 | } |
@@ -165,18 +165,18 @@ discard block |
||
165 | 165 | $doc = Document::getInstance($document, $startingPoint, true); |
166 | 166 | if ($doc->ready) { |
167 | 167 | if ($dryRun) { |
168 | - $io->writeln('DRY RUN: Would index ' . $id . '/' . count($documents) . ' ' . $doc->uid . ' ("' . $doc->location . '") on PID ' . $startingPoint . ' and Solr core ' . $solrCoreUid . '.'); |
|
168 | + $io->writeln('DRY RUN: Would index '.$id.'/'.count($documents).' '.$doc->uid.' ("'.$doc->location.'") on PID '.$startingPoint.' and Solr core '.$solrCoreUid.'.'); |
|
169 | 169 | } else { |
170 | 170 | if ($io->isVerbose()) { |
171 | - $io->writeln(date('Y-m-d H:i:s') . ' Indexing ' . $id . '/' . count($documents) . ' ' . $doc->uid . ' ("' . $doc->location . '") on PID ' . $startingPoint . ' and Solr core ' . $solrCoreUid . '.'); |
|
171 | + $io->writeln(date('Y-m-d H:i:s').' Indexing '.$id.'/'.count($documents).' '.$doc->uid.' ("'.$doc->location.'") on PID '.$startingPoint.' and Solr core '.$solrCoreUid.'.'); |
|
172 | 172 | } |
173 | 173 | // ...and save it to the database... |
174 | 174 | if (!$doc->save($startingPoint, $solrCoreUid, $owner)) { |
175 | - $io->error('ERROR: Document "' . $id . '" not saved and indexed.'); |
|
175 | + $io->error('ERROR: Document "'.$id.'" not saved and indexed.'); |
|
176 | 176 | } |
177 | 177 | } |
178 | 178 | } else { |
179 | - $io->error('ERROR: Document "' . $id . '" could not be loaded.'); |
|
179 | + $io->error('ERROR: Document "'.$id.'" could not be loaded.'); |
|
180 | 180 | } |
181 | 181 | // Clear document registry to prevent memory exhaustion. |
182 | 182 | Document::clearRegistry(); |
@@ -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 | ) |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | // Make sure the _cli_ user is loaded |
96 | 96 | Bootstrap::getInstance()->initializeBackendAuthentication(); |
97 | 97 | |
98 | - $dryRun = $input->getOption('dry-run') != false ? true : false; |
|
98 | + $dryRun = $input->getOption('dry-run') != FALSE ? TRUE : FALSE; |
|
99 | 99 | |
100 | 100 | $io = new SymfonyStyle($input, $output); |
101 | 101 | $io->title($this->getDescription()); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $owner = (string) $input->getOption('owner'); |
141 | 141 | } |
142 | 142 | } else { |
143 | - $owner = null; |
|
143 | + $owner = NULL; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | if (!empty($input->getOption('all'))) { |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | && !is_array($input->getOption('coll')) |
152 | 152 | ) { |
153 | 153 | // "coll" may be a single integer or a comma-separated list of integers. |
154 | - if (empty(array_filter(GeneralUtility::intExplode(',', $input->getOption('coll'), true)))) { |
|
154 | + if (empty(array_filter(GeneralUtility::intExplode(',', $input->getOption('coll'), TRUE)))) { |
|
155 | 155 | $io->error('ERROR: Parameter --coll|-c is not a valid comma-separated list of collection UIDs.'); |
156 | 156 | exit(1); |
157 | 157 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | } |
163 | 163 | |
164 | 164 | foreach ($documents as $id => $document) { |
165 | - $doc = Document::getInstance($document, $startingPoint, true); |
|
165 | + $doc = Document::getInstance($document, $startingPoint, TRUE); |
|
166 | 166 | if ($doc->ready) { |
167 | 167 | if ($dryRun) { |
168 | 168 | $io->writeln('DRY RUN: Would index ' . $id . '/' . count($documents) . ' ' . $doc->uid . ' ("' . $doc->location . '") on PID ' . $startingPoint . ' and Solr core ' . $solrCoreUid . '.'); |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $queryBuilder->expr()->in( |
226 | 226 | 'tx_dlf_collections_join.uid', |
227 | 227 | $queryBuilder->createNamedParameter( |
228 | - GeneralUtility::intExplode(',', $collIds, true), |
|
228 | + GeneralUtility::intExplode(',', $collIds, TRUE), |
|
229 | 229 | Connection::PARAM_INT_ARRAY |
230 | 230 | ) |
231 | 231 | ), |
@@ -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 |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $startingPoint = $this->getStartingPoint($input->getOption('pid')); |
96 | 96 | |
97 | 97 | if ($startingPoint == 0) { |
98 | - $io->error('ERROR: No valid PID (' . $startingPoint . ') given.'); |
|
98 | + $io->error('ERROR: No valid PID ('.$startingPoint.') given.'); |
|
99 | 99 | exit(1); |
100 | 100 | } |
101 | 101 | |
@@ -110,13 +110,13 @@ discard block |
||
110 | 110 | if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) { |
111 | 111 | $output_solrCores = []; |
112 | 112 | foreach ($allSolrCores as $index_name => $uid) { |
113 | - $output_solrCores[] = $uid . ' : ' . $index_name; |
|
113 | + $output_solrCores[] = $uid.' : '.$index_name; |
|
114 | 114 | } |
115 | 115 | if (empty($output_solrCores)) { |
116 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $startingPoint . ".\n"); |
|
116 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$startingPoint.".\n"); |
|
117 | 117 | exit(1); |
118 | 118 | } else { |
119 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $output_solrCores) . "\n"); |
|
119 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $output_solrCores)."\n"); |
|
120 | 120 | exit(1); |
121 | 121 | } |
122 | 122 | } |
@@ -151,19 +151,19 @@ discard block |
||
151 | 151 | $doc = Document::getInstance($input->getOption('doc'), $startingPoint, true); |
152 | 152 | if ($doc->ready) { |
153 | 153 | if ($dryRun) { |
154 | - $io->section('DRY RUN: Would index ' . $doc->uid . ' ("' . $doc->location . '") on PID ' . $startingPoint . ' and Solr core ' . $solrCoreUid . '.'); |
|
154 | + $io->section('DRY RUN: Would index '.$doc->uid.' ("'.$doc->location.'") on PID '.$startingPoint.' and Solr core '.$solrCoreUid.'.'); |
|
155 | 155 | } else { |
156 | 156 | if ($io->isVerbose()) { |
157 | - $io->section('Indexing ' . $doc->uid . ' ("' . $doc->location . '") on PID ' . $startingPoint . ' and Solr core ' . $solrCoreUid . '.'); |
|
157 | + $io->section('Indexing '.$doc->uid.' ("'.$doc->location.'") on PID '.$startingPoint.' and Solr core '.$solrCoreUid.'.'); |
|
158 | 158 | } |
159 | 159 | // ...and save it to the database... |
160 | 160 | if (!$doc->save($startingPoint, $solrCoreUid, $owner)) { |
161 | - $io->error('ERROR: Document "' . $input->getOption('doc') . '" not saved and indexed.'); |
|
161 | + $io->error('ERROR: Document "'.$input->getOption('doc').'" not saved and indexed.'); |
|
162 | 162 | exit(1); |
163 | 163 | } |
164 | 164 | } |
165 | 165 | } else { |
166 | - $io->error('ERROR: Document "' . $input->getOption('doc') . '" could not be loaded.'); |
|
166 | + $io->error('ERROR: Document "'.$input->getOption('doc').'" could not be loaded.'); |
|
167 | 167 | exit(1); |
168 | 168 | } |
169 | 169 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | ->setHelp('') |
45 | 45 | ->addOption( |
46 | 46 | 'dry-run', |
47 | - null, |
|
47 | + NULL, |
|
48 | 48 | InputOption::VALUE_NONE, |
49 | 49 | 'If this option is set, the files will not actually be processed but the location URI is shown.' |
50 | 50 | ) |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | // Make sure the _cli_ user is loaded |
88 | 88 | Bootstrap::getInstance()->initializeBackendAuthentication(); |
89 | 89 | |
90 | - $dryRun = $input->getOption('dry-run') != false ? true : false; |
|
90 | + $dryRun = $input->getOption('dry-run') != FALSE ? TRUE : FALSE; |
|
91 | 91 | |
92 | 92 | $io = new SymfonyStyle($input, $output); |
93 | 93 | $io->title($this->getDescription()); |
@@ -144,11 +144,11 @@ discard block |
||
144 | 144 | $owner = (string) $input->getOption('owner'); |
145 | 145 | } |
146 | 146 | } else { |
147 | - $owner = null; |
|
147 | + $owner = NULL; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | // Get the document... |
151 | - $doc = Document::getInstance($input->getOption('doc'), $startingPoint, true); |
|
151 | + $doc = Document::getInstance($input->getOption('doc'), $startingPoint, TRUE); |
|
152 | 152 | if ($doc->ready) { |
153 | 153 | if ($dryRun) { |
154 | 154 | $io->section('DRY RUN: Would index ' . $doc->uid . ' ("' . $doc->location . '") on PID ' . $startingPoint . ' and Solr core ' . $solrCoreUid . '.'); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $startingPoint = MathUtility::forceIntegerInRange((int) $input->getOption('pid'), 0); |
114 | 114 | } |
115 | 115 | if ($startingPoint == 0) { |
116 | - $io->error('ERROR: No valid PID (' . $startingPoint . ') given.'); |
|
116 | + $io->error('ERROR: No valid PID ('.$startingPoint.') given.'); |
|
117 | 117 | exit(1); |
118 | 118 | } |
119 | 119 | |
@@ -131,13 +131,13 @@ discard block |
||
131 | 131 | if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) { |
132 | 132 | $output_solrCores = []; |
133 | 133 | foreach ($allSolrCores as $index_name => $uid) { |
134 | - $output_solrCores[] = $uid . ' : ' . $index_name; |
|
134 | + $output_solrCores[] = $uid.' : '.$index_name; |
|
135 | 135 | } |
136 | 136 | if (empty($output_solrCores)) { |
137 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $startingPoint . ".\n"); |
|
137 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$startingPoint.".\n"); |
|
138 | 138 | exit(1); |
139 | 139 | } else { |
140 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $output_solrCores) . "\n"); |
|
140 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $output_solrCores)."\n"); |
|
141 | 141 | exit(1); |
142 | 142 | } |
143 | 143 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | exit(1); |
174 | 174 | } |
175 | 175 | if (!GeneralUtility::isValidUrl($baseUrl)) { |
176 | - $io->error('ERROR: No valid OAI Base URL set for library with given UID ("' . $input->getOption('lib') . '").'); |
|
176 | + $io->error('ERROR: No valid OAI Base URL set for library with given UID ("'.$input->getOption('lib').'").'); |
|
177 | 177 | exit(1); |
178 | 178 | } else { |
179 | 179 | try { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | } |
215 | 215 | } |
216 | 216 | if (empty($set)) { |
217 | - $io->error('ERROR: OAI interface does not provide a set with given setSpec ("' . $input->getOption('set') . '").'); |
|
217 | + $io->error('ERROR: OAI interface does not provide a set with given setSpec ("'.$input->getOption('set').'").'); |
|
218 | 218 | exit(1); |
219 | 219 | } |
220 | 220 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | } |
228 | 228 | |
229 | 229 | // Process all identifiers. |
230 | - $baseLocation = $baseUrl . (parse_url($baseUrl, PHP_URL_QUERY) ? '&' : '?'); |
|
230 | + $baseLocation = $baseUrl.(parse_url($baseUrl, PHP_URL_QUERY) ? '&' : '?'); |
|
231 | 231 | foreach ($identifiers as $identifier) { |
232 | 232 | // Build OAI GetRecord URL... |
233 | 233 | $params = [ |
@@ -235,23 +235,23 @@ discard block |
||
235 | 235 | 'metadataPrefix' => 'mets', |
236 | 236 | 'identifier' => (string) $identifier->identifier |
237 | 237 | ]; |
238 | - $docLocation = $baseLocation . http_build_query($params); |
|
238 | + $docLocation = $baseLocation.http_build_query($params); |
|
239 | 239 | // ...index the document... |
240 | 240 | $doc = Document::getInstance($docLocation, $startingPoint, true); |
241 | 241 | if ($doc->ready) { |
242 | 242 | if ($dryRun) { |
243 | - $io->writeln('DRY RUN: Would index ' . $doc->uid . ' ("' . $doc->location . '") on PID ' . $startingPoint . ' and Solr core ' . $solrCoreUid . '.'); |
|
243 | + $io->writeln('DRY RUN: Would index '.$doc->uid.' ("'.$doc->location.'") on PID '.$startingPoint.' and Solr core '.$solrCoreUid.'.'); |
|
244 | 244 | } else { |
245 | 245 | if ($io->isVerbose()) { |
246 | - $io->writeln(date('Y-m-d H:i:s') . ' Indexing ' . $doc->uid . ' ("' . $doc->location . '") on PID ' . $startingPoint . ' and Solr core ' . $solrCoreUid . '.'); |
|
246 | + $io->writeln(date('Y-m-d H:i:s').' Indexing '.$doc->uid.' ("'.$doc->location.'") on PID '.$startingPoint.' and Solr core '.$solrCoreUid.'.'); |
|
247 | 247 | } |
248 | 248 | // ...and save it to the database... |
249 | 249 | if (!$doc->save($startingPoint, $solrCoreUid, (int) $input->getOption('lib'))) { |
250 | - $io->error('ERROR: Document "' . $doc->location . '" not saved and indexed.'); |
|
250 | + $io->error('ERROR: Document "'.$doc->location.'" not saved and indexed.'); |
|
251 | 251 | } |
252 | 252 | } |
253 | 253 | } else { |
254 | - $io->error('ERROR: Document "' . $docLocation . '" could not be loaded.'); |
|
254 | + $io->error('ERROR: Document "'.$docLocation.'" could not be loaded.'); |
|
255 | 255 | } |
256 | 256 | // Clear document registry to prevent memory exhaustion. |
257 | 257 | Document::clearRegistry(); |
@@ -270,6 +270,6 @@ discard block |
||
270 | 270 | */ |
271 | 271 | protected function handleOaiError(BaseoaipmhException $exception, SymfonyStyle $io) |
272 | 272 | { |
273 | - $io->error('ERROR: Trying to retrieve data from OAI interface resulted in error:' . "\n " . $exception->getMessage()); |
|
273 | + $io->error('ERROR: Trying to retrieve data from OAI interface resulted in error:'."\n ".$exception->getMessage()); |
|
274 | 274 | } |
275 | 275 | } |
@@ -34,15 +34,13 @@ discard block |
||
34 | 34 | * @subpackage dlf |
35 | 35 | * @access public |
36 | 36 | */ |
37 | -class HarvestCommand extends BaseCommand |
|
38 | -{ |
|
37 | +class HarvestCommand extends BaseCommand { |
|
39 | 38 | /** |
40 | 39 | * Configure the command by defining the name, options and arguments |
41 | 40 | * |
42 | 41 | * @return void |
43 | 42 | */ |
44 | - public function configure() |
|
45 | - { |
|
43 | + public function configure() { |
|
46 | 44 | $this |
47 | 45 | ->setDescription('Harvest OAI-PMH contents into database and Solr.') |
48 | 46 | ->setHelp('') |
@@ -98,8 +96,7 @@ discard block |
||
98 | 96 | * |
99 | 97 | * @return void |
100 | 98 | */ |
101 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
102 | - { |
|
99 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
103 | 100 | // Make sure the _cli_ user is loaded |
104 | 101 | Bootstrap::getInstance()->initializeBackendAuthentication(); |
105 | 102 | |
@@ -268,8 +265,7 @@ discard block |
||
268 | 265 | * |
269 | 266 | * @return void |
270 | 267 | */ |
271 | - protected function handleOaiError(BaseoaipmhException $exception, SymfonyStyle $io) |
|
272 | - { |
|
268 | + protected function handleOaiError(BaseoaipmhException $exception, SymfonyStyle $io) { |
|
273 | 269 | $io->error('ERROR: Trying to retrieve data from OAI interface resulted in error:' . "\n " . $exception->getMessage()); |
274 | 270 | } |
275 | 271 | } |
@@ -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 URIs are shown.' |
54 | 54 | ) |
@@ -72,19 +72,19 @@ discard block |
||
72 | 72 | ) |
73 | 73 | ->addOption( |
74 | 74 | 'from', |
75 | - null, |
|
75 | + NULL, |
|
76 | 76 | InputOption::VALUE_OPTIONAL, |
77 | 77 | 'Datestamp (YYYY-MM-DD) to begin harvesting from.' |
78 | 78 | ) |
79 | 79 | ->addOption( |
80 | 80 | 'until', |
81 | - null, |
|
81 | + NULL, |
|
82 | 82 | InputOption::VALUE_OPTIONAL, |
83 | 83 | 'Datestamp (YYYY-MM-DD) to end harvesting on.' |
84 | 84 | ) |
85 | 85 | ->addOption( |
86 | 86 | 'set', |
87 | - null, |
|
87 | + NULL, |
|
88 | 88 | InputOption::VALUE_OPTIONAL, |
89 | 89 | 'Name of the set to limit harvesting to.' |
90 | 90 | ); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | // Make sure the _cli_ user is loaded |
104 | 104 | Bootstrap::getInstance()->initializeBackendAuthentication(); |
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()); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | ) { |
190 | 190 | $from = new \DateTime($input->getOption('from')); |
191 | 191 | } else { |
192 | - $from = null; |
|
192 | + $from = NULL; |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | if ( |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | ) { |
199 | 199 | $until = new \DateTime($input->getOption('until')); |
200 | 200 | } else { |
201 | - $until = null; |
|
201 | + $until = NULL; |
|
202 | 202 | } |
203 | 203 | |
204 | - $set = null; |
|
204 | + $set = NULL; |
|
205 | 205 | if ( |
206 | 206 | !is_array($input->getOption('set')) |
207 | 207 | && !empty($input->getOption('set')) |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | ]; |
238 | 238 | $docLocation = $baseLocation . http_build_query($params); |
239 | 239 | // ...index the document... |
240 | - $doc = Document::getInstance($docLocation, $startingPoint, true); |
|
240 | + $doc = Document::getInstance($docLocation, $startingPoint, TRUE); |
|
241 | 241 | if ($doc->ready) { |
242 | 242 | if ($dryRun) { |
243 | 243 | $io->writeln('DRY RUN: Would index ' . $doc->uid . ' ("' . $doc->location . '") on PID ' . $startingPoint . ' and Solr core ' . $solrCoreUid . '.'); |