TYPO3 CMS  TYPO3_8-7
DbalAndAdodbExtractionUpdate.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 = '[Optional] Install extensions "dbal" and "adodb" from TER.';
28 
32  protected $extensionDetails = [
33  'adodb' => [
34  'title' => 'ADOdb',
35  'description' => 'Adds ADOdb to TYPO3',
36  'versionString' => '8.4.0',
37  'composerName' => 'friendsoftypo3/adodb',
38  ],
39  'dbal' => [
40  'title' => 'dbal',
41  'description' => 'Adds old database abstraction layer to TYPO3',
42  'versionString' => '8.4.0',
43  'composerName' => 'friendsoftypo3/dbal',
44  ],
45  ];
46 
53  public function checkForUpdate(&$description)
54  {
55  $description = 'The extensions "dbal" and "adodb" have been extracted to'
56  . ' the TYPO3 Extension Repository. This update downloads the TYPO3 Extension from the TER'
57  . ' if the two extensions are still needed.';
58 
59  return !$this->isWizardDone();
60  }
61 
68  public function getUserInput($inputPrefix)
69  {
70  return '
71  <div class="panel panel-danger">
72  <div class="panel-heading">Are you really sure?</div>
73  <div class="panel-body">
74  <p>You should install EXT:adodb and EXT:dbal only if you really need it.</p>
75  <p>This update wizard cannot check if the extension was installed before the update.</p>
76  <p>Are you really sure, you want to install these two extensions?</p>
77  <p>They are only needed if this instance connects to a database server that is NOT MySQL
78  and if an active extension uses $GLOBALS[\'TYPO3_DB\'] and a table mapping for EXT:dbal
79  is configured.</p>
80  <p>Loading these two extensions is a rather seldom exceptions, the vast majority of
81  instances should say "no" here.</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']['TYPO3\CMS\Install\Updates\DbalAndAdodbExtractionUpdate']['install'])) {
106  return false;
107  }
108  $install = (int)$requestParams['values']['TYPO3\CMS\Install\Updates\DbalAndAdodbExtractionUpdate']['install'];
109 
110  if ($install === 1) {
111  // user decided to install extensions, install and mark wizard as done
112  $adodbSuccessful = $this->installExtension('adodb', $customMessage);
113  $dbalSuccessful = $this->installExtension('dbal', $customMessage);
114  if ($adodbSuccessful && $dbalSuccessful) {
115  $this->markWizardAsDone();
116  return true;
117  }
118  } else {
119  // user decided to not install extension, mark wizard as done
120  $this->markWizardAsDone();
121  return true;
122  }
123  return false;
124  }
125 }