TYPO3 CMS  TYPO3_8-7
TcaExtTablesCheck.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
22 
33 {
34 
38  protected $view;
39 
43  public function __construct(JsonView $view = null)
44  {
45  $this->view = $view ?: GeneralUtility::makeInstance(JsonView::class);
46  }
47 
52  protected function initializeHandle()
53  {
54  // empty on purpose because AbstractAjaxAction still overwrites $this->view with StandaloneView
55  }
56 
62  protected function executeAction()
63  {
64  $statusMessages = [];
65  $tcaMessages = $this->checkTcaChangesInExtTables();
66 
67  foreach ($tcaMessages as $tcaMessage) {
69  $message = GeneralUtility::makeInstance(NoticeStatus::class);
70  $message->setTitle($tcaMessage);
71  $statusMessages[] = $message;
72  }
73 
74  $this->view->assignMultiple([
75  'success' => true,
76  'status' => $statusMessages,
77  ]);
78  return $this->view->render();
79  }
80 
86  protected function checkTcaChangesInExtTables()
87  {
88  $loadTcaService = GeneralUtility::makeInstance(LoadTcaService::class);
89  $loadTcaService->loadExtensionTablesWithoutMigration();
90  $baseTca = $GLOBALS['TCA'];
91  $messages = [];
92  foreach ($GLOBALS['TYPO3_LOADED_EXT'] as $extensionKey => $extensionInformation) {
93  if ((is_array($extensionInformation) || $extensionInformation instanceof \ArrayAccess)
94  && $extensionInformation['ext_tables.php']
95  ) {
96  $loadTcaService->loadSingleExtTablesFile($extensionKey);
97  $newTca = $GLOBALS['TCA'];
98  if ($newTca !== $baseTca) {
99  $messages[] = $extensionKey;
100  }
101  $baseTca = $newTca;
102  }
103  }
104  return $messages;
105  }
106 }
static makeInstance($className,... $constructorArguments)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']