We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
1 | <?php |
||||||
2 | /** |
||||||
3 | * (c) Kitodo. Key to digital objects e.V. <[email protected]> |
||||||
4 | * |
||||||
5 | * This file is part of the Kitodo and TYPO3 projects. |
||||||
6 | * |
||||||
7 | * @license GNU General Public License version 3 or later. |
||||||
8 | * For the full copyright and license information, please read the |
||||||
9 | * LICENSE.txt file that was distributed with this source code. |
||||||
10 | */ |
||||||
11 | |||||||
12 | namespace Kitodo\Dlf\Controller\Backend; |
||||||
13 | |||||||
14 | use Kitodo\Dlf\Common\Solr\Solr; |
||||||
15 | use Kitodo\Dlf\Controller\AbstractController; |
||||||
16 | use Kitodo\Dlf\Domain\Model\Format; |
||||||
17 | use Kitodo\Dlf\Domain\Model\Metadata; |
||||||
18 | use Kitodo\Dlf\Domain\Model\MetadataFormat; |
||||||
19 | use Kitodo\Dlf\Domain\Model\SolrCore; |
||||||
20 | use Kitodo\Dlf\Domain\Model\Structure; |
||||||
21 | use Kitodo\Dlf\Domain\Repository\FormatRepository; |
||||||
22 | use Kitodo\Dlf\Domain\Repository\MetadataRepository; |
||||||
23 | use Kitodo\Dlf\Domain\Repository\StructureRepository; |
||||||
24 | use Kitodo\Dlf\Domain\Repository\SolrCoreRepository; |
||||||
25 | use Psr\Http\Message\ResponseInterface; |
||||||
26 | use TYPO3\CMS\Backend\Utility\BackendUtility; |
||||||
27 | use TYPO3\CMS\Backend\View\BackendTemplateView; |
||||||
28 | use TYPO3\CMS\Core\Localization\LocalizationFactory; |
||||||
29 | use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; |
||||||
30 | use TYPO3\CMS\Core\Utility\GeneralUtility; |
||||||
31 | use TYPO3\CMS\Extbase\Mvc\View\ViewInterface; |
||||||
32 | use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; |
||||||
33 | use TYPO3\CMS\Core\Exception\SiteNotFoundException; |
||||||
34 | use TYPO3\CMS\Core\Site\Entity\NullSite; |
||||||
35 | use TYPO3\CMS\Core\Site\SiteFinder; |
||||||
36 | |||||||
37 | /** |
||||||
38 | * Controller class for the backend module 'New Tenant'. |
||||||
39 | * |
||||||
40 | * @package TYPO3 |
||||||
41 | * @subpackage dlf |
||||||
42 | * |
||||||
43 | * @access public |
||||||
44 | */ |
||||||
45 | class NewTenantController extends AbstractController |
||||||
46 | { |
||||||
47 | /** |
||||||
48 | * @access protected |
||||||
49 | * @var int |
||||||
50 | */ |
||||||
51 | protected int $pid; |
||||||
52 | |||||||
53 | /** |
||||||
54 | * @access protected |
||||||
55 | * @var array |
||||||
56 | */ |
||||||
57 | protected array $pageInfo; |
||||||
58 | |||||||
59 | /** |
||||||
60 | * @access protected |
||||||
61 | * @var array All configured site languages |
||||||
62 | */ |
||||||
63 | protected array $siteLanguages; |
||||||
64 | |||||||
65 | /** |
||||||
66 | * @access protected |
||||||
67 | * @var LocalizationFactory Language factory to get language key/values by our own. |
||||||
68 | */ |
||||||
69 | protected LocalizationFactory $languageFactory; |
||||||
70 | |||||||
71 | /** |
||||||
72 | * @access protected |
||||||
73 | * @var string Backend Template Container |
||||||
74 | */ |
||||||
75 | protected $defaultViewObjectName = BackendTemplateView::class; |
||||||
76 | |||||||
77 | /** |
||||||
78 | * @access protected |
||||||
79 | * @var FormatRepository |
||||||
80 | */ |
||||||
81 | protected FormatRepository $formatRepository; |
||||||
82 | |||||||
83 | /** |
||||||
84 | * @access public |
||||||
85 | * |
||||||
86 | * @param FormatRepository $formatRepository |
||||||
87 | * |
||||||
88 | * @return void |
||||||
89 | */ |
||||||
90 | public function injectFormatRepository(FormatRepository $formatRepository): void |
||||||
91 | { |
||||||
92 | $this->formatRepository = $formatRepository; |
||||||
93 | } |
||||||
94 | |||||||
95 | /** |
||||||
96 | * @access protected |
||||||
97 | * @var MetadataRepository |
||||||
98 | */ |
||||||
99 | protected MetadataRepository $metadataRepository; |
||||||
100 | |||||||
101 | /** |
||||||
102 | * @access public |
||||||
103 | * |
||||||
104 | * @param MetadataRepository $metadataRepository |
||||||
105 | * |
||||||
106 | * @return void |
||||||
107 | */ |
||||||
108 | public function injectMetadataRepository(MetadataRepository $metadataRepository): void |
||||||
109 | { |
||||||
110 | $this->metadataRepository = $metadataRepository; |
||||||
111 | } |
||||||
112 | |||||||
113 | /** |
||||||
114 | * @access protected |
||||||
115 | * @var StructureRepository |
||||||
116 | */ |
||||||
117 | protected StructureRepository $structureRepository; |
||||||
118 | |||||||
119 | /** |
||||||
120 | * @access public |
||||||
121 | * |
||||||
122 | * @param StructureRepository $structureRepository |
||||||
123 | * |
||||||
124 | * @return void |
||||||
125 | */ |
||||||
126 | public function injectStructureRepository(StructureRepository $structureRepository): void |
||||||
127 | { |
||||||
128 | $this->structureRepository = $structureRepository; |
||||||
129 | } |
||||||
130 | |||||||
131 | /** |
||||||
132 | * @access protected |
||||||
133 | * @var SolrCoreRepository |
||||||
134 | */ |
||||||
135 | protected SolrCoreRepository $solrCoreRepository; |
||||||
136 | |||||||
137 | /** |
||||||
138 | * @access public |
||||||
139 | * |
||||||
140 | * @param SolrCoreRepository $solrCoreRepository |
||||||
141 | * |
||||||
142 | * @return void |
||||||
143 | */ |
||||||
144 | public function injectSolrCoreRepository(SolrCoreRepository $solrCoreRepository): void |
||||||
145 | { |
||||||
146 | $this->solrCoreRepository = $solrCoreRepository; |
||||||
147 | } |
||||||
148 | |||||||
149 | /** |
||||||
150 | * Initialization for all actions |
||||||
151 | * |
||||||
152 | * @access protected |
||||||
153 | * |
||||||
154 | * @return void |
||||||
155 | */ |
||||||
156 | protected function initializeAction(): void |
||||||
157 | { |
||||||
158 | $this->pid = (int) GeneralUtility::_GP('id'); |
||||||
159 | |||||||
160 | $frameworkConfiguration = $this->configurationManager->getConfiguration($this->configurationManager::CONFIGURATION_TYPE_FRAMEWORK); |
||||||
161 | $frameworkConfiguration['persistence']['storagePid'] = $this->pid; |
||||||
162 | $this->configurationManager->setConfiguration($frameworkConfiguration); |
||||||
163 | |||||||
164 | $this->languageFactory = GeneralUtility::makeInstance(LocalizationFactory::class); |
||||||
165 | |||||||
166 | try { |
||||||
167 | $site = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByPageId($this->pid); |
||||||
168 | } catch (SiteNotFoundException $e) { |
||||||
169 | $site = new NullSite(); |
||||||
170 | } |
||||||
171 | $this->siteLanguages = $site->getLanguages(); |
||||||
172 | } |
||||||
173 | |||||||
174 | |||||||
175 | /** |
||||||
176 | * Action adding formats records |
||||||
177 | * |
||||||
178 | * @access public |
||||||
179 | * |
||||||
180 | * @return void |
||||||
181 | */ |
||||||
182 | public function addFormatAction(): void |
||||||
183 | { |
||||||
184 | // Include formats definition file. |
||||||
185 | $formatsDefaults = include(ExtensionManagementUtility::extPath('dlf') . 'Resources/Private/Data/FormatDefaults.php'); |
||||||
186 | |||||||
187 | $frameworkConfiguration = $this->configurationManager->getConfiguration($this->configurationManager::CONFIGURATION_TYPE_FRAMEWORK); |
||||||
188 | // tx_dlf_formats are stored on PID = 0 |
||||||
189 | $frameworkConfiguration['persistence']['storagePid'] = 0; |
||||||
190 | $this->configurationManager->setConfiguration($frameworkConfiguration); |
||||||
191 | |||||||
192 | $doPersist = false; |
||||||
193 | |||||||
194 | foreach ($formatsDefaults as $type => $values) { |
||||||
195 | // if default format record is not found, add it to the repository |
||||||
196 | if ($this->formatRepository->findOneByType($type) === null) { |
||||||
197 | $newRecord = GeneralUtility::makeInstance(Format::class); |
||||||
198 | $newRecord->setType($type); |
||||||
199 | $newRecord->setRoot($values['root']); |
||||||
200 | $newRecord->setNamespace($values['namespace']); |
||||||
201 | $newRecord->setClass($values['class']); |
||||||
202 | $this->formatRepository->add($newRecord); |
||||||
203 | |||||||
204 | $doPersist = true; |
||||||
205 | } |
||||||
206 | } |
||||||
207 | |||||||
208 | // We must persist here, if we changed anything. |
||||||
209 | if ($doPersist === true) { |
||||||
210 | $persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class); |
||||||
211 | $persistenceManager->persistAll(); |
||||||
212 | } |
||||||
213 | |||||||
214 | $this->forward('index'); |
||||||
0 ignored issues
–
show
|
|||||||
215 | } |
||||||
216 | |||||||
217 | /** |
||||||
218 | * Action adding metadata records |
||||||
219 | * |
||||||
220 | * @access public |
||||||
221 | * |
||||||
222 | * @return void |
||||||
223 | */ |
||||||
224 | public function addMetadataAction(): void |
||||||
225 | { |
||||||
226 | // Include metadata definition file. |
||||||
227 | $metadataDefaults = include(ExtensionManagementUtility::extPath('dlf') . 'Resources/Private/Data/MetadataDefaults.php'); |
||||||
228 | |||||||
229 | $doPersist = false; |
||||||
230 | |||||||
231 | // load language file in own array |
||||||
232 | $metadataLabels = $this->languageFactory->getParsedData('EXT:dlf/Resources/Private/Language/locallang_metadata.xlf', $this->siteLanguages[0]->getTypo3Language()); |
||||||
233 | |||||||
234 | foreach ($metadataDefaults as $indexName => $values) { |
||||||
235 | // if default format record is not found, add it to the repository |
||||||
236 | if ($this->metadataRepository->findOneByIndexName($indexName) === null) { |
||||||
237 | |||||||
238 | $newRecord = GeneralUtility::makeInstance(Metadata::class); |
||||||
239 | $newRecord->setLabel($this->getLLL('metadata.' . $indexName, $this->siteLanguages[0]->getTypo3Language(), $metadataLabels)); |
||||||
240 | $newRecord->setIndexName($indexName); |
||||||
241 | $newRecord->setDefaultValue($values['default_value']); |
||||||
242 | $newRecord->setWrap($values['wrap'] ? : $GLOBALS['TCA']['tx_dlf_metadata']['columns']['wrap']['config']['default']); |
||||||
243 | $newRecord->setIndexTokenized($values['index_tokenized']); |
||||||
244 | $newRecord->setIndexStored((int) $values['index_stored']); |
||||||
245 | $newRecord->setIndexIndexed((int) $values['index_indexed']); |
||||||
246 | $newRecord->setIndexBoost((float) $values['index_boost']); |
||||||
247 | $newRecord->setIsSortable((int) $values['is_sortable']); |
||||||
248 | $newRecord->setIsFacet((int) $values['is_facet']); |
||||||
249 | $newRecord->setIsListed((int) $values['is_listed']); |
||||||
250 | $newRecord->setIndexAutocomplete((int) $values['index_autocomplete']); |
||||||
251 | $newRecord->setSorting((int) $values['sorting']); |
||||||
252 | |||||||
253 | if (is_array($values['format'])) { |
||||||
254 | foreach ($values['format'] as $format) { |
||||||
255 | $formatRecord = $this->formatRepository->findOneByRoot($format['format_root']); |
||||||
256 | // If formatRecord is null, we cannot create a MetadataFormat record. |
||||||
257 | if ($formatRecord !== null) { |
||||||
258 | $newMetadataFormat = GeneralUtility::makeInstance(MetadataFormat::class); |
||||||
259 | $newMetadataFormat->setEncoded($formatRecord->getUid()); |
||||||
260 | $newMetadataFormat->setXpath($format['xpath']); |
||||||
261 | $newMetadataFormat->setXpathSorting($format['xpath_sorting']); |
||||||
262 | $newRecord->addFormat($newMetadataFormat); |
||||||
263 | } |
||||||
264 | } |
||||||
265 | } |
||||||
266 | |||||||
267 | foreach ($this->siteLanguages as $siteLanguage) { |
||||||
268 | if ($siteLanguage->getLanguageId() === 0) { |
||||||
269 | // skip default language |
||||||
270 | continue; |
||||||
271 | } |
||||||
272 | $translatedRecord = GeneralUtility::makeInstance(Metadata::class); |
||||||
273 | $translatedRecord->setL18nParent($newRecord); |
||||||
274 | $translatedRecord->_setProperty('_languageUid', $siteLanguage->getLanguageId()); |
||||||
275 | $translatedRecord->setLabel($this->getLLL('metadata.' . $indexName, $siteLanguage->getTypo3Language(), $metadataLabels)); |
||||||
276 | $translatedRecord->setIndexName($indexName . "_" . $siteLanguage->getLanguageId()); |
||||||
277 | $translatedRecord->setWrap($newRecord->getWrap()); |
||||||
278 | |||||||
279 | $this->metadataRepository->add($translatedRecord); |
||||||
280 | } |
||||||
281 | |||||||
282 | $this->metadataRepository->add($newRecord); |
||||||
283 | |||||||
284 | $doPersist = true; |
||||||
285 | } |
||||||
286 | } |
||||||
287 | |||||||
288 | // We must persist here, if we changed anything. |
||||||
289 | if ($doPersist === true) { |
||||||
290 | $persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class); |
||||||
291 | $persistenceManager->persistAll(); |
||||||
292 | } |
||||||
293 | |||||||
294 | $this->forward('index'); |
||||||
0 ignored issues
–
show
The function
TYPO3\CMS\Extbase\Mvc\Co...onController::forward() has been deprecated: since TYPO3 11.0, will be removed in 12.0
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This function has been deprecated. The supplier of the function has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.
Loading history...
|
|||||||
295 | } |
||||||
296 | |||||||
297 | /** |
||||||
298 | * Action adding Solr core records |
||||||
299 | * |
||||||
300 | * @access public |
||||||
301 | * |
||||||
302 | * @return void |
||||||
303 | */ |
||||||
304 | public function addSolrCoreAction(): void |
||||||
305 | { |
||||||
306 | $doPersist = false; |
||||||
307 | |||||||
308 | // load language file in own array |
||||||
309 | $beLabels = $this->languageFactory->getParsedData('EXT:dlf/Resources/Private/Language/locallang_be.xlf', $this->siteLanguages[0]->getTypo3Language()); |
||||||
310 | |||||||
311 | if ($this->solrCoreRepository->findOneByPid($this->pid) === null) { |
||||||
312 | $newRecord = GeneralUtility::makeInstance(SolrCore::class); |
||||||
313 | $newRecord->setLabel($this->getLLL('flexform.solrcore', $this->siteLanguages[0]->getTypo3Language(), $beLabels). ' (PID ' . $this->pid . ')'); |
||||||
314 | $indexName = Solr::createCore(''); |
||||||
315 | if (!empty($indexName)) { |
||||||
316 | $newRecord->setIndexName($indexName); |
||||||
317 | |||||||
318 | $this->solrCoreRepository->add($newRecord); |
||||||
319 | |||||||
320 | $doPersist = true; |
||||||
321 | } |
||||||
322 | } |
||||||
323 | |||||||
324 | // We must persist here, if we changed anything. |
||||||
325 | if ($doPersist === true) { |
||||||
326 | $persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class); |
||||||
327 | $persistenceManager->persistAll(); |
||||||
328 | } |
||||||
329 | |||||||
330 | $this->forward('index'); |
||||||
0 ignored issues
–
show
The function
TYPO3\CMS\Extbase\Mvc\Co...onController::forward() has been deprecated: since TYPO3 11.0, will be removed in 12.0
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This function has been deprecated. The supplier of the function has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.
Loading history...
|
|||||||
331 | } |
||||||
332 | |||||||
333 | /** |
||||||
334 | * Action adding structure records |
||||||
335 | * |
||||||
336 | * @access public |
||||||
337 | * |
||||||
338 | * @return void |
||||||
339 | */ |
||||||
340 | public function addStructureAction(): void |
||||||
341 | { |
||||||
342 | // Include structure definition file. |
||||||
343 | $structureDefaults = include(ExtensionManagementUtility::extPath('dlf') . 'Resources/Private/Data/StructureDefaults.php'); |
||||||
344 | |||||||
345 | $doPersist = false; |
||||||
346 | |||||||
347 | // load language file in own array |
||||||
348 | $structLabels = $this->languageFactory->getParsedData('EXT:dlf/Resources/Private/Language/locallang_structure.xlf', $this->siteLanguages[0]->getTypo3Language()); |
||||||
349 | |||||||
350 | foreach ($structureDefaults as $indexName => $values) { |
||||||
351 | // if default format record is not found, add it to the repository |
||||||
352 | if ($this->structureRepository->findOneByIndexName($indexName) === null) { |
||||||
353 | $newRecord = GeneralUtility::makeInstance(Structure::class); |
||||||
354 | $newRecord->setLabel($this->getLLL('structure.' . $indexName, $this->siteLanguages[0]->getTypo3Language(), $structLabels)); |
||||||
355 | $newRecord->setIndexName($indexName); |
||||||
356 | $newRecord->setToplevel($values['toplevel']); |
||||||
357 | $newRecord->setOaiName($values['oai_name']); |
||||||
358 | $this->structureRepository->add($newRecord); |
||||||
359 | |||||||
360 | foreach ($this->siteLanguages as $siteLanguage) { |
||||||
361 | if ($siteLanguage->getLanguageId() === 0) { |
||||||
362 | // skip default language |
||||||
363 | continue; |
||||||
364 | } |
||||||
365 | $translatedRecord = GeneralUtility::makeInstance(Structure::class); |
||||||
366 | $translatedRecord->setL18nParent($newRecord); |
||||||
367 | $translatedRecord->_setProperty('_languageUid', $siteLanguage->getLanguageId()); |
||||||
368 | $translatedRecord->setLabel($this->getLLL('structure.' . $indexName, $siteLanguage->getTypo3Language(), $structLabels)); |
||||||
369 | $translatedRecord->setIndexName($indexName . "_" . $siteLanguage->getLanguageId()); |
||||||
370 | |||||||
371 | $this->structureRepository->add($translatedRecord); |
||||||
372 | } |
||||||
373 | |||||||
374 | $doPersist = true; |
||||||
375 | } |
||||||
376 | } |
||||||
377 | |||||||
378 | // We must persist here, if we changed anything. |
||||||
379 | if ($doPersist === true) { |
||||||
380 | $persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class); |
||||||
381 | $persistenceManager->persistAll(); |
||||||
382 | } |
||||||
383 | |||||||
384 | $this->forward('index'); |
||||||
0 ignored issues
–
show
The function
TYPO3\CMS\Extbase\Mvc\Co...onController::forward() has been deprecated: since TYPO3 11.0, will be removed in 12.0
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This function has been deprecated. The supplier of the function has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.
Loading history...
|
|||||||
385 | } |
||||||
386 | |||||||
387 | /** |
||||||
388 | * Set up the doc header properly here |
||||||
389 | * |
||||||
390 | * @access protected |
||||||
391 | * |
||||||
392 | * @param ViewInterface $view |
||||||
393 | * |
||||||
394 | * @return void |
||||||
395 | */ |
||||||
396 | protected function initializeView(ViewInterface $view): void |
||||||
397 | { |
||||||
398 | /** @var BackendTemplateView $view */ |
||||||
399 | parent::initializeView($view); |
||||||
0 ignored issues
–
show
The function
TYPO3\CMS\Extbase\Mvc\Co...oller::initializeView() has been deprecated: since v11, will be removed in v12: Drop method along with extbase ViewInterface.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This function has been deprecated. The supplier of the function has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.
Loading history...
|
|||||||
400 | if ($this->actionMethodName == 'indexAction') { |
||||||
401 | $this->pageInfo = BackendUtility::readPageAccess($this->pid, $GLOBALS['BE_USER']->getPagePermsClause(1)); |
||||||
0 ignored issues
–
show
It seems like
TYPO3\CMS\Backend\Utilit...>getPagePermsClause(1)) can also be of type false . However, the property $pageInfo is declared as type array . Maybe add an additional type check?
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly. For example, imagine you have a variable Either this assignment is in error or a type check should be added for that assignment. class Id
{
public $id;
public function __construct($id)
{
$this->id = $id;
}
}
class Account
{
/** @var Id $id */
public $id;
}
$account_id = false;
if (starsAreRight()) {
$account_id = new Id(42);
}
$account = new Account();
if ($account instanceof Id)
{
$account->id = $account_id;
}
Loading history...
|
|||||||
402 | $view->getModuleTemplate()->setFlashMessageQueue($this->controllerContext->getFlashMessageQueue()); |
||||||
0 ignored issues
–
show
The function
TYPO3\CMS\Extbase\Mvc\Co...:getFlashMessageQueue() has been deprecated: since v11, will be removed in v12
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This function has been deprecated. The supplier of the function has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.
Loading history...
The property
TYPO3\CMS\Extbase\Mvc\Co...ler::$controllerContext has been deprecated: since v11, will be removed with v12.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This property has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.
Loading history...
|
|||||||
403 | } |
||||||
404 | if ($view instanceof BackendTemplateView) { |
||||||
405 | $view->getModuleTemplate()->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Modal'); |
||||||
0 ignored issues
–
show
The function
TYPO3\CMS\Backend\Templa...late::getPageRenderer() has been deprecated: since v11, will be removed in v12
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This function has been deprecated. The supplier of the function has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.
Loading history...
|
|||||||
406 | } |
||||||
407 | } |
||||||
408 | |||||||
409 | /** |
||||||
410 | * Main function of the module |
||||||
411 | * |
||||||
412 | * @access public |
||||||
413 | * |
||||||
414 | * @return void |
||||||
415 | */ |
||||||
416 | public function indexAction(): void |
||||||
417 | { |
||||||
418 | $recordInfos = []; |
||||||
419 | |||||||
420 | if ($this->pageInfo['doktype'] != 254) { |
||||||
421 | $this->forward('error'); |
||||||
0 ignored issues
–
show
The function
TYPO3\CMS\Extbase\Mvc\Co...onController::forward() has been deprecated: since TYPO3 11.0, will be removed in 12.0
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This function has been deprecated. The supplier of the function has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.
Loading history...
|
|||||||
422 | } |
||||||
423 | |||||||
424 | $formatsDefaults = include(ExtensionManagementUtility::extPath('dlf') . 'Resources/Private/Data/FormatDefaults.php'); |
||||||
425 | $recordInfos['formats']['numCurrent'] = $this->formatRepository->countAll(); |
||||||
426 | $recordInfos['formats']['numDefault'] = count($formatsDefaults); |
||||||
427 | |||||||
428 | $structuresDefaults = include(ExtensionManagementUtility::extPath('dlf') . 'Resources/Private/Data/StructureDefaults.php'); |
||||||
429 | $recordInfos['structures']['numCurrent'] = $this->structureRepository->countByPid($this->pid); |
||||||
430 | $recordInfos['structures']['numDefault'] = count($structuresDefaults); |
||||||
431 | |||||||
432 | $metadataDefaults = include(ExtensionManagementUtility::extPath('dlf') . 'Resources/Private/Data/MetadataDefaults.php'); |
||||||
433 | $recordInfos['metadata']['numCurrent'] = $this->metadataRepository->countByPid($this->pid); |
||||||
434 | $recordInfos['metadata']['numDefault'] = count($metadataDefaults); |
||||||
435 | |||||||
436 | $recordInfos['solrcore']['numCurrent'] = $this->solrCoreRepository->countByPid($this->pid); |
||||||
437 | |||||||
438 | $this->view->assign('recordInfos', $recordInfos); |
||||||
439 | } |
||||||
440 | |||||||
441 | /** |
||||||
442 | * Error function - there is nothing to do at the moment. |
||||||
443 | * |
||||||
444 | * @access public |
||||||
445 | * |
||||||
446 | * @return void |
||||||
447 | */ |
||||||
448 | // @phpstan-ignore-next-line |
||||||
449 | public function errorAction(): void |
||||||
450 | { |
||||||
451 | // TODO: Call parent::errorAction() when dropping support for TYPO3 v10. |
||||||
452 | } |
||||||
453 | |||||||
454 | /** |
||||||
455 | * Get language label for given key and language. |
||||||
456 | * |
||||||
457 | * @access protected |
||||||
458 | * |
||||||
459 | * @param string $index |
||||||
460 | * @param string $lang |
||||||
461 | * @param array $langArray |
||||||
462 | * |
||||||
463 | * @return string |
||||||
464 | */ |
||||||
465 | protected function getLLL(string $index, string $lang, array $langArray): string |
||||||
466 | { |
||||||
467 | if (isset($langArray[$lang][$index][0]['target'])) { |
||||||
468 | return $langArray[$lang][$index][0]['target']; |
||||||
469 | } elseif (isset($langArray['default'][$index][0]['target'])) { |
||||||
470 | return $langArray['default'][$index][0]['target']; |
||||||
471 | } else { |
||||||
472 | return 'Missing translation for ' . $index; |
||||||
473 | } |
||||||
474 | } |
||||||
475 | } |
||||||
476 |
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.