TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
DbalAndAdodbExtractionUpdate.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Install\Updates;
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  ],
38  'dbal' => [
39  'title' => 'dbal',
40  'description' => 'Adds old database abstraction layer to TYPO3',
41  'versionString' => '8.4.0',
42  ]
43  ];
44 
51  public function checkForUpdate(&$description)
52  {
53  $description = 'The extensions "dbal" and "adodb" have been extracted to'
54  . ' the TYPO3 Extension Repository. This update downloads the TYPO3 Extension from the TER'
55  . ' if the two extensions are still needed.';
56 
57  return !$this->isWizardDone();
58  }
59 
66  public function getUserInput($inputPrefix)
67  {
68  return '
69  <div class="panel panel-danger">
70  <div class="panel-heading">Are you really sure?</div>
71  <div class="panel-body">
72  <p>You should install EXT:adodb and EXT:dbal only if you really need it.</p>
73  <p>This update wizard cannot check if the extension was installed before the update.</p>
74  <p>Are you really sure, you want to install these two extensions?</p>
75  <p>They are only needed if this instance connects to a database server that is NOT MySQL
76  and if an active extension uses $GLOBALS[\'TYPO3_DB\'] and a table mapping for EXT:dbal
77  is configured.</p>
78  <p>Loading these two extensions is a rather seldom exceptions, the vast majority of
79  instances should say "no" here.</p>
80  <div class="btn-group clearfix" data-toggle="buttons">
81  <label class="btn btn-default active">
82  <input type="radio" name="' . $inputPrefix . '[install]" value="0" checked="checked" /> no, don\'t install
83  </label>
84  <label class="btn btn-default">
85  <input type="radio" name="' . $inputPrefix . '[install]" value="1" /> yes, please install
86  </label>
87  </div>
88  </div>
89  </div>
90  ';
91  }
92 
100  public function performUpdate(array &$databaseQueries, &$customMessages)
101  {
102  $requestParams = GeneralUtility::_GP('install');
103  if (!isset($requestParams['values']['TYPO3\CMS\Install\Updates\DbalAndAdodbExtractionUpdate']['install'])) {
104  return false;
105  }
106  $install = (int)$requestParams['values']['TYPO3\CMS\Install\Updates\DbalAndAdodbExtractionUpdate']['install'];
107 
108  if ($install === 1) {
109  // user decided to install extensions, install and mark wizard as done
110  $adodbSuccessful = $this->installExtension('adodb', $customMessages);
111  $dbalSuccessful = $this->installExtension('dbal', $customMessages);
112  if ($adodbSuccessful && $dbalSuccessful) {
113  $this->markWizardAsDone();
114  return true;
115  }
116  } else {
117  // user decided to not install extension, mark wizard as done
118  $this->markWizardAsDone();
119  return true;
120  }
121  return false;
122  }
123 }