TYPO3 CMS  TYPO3_8-7
UpgradeAnalysis.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 
24 
29 {
30 
42  protected function executeAction()
43  {
44  $documentationFileService = new DocumentationFile();
45  $documentationFiles = $documentationFileService->findDocumentationFiles(
46  strtr(realpath(PATH_site . ExtensionManagementUtility::siteRelPath('core') . 'Documentation/Changelog'), '\\', '/')
47  );
48 
49  $formProtection = FormProtectionFactory::get(InstallToolFormProtection::class);
50  $saveIgnoredItemsToken = $formProtection->generateToken('installTool', 'saveIgnoredItems');
51  $removeIgnoredItemsToken = $formProtection->generateToken('installTool', 'removeIgnoredItems');
52  $this->view->assignMultiple([
53  'saveIgnoredItemsToken' => $saveIgnoredItemsToken,
54  'removeIgnoredItemsToken' => $removeIgnoredItemsToken,
55  ]);
56  $documentationFiles = array_reverse($documentationFiles);
57 
58  $filesMarkedAsShown = GeneralUtility::makeInstance(ConnectionPool::class)
59  ->getConnectionForTable('sys_registry')
60  ->select(['*'], 'sys_registry', [
61  'entry_namespace' => 'upgradeAnalysisIgnoredFiles'
62  ])->fetchAll();
63 
64  $hashes = [];
65  foreach ($filesMarkedAsShown as $file) {
66  $hashes[] = $file['entry_key'];
67  }
68 
69  $readFiles = [];
70  foreach ($documentationFiles as $section => &$files) {
71  foreach ($files as $fileId => $fileData) {
72  if (in_array($fileData['file_hash'], $hashes, true)) {
73  $fileData['section'] = $section;
74  $readFiles[$fileId] = $fileData;
75  unset($files[$fileId]);
76  }
77  }
78  }
79 
80  $this->view->assign('files', $documentationFiles);
81  $this->view->assign('shownFiles', $readFiles);
82  return $this->view->render();
83  }
84 }
static makeInstance($className,... $constructorArguments)
static get($classNameOrType='default',... $constructorArguments)