‪TYPO3CMS  9.5
FormLegacyExtractionUpdate.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 
21 
27 {
31  protected ‪$confirmation;
32 
33  public function ‪__construct()
34  {
35  $this->extension = new ‪ExtensionModel(
36  'form_legacy',
37  'Legacy form extension for TYPO3 v7 compatibility',
38  '8.7.0',
39  'friendsoftypo3/form-legacy',
40  'Provides an additional backwards-compatibility layer with legacy functionality for sites that used the form extension in TYPO3 v7.'
41  );
42 
43  $this->confirmation = new ‪Confirmation(
44  'Are you really sure, you want to install EXT:form_legacy?',
45  'You should install EXT:form_legacy only if you really need it.'
46  . 'This update wizard checked all content elements and found at least one not deleted element based'
47  . 'on the old form module. It is advised to manually convert those elements from the old form implementation'
48  . 'to the new implementation of EXT:form. EXT:form_legacy should be unloaded and removed afterwards.',
49  true
50  );
51  }
52 
58  public function ‪getConfirmation(): ‪Confirmation
59  {
61  }
62 
69  public function ‪getIdentifier(): string
70  {
71  return 'formLegacyExtractionUpdate';
72  }
73 
79  public function ‪getTitle(): string
80  {
81  return 'Install extension "form_legacy"';
82  }
83 
89  public function ‪getDescription(): string
90  {
91  return 'The extension "form" was rewritten in TYPO3 v8 and follows a new approach.'
92  . 'This update downloads the old implementation of the form extension as known from TYPO3 v7 from the TER.';
93  }
94 
101  public function ‪updateNecessary(): bool
102  {
103  $updateNeeded = false;
104 
105  if (!‪ExtensionManagementUtility::isLoaded('form_legacy')) {
106  $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tt_content');
107  $queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
108  $count = $queryBuilder
109  ->count('*')
110  ->from('tt_content')
111  ->where($queryBuilder->expr()->eq('CType', $queryBuilder->createNamedParameter('mailform')))
112  ->execute()
113  ->fetchColumn(0);
114  if ($count > 0) {
115  $updateNeeded = true;
116  }
117  }
118  return $updateNeeded;
119  }
120 
128  public function ‪getPrerequisites(): array
129  {
130  return [
131  DatabaseUpdatedPrerequisite::class
132  ];
133  }
134 }
‪TYPO3\CMS\Install\Updates\FormLegacyExtractionUpdate\$confirmation
‪TYPO3 CMS Install Updates Confirmation $confirmation
Definition: FormLegacyExtractionUpdate.php:30
‪TYPO3\CMS\Install\Updates\FormLegacyExtractionUpdate\getTitle
‪string getTitle()
Definition: FormLegacyExtractionUpdate.php:78
‪TYPO3\CMS\Install\Updates\FormLegacyExtractionUpdate\updateNecessary
‪bool updateNecessary()
Definition: FormLegacyExtractionUpdate.php:100
‪TYPO3\CMS\Install\Updates
Definition: AbstractDownloadExtensionUpdate.php:3
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility
Definition: ExtensionManagementUtility.php:36
‪TYPO3\CMS\Install\Updates\FormLegacyExtractionUpdate\getDescription
‪string getDescription()
Definition: FormLegacyExtractionUpdate.php:88
‪TYPO3\CMS\Install\Updates\ExtensionModel
Definition: ExtensionModel.php:25
‪TYPO3\CMS\Install\Updates\FormLegacyExtractionUpdate\getConfirmation
‪TYPO3 CMS Install Updates Confirmation getConfirmation()
Definition: FormLegacyExtractionUpdate.php:57
‪TYPO3\CMS\Install\Updates\Confirmation
Definition: Confirmation.php:20
‪TYPO3\CMS\Install\Updates\FormLegacyExtractionUpdate\getIdentifier
‪string getIdentifier()
Definition: FormLegacyExtractionUpdate.php:68
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility\isLoaded
‪static bool isLoaded($key, $exitOnError=null)
Definition: ExtensionManagementUtility.php:115
‪TYPO3\CMS\Install\Updates\AbstractDownloadExtensionUpdate
Definition: AbstractDownloadExtensionUpdate.php:31
‪TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction
Definition: DeletedRestriction.php:26
‪TYPO3\CMS\Install\Updates\FormLegacyExtractionUpdate\getPrerequisites
‪string[] getPrerequisites()
Definition: FormLegacyExtractionUpdate.php:127
‪TYPO3\CMS\Core\Database\ConnectionPool
Definition: ConnectionPool.php:44
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Install\Updates\FormLegacyExtractionUpdate\__construct
‪__construct()
Definition: FormLegacyExtractionUpdate.php:32
‪TYPO3\CMS\Install\Updates\FormLegacyExtractionUpdate
Definition: FormLegacyExtractionUpdate.php:27