‪TYPO3CMS  ‪main
LoadTcaService.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
20 use TYPO3\CMS\Core\Package\PackageManager;
21 
27 {
28  public function ‪__construct(
29  private readonly ‪LateBootService $lateBootService
30  ) {}
31 
40  {
41  $container = $this->lateBootService->getContainer();
42  $backup = $this->lateBootService->makeCurrent($container);
43  $tcaFactory = $container->get(TcaFactory::class);
44  ‪$GLOBALS['TCA'] = $tcaFactory->createNotMigrated();
45  $this->lateBootService->makeCurrent(null, $backup);
46  }
47 
53  public function ‪loadSingleExtTablesFile(string $extensionKey)
54  {
55  $container = $this->lateBootService->getContainer();
56  $backup = $this->lateBootService->makeCurrent($container);
57 
58  $packageManager = $container->get(PackageManager::class);
59  try {
60  $package = $packageManager->getPackage($extensionKey);
61  } catch (‪UnknownPackageException) {
62  throw new \RuntimeException('Extension ' . $extensionKey . ' is not active', 1477217619);
63  }
64 
65  $extTablesPath = $package->getPackagePath() . 'ext_tables.php';
66  // Load ext_tables.php file of the extension
67  if (@file_exists($extTablesPath)) {
68  require $extTablesPath;
69  }
70 
71  $this->lateBootService->makeCurrent(null, $backup);
72  }
73 }
‪TYPO3\CMS\Core\Configuration\Tca\TcaFactory
Definition: TcaFactory.php:35
‪TYPO3\CMS\Core\Package\Exception\UnknownPackageException
Definition: UnknownPackageException.php:23
‪TYPO3\CMS\Install\Service\LoadTcaService\loadSingleExtTablesFile
‪loadSingleExtTablesFile(string $extensionKey)
Definition: LoadTcaService.php:53
‪TYPO3\CMS\Install\Service\LoadTcaService\loadExtensionTablesWithoutMigration
‪loadExtensionTablesWithoutMigration()
Definition: LoadTcaService.php:39
‪TYPO3\CMS\Install\Service\LateBootService
Definition: LateBootService.php:27
‪TYPO3\CMS\Install\Service\LoadTcaService
Definition: LoadTcaService.php:27
‪TYPO3\CMS\Install\Service\LoadTcaService\__construct
‪__construct(private readonly LateBootService $lateBootService)
Definition: LoadTcaService.php:28
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Install\Service
Definition: ClearCacheService.php:16