@@ -28,8 +28,7 @@ discard block |
||
28 | 28 | * @subpackage dlf |
29 | 29 | * @access public |
30 | 30 | */ |
31 | -class ConfigurationForm |
|
32 | -{ |
|
31 | +class ConfigurationForm { |
|
33 | 32 | /** |
34 | 33 | * This holds the current configuration |
35 | 34 | * |
@@ -45,8 +44,7 @@ discard block |
||
45 | 44 | * |
46 | 45 | * @return string Message informing the user of success or failure |
47 | 46 | */ |
48 | - public function checkSolrConnection() |
|
49 | - { |
|
47 | + public function checkSolrConnection() { |
|
50 | 48 | $solr = Solr::getInstance(); |
51 | 49 | if ($solr->ready) { |
52 | 50 | Helper::addMessage( |
@@ -71,8 +69,7 @@ discard block |
||
71 | 69 | * |
72 | 70 | * @return string Message informing the user of success or failure |
73 | 71 | */ |
74 | - public function checkMetadataFormats() |
|
75 | - { |
|
72 | + public function checkMetadataFormats() { |
|
76 | 73 | // We need to do some bootstrapping manually as of TYPO3 9. |
77 | 74 | // Load table configuration array into $GLOBALS['TCA']. |
78 | 75 | ExtensionManagementUtility::loadBaseTca(false); |
@@ -201,8 +198,7 @@ discard block |
||
201 | 198 | * |
202 | 199 | * @return void |
203 | 200 | */ |
204 | - public function __construct() |
|
205 | - { |
|
201 | + public function __construct() { |
|
206 | 202 | // Load localization file. |
207 | 203 | $GLOBALS['LANG']->includeLLFile('EXT:dlf/Resources/Private/Language/FlashMessages.xml'); |
208 | 204 | // Get current configuration. |
@@ -75,21 +75,21 @@ discard block |
||
75 | 75 | { |
76 | 76 | // We need to do some bootstrapping manually as of TYPO3 9. |
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. |
84 | 84 | Bootstrap::initializeBackendAuthentication(); |
85 | 85 | |
86 | 86 | $nsDefined = [ |
87 | - 'MODS' => false, |
|
88 | - 'TEIHDR' => false, |
|
89 | - 'ALTO' => false, |
|
90 | - 'IIIF1' => false, |
|
91 | - 'IIIF2' => false, |
|
92 | - 'IIIF3' => false |
|
87 | + 'MODS' => FALSE, |
|
88 | + 'TEIHDR' => FALSE, |
|
89 | + 'ALTO' => FALSE, |
|
90 | + 'IIIF1' => FALSE, |
|
91 | + 'IIIF2' => FALSE, |
|
92 | + 'IIIF3' => FALSE |
|
93 | 93 | ]; |
94 | 94 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
95 | 95 | ->getQueryBuilderForTable('tx_dlf_formats'); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | ->execute(); |
105 | 105 | |
106 | 106 | while ($resArray = $result->fetch()) { |
107 | - $nsDefined[$resArray['type']] = true; |
|
107 | + $nsDefined[$resArray['type']] = TRUE; |
|
108 | 108 | } |
109 | 109 | // Build data array. |
110 | 110 | $data = []; |
@@ -29,8 +29,7 @@ discard block |
||
29 | 29 | * @access public |
30 | 30 | * @abstract |
31 | 31 | */ |
32 | -abstract class AbstractPlugin extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin implements LoggerAwareInterface |
|
33 | -{ |
|
32 | +abstract class AbstractPlugin extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin implements LoggerAwareInterface { |
|
34 | 33 | use LoggerAwareTrait; |
35 | 34 | |
36 | 35 | public $extKey = 'dlf'; |
@@ -73,8 +72,7 @@ discard block |
||
73 | 72 | * |
74 | 73 | * @return void |
75 | 74 | */ |
76 | - protected function getTemplate($part = '###TEMPLATE###') |
|
77 | - { |
|
75 | + protected function getTemplate($part = '###TEMPLATE###') { |
|
78 | 76 | $this->templateService = GeneralUtility::makeInstance(MarkerBasedTemplateService::class); |
79 | 77 | if (!empty($this->conf['templateFile'])) { |
80 | 78 | // Load template file from configuration. |
@@ -98,8 +96,7 @@ discard block |
||
98 | 96 | * |
99 | 97 | * @return void |
100 | 98 | */ |
101 | - protected function init(array $conf) |
|
102 | - { |
|
99 | + protected function init(array $conf) { |
|
103 | 100 | // Read FlexForm configuration. |
104 | 101 | $flexFormConf = []; |
105 | 102 | $this->cObj->readFlexformIntoConf($this->cObj->data['pi_flexform'], $flexFormConf); |
@@ -137,8 +134,7 @@ discard block |
||
137 | 134 | * |
138 | 135 | * @return void |
139 | 136 | */ |
140 | - protected function loadDocument() |
|
141 | - { |
|
137 | + protected function loadDocument() { |
|
142 | 138 | // Check for required variable. |
143 | 139 | if ( |
144 | 140 | !empty($this->piVars['id']) |
@@ -209,8 +205,7 @@ discard block |
||
209 | 205 | * |
210 | 206 | * @return array The resulting typoscript array |
211 | 207 | */ |
212 | - protected function parseTS($string = '') |
|
213 | - { |
|
208 | + protected function parseTS($string = '') { |
|
214 | 209 | $parser = GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::class); |
215 | 210 | $parser->parse($string); |
216 | 211 | return $parser->setup; |
@@ -229,8 +224,7 @@ discard block |
||
229 | 224 | * |
230 | 225 | * @return string The input string wrapped in <a> tags |
231 | 226 | */ |
232 | - public function pi_linkTP($str, $urlParameters = [], $cache = false, $altPageId = 0) |
|
233 | - { |
|
227 | + public function pi_linkTP($str, $urlParameters = [], $cache = false, $altPageId = 0) { |
|
234 | 228 | $conf = []; |
235 | 229 | if (!$cache) { |
236 | 230 | $conf['no_cache'] = true; |
@@ -253,8 +247,7 @@ discard block |
||
253 | 247 | * |
254 | 248 | * @return string HTML content wrapped, ready to return to the parent object. |
255 | 249 | */ |
256 | - public function pi_wrapInBaseClass($content) |
|
257 | - { |
|
250 | + public function pi_wrapInBaseClass($content) { |
|
258 | 251 | if (!$this->frontendController->config['config']['disableWrapInBaseClass']) { |
259 | 252 | // Use class name instead of $this->prefixId for content wrapping because $this->prefixId is the same for all plugins. |
260 | 253 | $content = '<div class="tx-dlf-' . strtolower(Helper::getUnqualifiedClassName(get_class($this))) . '">' . $content . '</div>'; |
@@ -274,8 +267,7 @@ discard block |
||
274 | 267 | * |
275 | 268 | * @return void |
276 | 269 | */ |
277 | - protected function setCache($cache = true) |
|
278 | - { |
|
270 | + protected function setCache($cache = true) { |
|
279 | 271 | if ($cache) { |
280 | 272 | // Set cObject type to "USER" (default). |
281 | 273 | $this->pi_USER_INT_obj = false; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $templateFile = $this->conf['templateFile']; |
82 | 82 | } else { |
83 | 83 | // Load default template from extension. |
84 | - $templateFile = 'EXT:' . $this->extKey . '/Resources/Private/Templates/' . Helper::getUnqualifiedClassName(get_class($this)) . '.tmpl'; |
|
84 | + $templateFile = 'EXT:'.$this->extKey.'/Resources/Private/Templates/'.Helper::getUnqualifiedClassName(get_class($this)).'.tmpl'; |
|
85 | 85 | } |
86 | 86 | // Substitute strings like "EXT:" in given template file location. |
87 | 87 | $fileResource = $GLOBALS['TSFE']->tmpl->getFileName($templateFile); |
@@ -107,12 +107,12 @@ discard block |
||
107 | 107 | $conf = Helper::mergeRecursiveWithOverrule($flexFormConf, $conf); |
108 | 108 | } |
109 | 109 | // Read plugin TS configuration. |
110 | - $pluginConf = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_dlf_' . strtolower(Helper::getUnqualifiedClassName(get_class($this))) . '.']; |
|
110 | + $pluginConf = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_dlf_'.strtolower(Helper::getUnqualifiedClassName(get_class($this))).'.']; |
|
111 | 111 | if (is_array($pluginConf)) { |
112 | 112 | $conf = Helper::mergeRecursiveWithOverrule($pluginConf, $conf); |
113 | 113 | } |
114 | 114 | // Read general TS configuration. |
115 | - $generalConf = $GLOBALS['TSFE']->tmpl->setup['plugin.'][$this->prefixId . '.']; |
|
115 | + $generalConf = $GLOBALS['TSFE']->tmpl->setup['plugin.'][$this->prefixId.'.']; |
|
116 | 116 | if (is_array($generalConf)) { |
117 | 117 | $conf = Helper::mergeRecursiveWithOverrule($generalConf, $conf); |
118 | 118 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | // Set default plugin variables. |
128 | 128 | $this->pi_setPiVarDefaults(); |
129 | 129 | // Load translation files. |
130 | - $this->pi_loadLL('EXT:' . $this->extKey . '/Resources/Private/Language/' . Helper::getUnqualifiedClassName(get_class($this)) . '.xml'); |
|
130 | + $this->pi_loadLL('EXT:'.$this->extKey.'/Resources/Private/Language/'.Helper::getUnqualifiedClassName(get_class($this)).'.xml'); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | if (!$this->doc->ready) { |
152 | 152 | // Destroy the incomplete object. |
153 | 153 | $this->doc = null; |
154 | - $this->logger->error('Failed to load document with UID ' . $this->piVars['id']); |
|
154 | + $this->logger->error('Failed to load document with UID '.$this->piVars['id']); |
|
155 | 155 | } else { |
156 | 156 | // Set configuration PID. |
157 | 157 | $this->doc->cPid = $this->conf['pages']; |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | // Try to load document. |
180 | 180 | $this->loadDocument(); |
181 | 181 | } else { |
182 | - $this->logger->error('Failed to load document with record ID "' . $this->piVars['recordId'] . '"'); |
|
182 | + $this->logger->error('Failed to load document with record ID "'.$this->piVars['recordId'].'"'); |
|
183 | 183 | } |
184 | 184 | } else { |
185 | - $this->logger->error('Invalid UID ' . $this->piVars['id'] . ' or PID ' . $this->conf['pages'] . ' for document loading'); |
|
185 | + $this->logger->error('Invalid UID '.$this->piVars['id'].' or PID '.$this->conf['pages'].' for document loading'); |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | $conf['no_cache'] = true; |
237 | 237 | } |
238 | 238 | $conf['parameter'] = $altPageId ? : ($this->pi_tmpPageId ? : 'current'); |
239 | - $conf['additionalParams'] = $this->conf['parent.']['addParams'] . HttpUtility::buildQueryString($urlParameters, '&', true) . $this->pi_moreParams; |
|
239 | + $conf['additionalParams'] = $this->conf['parent.']['addParams'].HttpUtility::buildQueryString($urlParameters, '&', true).$this->pi_moreParams; |
|
240 | 240 | // Add additional configuration for absolute URLs. |
241 | 241 | $conf['forceAbsoluteUrl'] = !empty($this->conf['forceAbsoluteUrl']) ? 1 : 0; |
242 | 242 | $conf['forceAbsoluteUrl.']['scheme'] = !empty($this->conf['forceAbsoluteUrl']) && !empty($this->conf['forceAbsoluteUrlHttps']) ? 'https' : 'http'; |
@@ -257,9 +257,9 @@ discard block |
||
257 | 257 | { |
258 | 258 | if (!$this->frontendController->config['config']['disableWrapInBaseClass']) { |
259 | 259 | // Use class name instead of $this->prefixId for content wrapping because $this->prefixId is the same for all plugins. |
260 | - $content = '<div class="tx-dlf-' . strtolower(Helper::getUnqualifiedClassName(get_class($this))) . '">' . $content . '</div>'; |
|
260 | + $content = '<div class="tx-dlf-'.strtolower(Helper::getUnqualifiedClassName(get_class($this))).'">'.$content.'</div>'; |
|
261 | 261 | if (!$this->frontendController->config['config']['disablePrefixComment']) { |
262 | - $content = "\n\n<!-- BEGIN: Content of extension '" . $this->extKey . "', plugin '" . Helper::getUnqualifiedClassName(get_class($this)) . "' -->\n\n" . $content . "\n\n<!-- END: Content of extension '" . $this->extKey . "', plugin '" . Helper::getUnqualifiedClassName(get_class($this)) . "' -->\n\n"; |
|
262 | + $content = "\n\n<!-- BEGIN: Content of extension '".$this->extKey."', plugin '".Helper::getUnqualifiedClassName(get_class($this))."' -->\n\n".$content."\n\n<!-- END: Content of extension '".$this->extKey."', plugin '".Helper::getUnqualifiedClassName(get_class($this))."' -->\n\n"; |
|
263 | 263 | } |
264 | 264 | } |
265 | 265 | return $content; |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | public $prefixId = 'tx_dlf'; |
38 | 38 | public $scriptRelPath = 'Classes/Common/AbstractPlugin.php'; |
39 | 39 | // Plugins are cached by default (@see setCache()). |
40 | - public $pi_USER_INT_obj = false; |
|
41 | - public $pi_checkCHash = true; |
|
40 | + public $pi_USER_INT_obj = FALSE; |
|
41 | + public $pi_checkCHash = TRUE; |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * This holds the current document |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $this->doc = Document::getInstance($this->piVars['id'], $pid); |
151 | 151 | if (!$this->doc->ready) { |
152 | 152 | // Destroy the incomplete object. |
153 | - $this->doc = null; |
|
153 | + $this->doc = NULL; |
|
154 | 154 | $this->logger->error('Failed to load document with UID ' . $this->piVars['id']); |
155 | 155 | } else { |
156 | 156 | // Set configuration PID. |
@@ -229,14 +229,14 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @return string The input string wrapped in <a> tags |
231 | 231 | */ |
232 | - public function pi_linkTP($str, $urlParameters = [], $cache = false, $altPageId = 0) |
|
232 | + public function pi_linkTP($str, $urlParameters = [], $cache = FALSE, $altPageId = 0) |
|
233 | 233 | { |
234 | 234 | $conf = []; |
235 | 235 | if (!$cache) { |
236 | - $conf['no_cache'] = true; |
|
236 | + $conf['no_cache'] = TRUE; |
|
237 | 237 | } |
238 | 238 | $conf['parameter'] = $altPageId ? : ($this->pi_tmpPageId ? : 'current'); |
239 | - $conf['additionalParams'] = $this->conf['parent.']['addParams'] . HttpUtility::buildQueryString($urlParameters, '&', true) . $this->pi_moreParams; |
|
239 | + $conf['additionalParams'] = $this->conf['parent.']['addParams'] . HttpUtility::buildQueryString($urlParameters, '&', TRUE) . $this->pi_moreParams; |
|
240 | 240 | // Add additional configuration for absolute URLs. |
241 | 241 | $conf['forceAbsoluteUrl'] = !empty($this->conf['forceAbsoluteUrl']) ? 1 : 0; |
242 | 242 | $conf['forceAbsoluteUrl.']['scheme'] = !empty($this->conf['forceAbsoluteUrl']) && !empty($this->conf['forceAbsoluteUrlHttps']) ? 'https' : 'http'; |
@@ -274,20 +274,20 @@ discard block |
||
274 | 274 | * |
275 | 275 | * @return void |
276 | 276 | */ |
277 | - protected function setCache($cache = true) |
|
277 | + protected function setCache($cache = TRUE) |
|
278 | 278 | { |
279 | 279 | if ($cache) { |
280 | 280 | // Set cObject type to "USER" (default). |
281 | - $this->pi_USER_INT_obj = false; |
|
282 | - $this->pi_checkCHash = true; |
|
281 | + $this->pi_USER_INT_obj = FALSE; |
|
282 | + $this->pi_checkCHash = TRUE; |
|
283 | 283 | if (count($this->piVars)) { |
284 | 284 | // Check cHash or disable caching. |
285 | 285 | $GLOBALS['TSFE']->reqCHash(); |
286 | 286 | } |
287 | 287 | } else { |
288 | 288 | // Set cObject type to "USER_INT". |
289 | - $this->pi_USER_INT_obj = true; |
|
290 | - $this->pi_checkCHash = false; |
|
289 | + $this->pi_USER_INT_obj = TRUE; |
|
290 | + $this->pi_checkCHash = FALSE; |
|
291 | 291 | // Plugins are of type "USER" by default, so convert it to "USER_INT". |
292 | 292 | $this->cObj->convertToUserIntObject(); |
293 | 293 | } |
@@ -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 | } |
@@ -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(); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | { |
135 | 135 | // Get next available core name if none given. |
136 | 136 | if (empty($core)) { |
137 | - $core = 'dlfCore' . self::getNextCoreNumber(); |
|
137 | + $core = 'dlfCore'.self::getNextCoreNumber(); |
|
138 | 138 | } |
139 | 139 | // Get Solr service instance. |
140 | 140 | $solr = self::getInstance($core); |
@@ -230,13 +230,13 @@ discard block |
||
230 | 230 | ->execute(); |
231 | 231 | |
232 | 232 | while ($resArray = $result->fetch()) { |
233 | - $fields[] = $resArray['index_name'] . '_' . ($resArray['index_tokenized'] ? 't' : 'u') . ($resArray['index_stored'] ? 's' : 'u') . 'i'; |
|
233 | + $fields[] = $resArray['index_name'].'_'.($resArray['index_tokenized'] ? 't' : 'u').($resArray['index_stored'] ? 's' : 'u').'i'; |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | // Check if queried field is valid. |
237 | 237 | $splitQuery = explode(':', $query, 2); |
238 | 238 | if (in_array($splitQuery[0], $fields)) { |
239 | - $query = $splitQuery[0] . ':(' . self::escapeQuery(trim($splitQuery[1], '()')) . ')'; |
|
239 | + $query = $splitQuery[0].':('.self::escapeQuery(trim($splitQuery[1], '()')).')'; |
|
240 | 240 | } else { |
241 | 241 | $query = self::escapeQuery($query); |
242 | 242 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | { |
344 | 344 | $number = max(intval($number), 0); |
345 | 345 | // Check if core already exists. |
346 | - $solr = self::getInstance('dlfCore' . $number); |
|
346 | + $solr = self::getInstance('dlfCore'.$number); |
|
347 | 347 | if (!$solr->ready) { |
348 | 348 | return $number; |
349 | 349 | } else { |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | // Set filter query to just get toplevel documents. |
419 | 419 | $params['filterquery'][] = ['query' => 'toplevel:true']; |
420 | 420 | // Set join query to get all documents with the same uids. |
421 | - $params['query'] = '{!join from=uid to=uid}' . $params['query']; |
|
421 | + $params['query'] = '{!join from=uid to=uid}'.$params['query']; |
|
422 | 422 | // Perform search to determine the total number of toplevel hits and fetch the required rows. |
423 | 423 | $selectQuery = $this->service->createSelect($params); |
424 | 424 | $results = $this->service->select($selectQuery); |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | // Set query. |
476 | 476 | $parameters['query'] = $query; |
477 | 477 | // Calculate cache identifier. |
478 | - $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), true)); |
|
478 | + $cacheIdentifier = Helper::digest($this->core.print_r(array_merge($this->params, $parameters), true)); |
|
479 | 479 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
480 | 480 | $resultSet = []; |
481 | 481 | if (($entry = $cache->get($cacheIdentifier)) === false) { |
@@ -606,12 +606,12 @@ discard block |
||
606 | 606 | */ |
607 | 607 | public function __get($var) |
608 | 608 | { |
609 | - $method = '_get' . ucfirst($var); |
|
609 | + $method = '_get'.ucfirst($var); |
|
610 | 610 | if ( |
611 | 611 | !property_exists($this, $var) |
612 | 612 | || !method_exists($this, $method) |
613 | 613 | ) { |
614 | - $this->logger->warning('There is no getter function for property "' . $var . '"'); |
|
614 | + $this->logger->warning('There is no getter function for property "'.$var.'"'); |
|
615 | 615 | return; |
616 | 616 | } else { |
617 | 617 | return $this->$method(); |
@@ -644,12 +644,12 @@ discard block |
||
644 | 644 | */ |
645 | 645 | public function __set($var, $value) |
646 | 646 | { |
647 | - $method = '_set' . ucfirst($var); |
|
647 | + $method = '_set'.ucfirst($var); |
|
648 | 648 | if ( |
649 | 649 | !property_exists($this, $var) |
650 | 650 | || !method_exists($this, $method) |
651 | 651 | ) { |
652 | - $this->logger->warning('There is no setter function for property "' . $var . '"'); |
|
652 | + $this->logger->warning('There is no setter function for property "'.$var.'"'); |
|
653 | 653 | } else { |
654 | 654 | $this->$method($value); |
655 | 655 | } |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | 'scheme' => $this->config['scheme'], |
687 | 687 | 'host' => $this->config['host'], |
688 | 688 | 'port' => $this->config['port'], |
689 | - 'path' => '/' . $this->config['path'], |
|
689 | + 'path' => '/'.$this->config['path'], |
|
690 | 690 | 'core' => $core, |
691 | 691 | 'username' => $this->config['username'], |
692 | 692 | 'password' => $this->config['password'], |
@@ -37,8 +37,7 @@ discard block |
||
37 | 37 | * @property-read bool $ready Is the Solr service instantiated successfully? |
38 | 38 | * @property-read \Solarium\Client $service This holds the Solr service object |
39 | 39 | */ |
40 | -class Solr implements LoggerAwareInterface |
|
41 | -{ |
|
40 | +class Solr implements LoggerAwareInterface { |
|
42 | 41 | use LoggerAwareTrait; |
43 | 42 | |
44 | 43 | /** |
@@ -130,8 +129,7 @@ discard block |
||
130 | 129 | * |
131 | 130 | * @return string The name of the new core |
132 | 131 | */ |
133 | - public static function createCore($core = '') |
|
134 | - { |
|
132 | + public static function createCore($core = '') { |
|
135 | 133 | // Get next available core name if none given. |
136 | 134 | if (empty($core)) { |
137 | 135 | $core = 'dlfCore' . self::getNextCoreNumber(); |
@@ -178,8 +176,7 @@ discard block |
||
178 | 176 | * |
179 | 177 | * @return string The escaped query string |
180 | 178 | */ |
181 | - public static function escapeQuery($query) |
|
182 | - { |
|
179 | + public static function escapeQuery($query) { |
|
183 | 180 | $helper = GeneralUtility::makeInstance(\Solarium\Core\Query\Helper::class); |
184 | 181 | // Escape query phrase or term. |
185 | 182 | if (preg_match('/^".*"$/', $query)) { |
@@ -202,8 +199,7 @@ discard block |
||
202 | 199 | * |
203 | 200 | * @return string The escaped query string |
204 | 201 | */ |
205 | - public static function escapeQueryKeepField($query, $pid) |
|
206 | - { |
|
202 | + public static function escapeQueryKeepField($query, $pid) { |
|
207 | 203 | // Is there a field query? |
208 | 204 | if (preg_match('/^[[:alnum:]]+_[tu][su]i:\(?.*\)?$/', $query)) { |
209 | 205 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
@@ -253,8 +249,7 @@ discard block |
||
253 | 249 | * |
254 | 250 | * @return array fields |
255 | 251 | */ |
256 | - public static function getFields() |
|
257 | - { |
|
252 | + public static function getFields() { |
|
258 | 253 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
259 | 254 | |
260 | 255 | $fields = []; |
@@ -296,8 +291,7 @@ discard block |
||
296 | 291 | * |
297 | 292 | * @return \Kitodo\Dlf\Common\Solr Instance of this class |
298 | 293 | */ |
299 | - public static function getInstance($core = null) |
|
300 | - { |
|
294 | + public static function getInstance($core = null) { |
|
301 | 295 | // Get core name if UID is given. |
302 | 296 | if (MathUtility::canBeInterpretedAsInteger($core)) { |
303 | 297 | $core = Helper::getIndexNameFromUid($core, 'tx_dlf_solrcores'); |
@@ -337,8 +331,7 @@ discard block |
||
337 | 331 | * |
338 | 332 | * @return int First unused core number found |
339 | 333 | */ |
340 | - public static function getNextCoreNumber($number = 0) |
|
341 | - { |
|
334 | + public static function getNextCoreNumber($number = 0) { |
|
342 | 335 | $number = max(intval($number), 0); |
343 | 336 | // Check if core already exists. |
344 | 337 | $solr = self::getInstance('dlfCore' . $number); |
@@ -356,8 +349,7 @@ discard block |
||
356 | 349 | * |
357 | 350 | * @return void |
358 | 351 | */ |
359 | - protected function loadSolrConnectionInfo() |
|
360 | - { |
|
352 | + protected function loadSolrConnectionInfo() { |
|
361 | 353 | if (empty($this->config)) { |
362 | 354 | $config = []; |
363 | 355 | // Extract extension configuration. |
@@ -395,8 +387,7 @@ discard block |
||
395 | 387 | * |
396 | 388 | * @return \Kitodo\Dlf\Common\DocumentList The result list |
397 | 389 | */ |
398 | - public function search() |
|
399 | - { |
|
390 | + public function search() { |
|
400 | 391 | $toplevel = []; |
401 | 392 | // Take over query parameters. |
402 | 393 | $params = $this->params; |
@@ -465,8 +456,7 @@ discard block |
||
465 | 456 | * |
466 | 457 | * @return array The Apache Solr Documents that were fetched |
467 | 458 | */ |
468 | - public function search_raw($query = '', $parameters = []) |
|
469 | - { |
|
459 | + public function search_raw($query = '', $parameters = []) { |
|
470 | 460 | // Set additional query parameters. |
471 | 461 | $parameters['start'] = 0; |
472 | 462 | $parameters['rows'] = $this->limit; |
@@ -498,8 +488,7 @@ discard block |
||
498 | 488 | * |
499 | 489 | * @return string|null The core name of the current query endpoint or null if core admin endpoint |
500 | 490 | */ |
501 | - protected function _getCore() |
|
502 | - { |
|
491 | + protected function _getCore() { |
|
503 | 492 | return $this->core; |
504 | 493 | } |
505 | 494 | |
@@ -510,8 +499,7 @@ discard block |
||
510 | 499 | * |
511 | 500 | * @return int The max number of results |
512 | 501 | */ |
513 | - protected function _getLimit() |
|
514 | - { |
|
502 | + protected function _getLimit() { |
|
515 | 503 | return $this->limit; |
516 | 504 | } |
517 | 505 | |
@@ -522,8 +510,7 @@ discard block |
||
522 | 510 | * |
523 | 511 | * @return int Total number of hits for last search |
524 | 512 | */ |
525 | - protected function _getNumberOfHits() |
|
526 | - { |
|
513 | + protected function _getNumberOfHits() { |
|
527 | 514 | return $this->numberOfHits; |
528 | 515 | } |
529 | 516 | |
@@ -534,8 +521,7 @@ discard block |
||
534 | 521 | * |
535 | 522 | * @return bool Is the search instantiated successfully? |
536 | 523 | */ |
537 | - protected function _getReady() |
|
538 | - { |
|
524 | + protected function _getReady() { |
|
539 | 525 | return $this->ready; |
540 | 526 | } |
541 | 527 | |
@@ -546,8 +532,7 @@ discard block |
||
546 | 532 | * |
547 | 533 | * @return \Solarium\Client Apache Solr service object |
548 | 534 | */ |
549 | - protected function _getService() |
|
550 | - { |
|
535 | + protected function _getService() { |
|
551 | 536 | return $this->service; |
552 | 537 | } |
553 | 538 | |
@@ -560,8 +545,7 @@ discard block |
||
560 | 545 | * |
561 | 546 | * @return void |
562 | 547 | */ |
563 | - protected function _setCPid($value) |
|
564 | - { |
|
548 | + protected function _setCPid($value) { |
|
565 | 549 | $this->cPid = max(intval($value), 0); |
566 | 550 | } |
567 | 551 | |
@@ -574,8 +558,7 @@ discard block |
||
574 | 558 | * |
575 | 559 | * @return void |
576 | 560 | */ |
577 | - protected function _setLimit($value) |
|
578 | - { |
|
561 | + protected function _setLimit($value) { |
|
579 | 562 | $this->limit = max(intval($value), 0); |
580 | 563 | } |
581 | 564 | |
@@ -588,8 +571,7 @@ discard block |
||
588 | 571 | * |
589 | 572 | * @return void |
590 | 573 | */ |
591 | - protected function _setParams(array $value) |
|
592 | - { |
|
574 | + protected function _setParams(array $value) { |
|
593 | 575 | $this->params = $value; |
594 | 576 | } |
595 | 577 | |
@@ -602,8 +584,7 @@ discard block |
||
602 | 584 | * |
603 | 585 | * @return mixed Value of $this->$var |
604 | 586 | */ |
605 | - public function __get($var) |
|
606 | - { |
|
587 | + public function __get($var) { |
|
607 | 588 | $method = '_get' . ucfirst($var); |
608 | 589 | if ( |
609 | 590 | !property_exists($this, $var) |
@@ -625,8 +606,7 @@ discard block |
||
625 | 606 | * |
626 | 607 | * @return bool true if variable is set and not empty, false otherwise |
627 | 608 | */ |
628 | - public function __isset($var) |
|
629 | - { |
|
609 | + public function __isset($var) { |
|
630 | 610 | return !empty($this->__get($var)); |
631 | 611 | } |
632 | 612 | |
@@ -640,8 +620,7 @@ discard block |
||
640 | 620 | * |
641 | 621 | * @return void |
642 | 622 | */ |
643 | - public function __set($var, $value) |
|
644 | - { |
|
623 | + public function __set($var, $value) { |
|
645 | 624 | $method = '_set' . ucfirst($var); |
646 | 625 | if ( |
647 | 626 | !property_exists($this, $var) |
@@ -662,8 +641,7 @@ discard block |
||
662 | 641 | * |
663 | 642 | * @return void |
664 | 643 | */ |
665 | - protected function __construct($core) |
|
666 | - { |
|
644 | + protected function __construct($core) { |
|
667 | 645 | // Get Solr connection parameters from configuration. |
668 | 646 | $this->loadSolrConnectionInfo(); |
669 | 647 | // Configure connection adapter. |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @var string|null |
56 | 56 | * @access protected |
57 | 57 | */ |
58 | - protected $core = null; |
|
58 | + protected $core = NULL; |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * This holds the PID for the configuration |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @var bool |
104 | 104 | * @access protected |
105 | 105 | */ |
106 | - protected $ready = false; |
|
106 | + protected $ready = FALSE; |
|
107 | 107 | |
108 | 108 | /** |
109 | 109 | * This holds the singleton search objects with their core as array key |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | * |
297 | 297 | * @return \Kitodo\Dlf\Common\Solr Instance of this class |
298 | 298 | */ |
299 | - public static function getInstance($core = null) |
|
299 | + public static function getInstance($core = NULL) |
|
300 | 300 | { |
301 | 301 | // Get core name if UID is given. |
302 | 302 | if (MathUtility::canBeInterpretedAsInteger($core)) { |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | // Check if core is set or null. |
306 | 306 | if ( |
307 | 307 | empty($core) |
308 | - && $core !== null |
|
308 | + && $core !== NULL |
|
309 | 309 | ) { |
310 | 310 | Helper::log('Invalid core UID or name given for Apache Solr', LOG_SEVERITY_ERROR); |
311 | 311 | } |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | 'core' => $this->core, |
448 | 448 | 'pid' => $this->cPid, |
449 | 449 | 'order' => 'score', |
450 | - 'order.asc' => true, |
|
450 | + 'order.asc' => TRUE, |
|
451 | 451 | 'numberOfHits' => $this->numberOfHits, |
452 | 452 | 'numberOfToplevelHits' => $numberOfToplevelHits |
453 | 453 | ] |
@@ -473,10 +473,10 @@ discard block |
||
473 | 473 | // Set query. |
474 | 474 | $parameters['query'] = $query; |
475 | 475 | // Calculate cache identifier. |
476 | - $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), true)); |
|
476 | + $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), TRUE)); |
|
477 | 477 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
478 | 478 | $resultSet = []; |
479 | - if (($entry = $cache->get($cacheIdentifier)) === false) { |
|
479 | + if (($entry = $cache->get($cacheIdentifier)) === FALSE) { |
|
480 | 480 | $selectQuery = $this->service->createSelect(array_merge($this->params, $parameters)); |
481 | 481 | $result = $this->service->select($selectQuery); |
482 | 482 | foreach ($result as $doc) { |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | // Check if connection is established. |
703 | 703 | $query = $this->service->createCoreAdmin(); |
704 | 704 | $action = $query->createStatus(); |
705 | - if ($core !== null) { |
|
705 | + if ($core !== NULL) { |
|
706 | 706 | $action->setCore($core); |
707 | 707 | } |
708 | 708 | $query->setAction($action); |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | $response = $this->service->coreAdmin($query); |
711 | 711 | if ($response->getWasSuccessful()) { |
712 | 712 | // Solr is reachable, but is the core as well? |
713 | - if ($core !== null) { |
|
713 | + if ($core !== NULL) { |
|
714 | 714 | $result = $response->getStatusResult(); |
715 | 715 | if ( |
716 | 716 | $result instanceof \Solarium\QueryType\Server\CoreAdmin\Result\StatusResult |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | } |
725 | 725 | } |
726 | 726 | // Instantiation successful! |
727 | - $this->ready = true; |
|
727 | + $this->ready = TRUE; |
|
728 | 728 | } |
729 | 729 | } catch (\Exception $e) { |
730 | 730 | // Nothing to do here. |
@@ -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 . '.'); |