‪TYPO3CMS  9.5
AbstractUpdate.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 
17 use Symfony\Component\Console\Output\OutputInterface;
21 
29 {
30  public function ‪__construct()
31  {
32  trigger_error('Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this), E_USER_DEPRECATED);
33  }
39  protected ‪$title;
40 
46  protected ‪$identifier;
47 
53  public ‪$userInput;
54 
58  protected ‪$output;
59 
66  public function ‪getTitle(): string
67  {
68  trigger_error(
69  'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
70  E_USER_DEPRECATED
71  );
72  if ($this->title) {
73  return ‪$this->title;
74  }
75  return ‪$this->identifier;
76  }
77 
83  public function ‪setTitle(‪$title)
84  {
85  trigger_error(
86  'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
87  E_USER_DEPRECATED
88  );
89  $this->title = ‪$title;
90  }
91 
97  public function ‪getIdentifier(): string
98  {
99  trigger_error(
100  'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
101  E_USER_DEPRECATED
102  );
103  return $this->identifier ?? static::class;
104  }
105 
111  public function ‪setIdentifier(‪$identifier)
112  {
113  trigger_error(
114  'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
115  E_USER_DEPRECATED
116  );
117  $this->identifier = ‪$identifier;
118  }
119 
128  public function ‪shouldRenderWizard()
129  {
130  trigger_error(
131  'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
132  E_USER_DEPRECATED
133  );
134  $explanation = '';
135  $result = $this->‪checkForUpdate($explanation);
136  return (bool)$result === true;
137  }
138 
145  protected function ‪checkIfTableExists($table)
146  {
147  trigger_error(
148  'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
149  E_USER_DEPRECATED
150  );
151  $tableExists = GeneralUtility::makeInstance(ConnectionPool::class)
152  ->getConnectionForTable($table)
153  ->getSchemaManager()
154  ->tablesExist([$table]);
155 
156  return $tableExists;
157  }
158 
165  abstract public function ‪checkForUpdate(&$description);
166 
174  abstract public function ‪performUpdate(array &$dbQueries, &$customMessage);
175 
182  protected function ‪installExtensions(array $extensionKeys)
183  {
184  trigger_error(
185  'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
186  E_USER_DEPRECATED
187  );
189  $installUtility = GeneralUtility::makeInstance(
190  \‪TYPO3\CMS\Extensionmanager\Utility\InstallUtility::class
191  );
192  $installUtility->install($extensionKeys);
193  }
194 
202  protected function ‪markWizardAsDone($confValue = 1)
203  {
204  trigger_error(
205  'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
206  E_USER_DEPRECATED
207  );
208  GeneralUtility::makeInstance(Registry::class)->set('installUpdate', static::class, $confValue);
209  }
210 
216  protected function ‪isWizardDone()
217  {
218  trigger_error(
219  'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
220  E_USER_DEPRECATED
221  );
222  $wizardClassName = static::class;
223  return GeneralUtility::makeInstance(Registry::class)->get('installUpdate', $wizardClassName, false);
224  }
225 
231  public function ‪getDescription(): string
232  {
233  trigger_error(
234  'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
235  E_USER_DEPRECATED
236  );
237  return '';
238  }
239 
246  public function ‪executeUpdate(): bool
247  {
248  trigger_error(
249  'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
250  E_USER_DEPRECATED
251  );
252  $queries = [];
253  $message = '';
254  $result = $this->‪performUpdate($queries, $message);
255  $this->output->write($message);
256  return $result;
257  }
258 
266  public function ‪updateNecessary(): bool
267  {
268  trigger_error(
269  'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
270  E_USER_DEPRECATED
271  );
272  $description = '';
273  $result = $this->‪checkForUpdate($description);
274  $this->output->write($description);
275  return $result;
276  }
277 
285  public function ‪getPrerequisites(): array
286  {
287  trigger_error(
288  'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
289  E_USER_DEPRECATED
290  );
291  return [
292  DatabaseUpdatedPrerequisite::class
293  ];
294  }
295 
301  public function ‪setOutput(OutputInterface ‪$output): void
302  {
303  trigger_error(
304  'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
305  E_USER_DEPRECATED
306  );
307  $this->output = ‪$output;
308  }
309 }
‪TYPO3\CMS\Install\Updates\AbstractUpdate\updateNecessary
‪bool updateNecessary()
Definition: AbstractUpdate.php:262
‪TYPO3\CMS\Install\Updates\AbstractUpdate\installExtensions
‪installExtensions(array $extensionKeys)
Definition: AbstractUpdate.php:178
‪TYPO3\CMS\Install\Updates\AbstractUpdate\setIdentifier
‪setIdentifier($identifier)
Definition: AbstractUpdate.php:107
‪TYPO3\CMS\Install\Updates\AbstractUpdate
Definition: AbstractUpdate.php:29
‪TYPO3\CMS\Install\Updates\AbstractUpdate\getTitle
‪string getTitle()
Definition: AbstractUpdate.php:62
‪TYPO3
‪TYPO3\CMS\Install\Updates\AbstractUpdate\__construct
‪__construct()
Definition: AbstractUpdate.php:30
‪TYPO3\CMS\Install\Updates\ChattyInterface
Definition: ChattyInterface.php:25
‪TYPO3\CMS\Core\Registry
Definition: Registry.php:32
‪TYPO3\CMS\Install\Updates\AbstractUpdate\setTitle
‪setTitle($title)
Definition: AbstractUpdate.php:79
‪TYPO3\CMS\Install\Updates\AbstractUpdate\$output
‪OutputInterface $output
Definition: AbstractUpdate.php:54
‪TYPO3\CMS\Install\Updates
Definition: AbstractDownloadExtensionUpdate.php:3
‪TYPO3\CMS\Install\Updates\AbstractUpdate\checkIfTableExists
‪bool checkIfTableExists($table)
Definition: AbstractUpdate.php:141
‪TYPO3\CMS\Install\Updates\AbstractUpdate\shouldRenderWizard
‪bool shouldRenderWizard()
Definition: AbstractUpdate.php:124
‪TYPO3\CMS\Install\Updates\AbstractUpdate\checkForUpdate
‪bool checkForUpdate(&$description)
‪TYPO3\CMS\Install\Updates\AbstractUpdate\performUpdate
‪bool performUpdate(array &$dbQueries, &$customMessage)
‪TYPO3\CMS\Install\Updates\AbstractUpdate\$identifier
‪string $identifier
Definition: AbstractUpdate.php:44
‪TYPO3\CMS\Install\Updates\AbstractUpdate\$userInput
‪string $userInput
Definition: AbstractUpdate.php:50
‪TYPO3\CMS\Install\Updates\UpgradeWizardInterface
Definition: UpgradeWizardInterface.php:22
‪TYPO3\CMS\Install\Updates\AbstractUpdate\getPrerequisites
‪string[] getPrerequisites()
Definition: AbstractUpdate.php:281
‪TYPO3\CMS\Core\Database\ConnectionPool
Definition: ConnectionPool.php:44
‪TYPO3\CMS\Install\Updates\AbstractUpdate\getIdentifier
‪string getIdentifier()
Definition: AbstractUpdate.php:93
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Install\Updates\AbstractUpdate\$title
‪string $title
Definition: AbstractUpdate.php:38
‪TYPO3\CMS\Install\Updates\AbstractUpdate\executeUpdate
‪bool executeUpdate()
Definition: AbstractUpdate.php:242
‪TYPO3\CMS\Install\Updates\AbstractUpdate\markWizardAsDone
‪markWizardAsDone($confValue=1)
Definition: AbstractUpdate.php:198
‪TYPO3\CMS\Install\Updates\AbstractUpdate\setOutput
‪setOutput(OutputInterface $output)
Definition: AbstractUpdate.php:297
‪TYPO3\CMS\Install\Updates\AbstractUpdate\getDescription
‪string getDescription()
Definition: AbstractUpdate.php:227
‪TYPO3\CMS\Install\Updates\AbstractUpdate\isWizardDone
‪bool isWizardDone()
Definition: AbstractUpdate.php:212