TYPO3 CMS  TYPO3_8-7
RteHtmlAreaExtractionUpdate.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 
18 
23 {
27  protected $title = 'Install extension "rtehtmlarea" from TER';
28 
32  protected $extensionKey = 'rtehtmlarea';
33 
37  protected $extensionDetails = [
38  'rtehtmlarea' => [
39  'title' => 'RTE HTMLArea for TYPO3',
40  'description' => 'Provides the well-known RTE used in previous TYPO3 versions, if handling of images or custom configurations are necessary.',
41  'versionString' => '8.7.0',
42  'composerName' => 'friendsoftypo3/rtehtmlarea',
43  ],
44  ];
45 
52  public function checkForUpdate(&$description)
53  {
54  $description = 'The extension "rtehtmlarea" (RTE based on HtmlArea) was extracted into'
55  . ' the TYPO3 Extension Repository. This update downloads the TYPO3 Extension from the TER.'
56  . ' Use this if you have special configurations or image handling within Rich Text fields and uninstall the shipped EXT:rte_ckeditor.';
57 
58  $updateNeeded = false;
59 
60  if (!$this->isWizardDone()) {
61  $updateNeeded = true;
62  }
63 
64  return $updateNeeded;
65  }
66 
73  public function getUserInput($inputPrefix)
74  {
75  return '
76  <div class="panel panel-danger">
77  <div class="panel-heading">Are you really sure?</div>
78  <div class="panel-body">
79  <p>You should install EXT:rtehtmlarea only if you really need it.</p>
80  <p>This update wizard cannot check if the extension was installed before the update.</p>
81  <p>Are you really sure, you want to install EXT:rtehtmlarea?</p>
82  <div class="btn-group clearfix" data-toggle="buttons">
83  <label class="btn btn-default active">
84  <input type="radio" name="' . $inputPrefix . '[install]" value="0" checked="checked" /> no, don\'t install
85  </label>
86  <label class="btn btn-default">
87  <input type="radio" name="' . $inputPrefix . '[install]" value="1" /> yes, please install
88  </label>
89  </div>
90  </div>
91  </div>
92  ';
93  }
94 
102  public function performUpdate(array &$databaseQueries, &$customMessage)
103  {
104  $requestParams = GeneralUtility::_GP('install');
105  if (!isset($requestParams['values']['rtehtmlareaExtension']['install'])) {
106  return false;
107  }
108  $install = (int)$requestParams['values']['rtehtmlareaExtension']['install'];
109 
110  if ($install === 1) {
111  // user decided to install extension, install and mark wizard as done
112  $updateSuccessful = $this->installExtension($this->extensionKey, $customMessage);
113  if ($updateSuccessful) {
114  $this->markWizardAsDone();
115  return true;
116  }
117  } else {
118  // user decided to not install extension, mark wizard as done
119  $this->markWizardAsDone();
120  return true;
121  }
122  return $updateSuccessful;
123  }
124 }