42 $initialUpdateDatabaseSchemaUpdateObject = $this->
getUpgradeObjectInstance(
'TYPO3\\CMS\\Install\\Updates\\InitialDatabaseSchemaUpdate',
'initialUpdateDatabaseSchema');
43 if ($initialUpdateDatabaseSchemaUpdateObject->shouldRenderWizard()) {
44 $GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ext/install'][
'update'] = array_merge(
45 array(
'initialUpdateDatabaseSchema' =>
'TYPO3\\CMS\\Install\\Updates\\InitialDatabaseSchemaUpdate'),
46 $GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ext/install'][
'update']
48 $this->needsInitialUpdateDatabaseSchema = TRUE;
52 $finalUpdateDatabaseSchemaUpdateObject = $this->
getUpgradeObjectInstance(
'TYPO3\\CMS\\Install\\Updates\\FinalDatabaseSchemaUpdate',
'finalUpdateDatabaseSchema');
53 if ($finalUpdateDatabaseSchemaUpdateObject->shouldRenderWizard()) {
54 $GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ext/install'][
'update'][
'finalUpdateDatabaseSchema'] =
'TYPO3\\CMS\\Install\\Updates\\FinalDatabaseSchemaUpdate';
58 $this->silentCacheFrameworkTableSchemaMigration();
60 $actionMessages = array();
62 if (isset($this->postValues[
'set'][
'getUserInput'])) {
63 $actionMessages[] = $this->getUserInputForUpgradeWizard();
64 $this->view->assign(
'updateAction',
'getUserInput');
65 } elseif (isset($this->postValues[
'set'][
'performUpdate'])) {
66 $actionMessages[] = $this->performUpdate();
67 $this->view->assign(
'updateAction',
'performUpdate');
69 $actionMessages[] = $this->listUpdates();
70 $this->view->assign(
'updateAction',
'listUpdates');
73 $this->view->assign(
'actionMessages', $actionMessages);
75 return $this->view->render();
83 protected function listUpdates() {
84 if (empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ext/install'][
'update'])) {
86 $message = $this->objectManager->get(
'TYPO3\\CMS\\Install\\Status\\WarningStatus');
87 $message->setTitle(
'No update wizards registered');
91 $availableUpdates = array();
92 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ext/install'][
'update'] as $identifier => $className) {
94 if ($updateObject->shouldRenderWizard()) {
97 $updateObject->checkForUpdate($explanation);
98 $availableUpdates[$identifier] = array(
99 'identifier' => $identifier,
100 'title' => $updateObject->getTitle(),
101 'explanation' => $explanation,
102 'renderNext' => FALSE,
104 if ($identifier ===
'initialUpdateDatabaseSchema') {
106 } elseif ($identifier ===
'finalUpdateDatabaseSchema') {
108 $availableUpdates[
'finalUpdateDatabaseSchema'][
'renderNext'] = count($availableUpdates) === 1;
109 } elseif (!$this->needsInitialUpdateDatabaseSchema && $updateObject->shouldRenderNextButton()) {
111 $availableUpdates[$identifier][
'renderNext'] = TRUE;
116 $this->view->assign(
'availableUpdates', $availableUpdates);
119 $message = $this->objectManager->get(
'TYPO3\\CMS\\Install\\Status\\OkStatus');
120 $message->setTitle(
'Show available update wizards');
129 protected function getUserInputForUpgradeWizard() {
130 $wizardIdentifier = $this->postValues[
'values'][
'identifier'];
132 $className =
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ext/install'][
'update'][$wizardIdentifier];
135 if (method_exists($updateObject,
'getUserInput')) {
136 $wizardHtml = $updateObject->getUserInput(
'install[values][' . $wizardIdentifier .
']');
139 $upgradeWizardData = array(
140 'identifier' => $wizardIdentifier,
141 'title' => $updateObject->getTitle(),
142 'wizardHtml' => $wizardHtml,
145 $this->view->assign(
'upgradeWizardData', $upgradeWizardData);
148 $message = $this->objectManager->get(
'TYPO3\\CMS\\Install\\Status\\OkStatus');
149 $message->setTitle(
'Show wizard options');
159 protected function performUpdate() {
162 $wizardIdentifier = $this->postValues[
'values'][
'identifier'];
163 $className =
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ext/install'][
'update'][$wizardIdentifier];
167 'identifier' => $wizardIdentifier,
168 'title' => $updateObject->getTitle(),
172 $wizardInputErrorMessage =
'';
173 if (method_exists($updateObject,
'checkUserInput') && !$updateObject->checkUserInput($wizardInputErrorMessage)) {
175 $message = $this->objectManager->get(
'TYPO3\\CMS\\Install\\Status\\ErrorStatus');
176 $message->setTitle(
'Input parameter broken');
177 $message->setMessage($wizardInputErrorMessage ?:
'Something went wrong!');
178 $wizardData[
'wizardInputBroken'] = TRUE;
180 if (!method_exists($updateObject,
'performUpdate')) {
181 throw new \TYPO3\CMS\Install\Exception(
182 'No performUpdate method in update wizard with identifier ' . $wizardIdentifier,
189 $databaseQueries = array();
190 $performResult = $updateObject->performUpdate($databaseQueries, $customOutput);
192 if ($performResult) {
194 $message = $this->objectManager->get(
'TYPO3\\CMS\\Install\\Status\\OkStatus');
195 $message->setTitle(
'Update successful');
198 $message = $this->objectManager->get(
'TYPO3\\CMS\\Install\\Status\\ErrorStatus');
199 $message->setTitle(
'Update failed!');
201 $message->setMessage($customOutput);
205 if ($this->postValues[
'values'][
'showDatabaseQueries'] == 1) {
206 $wizardData[
'queries'] = $databaseQueries;
210 $this->view->assign(
'wizardData', $wizardData);
216 $nextUpgradeWizardIdentifier =
'';
217 if ($nextUpgradeWizard) {
218 $nextUpgradeWizardIdentifier = $nextUpgradeWizard->getIdentifier();
220 $this->view->assign(
'nextUpgradeWizardIdentifier', $nextUpgradeWizardIdentifier);
235 $updateObject->setIdentifier($identifier);
237 $updateObject->pObj = $this;
238 $updateObject->userInput = $formValues[
'values'][$identifier];
239 return $updateObject;
250 $isPreviousRecord = TRUE;
251 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ext/install'][
'update'] as $identifier => $className) {
253 if ($currentObj->getIdentifier() == $identifier) {
254 $isPreviousRecord = FALSE;
256 if ($identifier !==
'initialUpdateDatabaseSchema' && $identifier !==
'finalUpdateDatabaseSchema') {
260 if (!$isPreviousRecord) {
262 if ($nextUpgradeWizard->shouldRenderWizard()) {
263 return $nextUpgradeWizard;
276 protected function silentCacheFrameworkTableSchemaMigration() {
278 $sqlHandler = $this->objectManager->get(
'TYPO3\\CMS\\Install\\Service\\SqlSchemaMigrationService');
281 $cachingFrameworkDatabaseSchemaService = $this->objectManager->get(
'TYPO3\\CMS\\Install\\Service\\CachingFrameworkDatabaseSchemaService');
282 $expectedSchemaString = $cachingFrameworkDatabaseSchemaService->getCachingFrameworkRequiredDatabaseSchema();
283 $cleanedExpectedSchemaString = implode(LF, $sqlHandler->getStatementArray($expectedSchemaString, TRUE,
'^CREATE TABLE '));
284 $neededTableDefinition = $sqlHandler->getFieldDefinitions_fileContent($cleanedExpectedSchemaString);
285 $currentTableDefinition = $sqlHandler->getFieldDefinitions_database();
286 $updateTableDefinition = $sqlHandler->getDatabaseExtra($neededTableDefinition, $currentTableDefinition);
287 $updateStatements = $sqlHandler->getUpdateSuggestions($updateTableDefinition);
288 if (isset($updateStatements[
'create_table']) && count($updateStatements[
'create_table']) > 0) {
289 $sqlHandler->performUpdateQueries($updateStatements[
'create_table'], $updateStatements[
'create_table']);
291 if (isset($updateStatements[
'add']) && count($updateStatements[
'add']) > 0) {
292 $sqlHandler->performUpdateQueries($updateStatements[
'add'], $updateStatements[
'add']);
294 if (isset($updateStatements[
'change']) && count($updateStatements[
'change']) > 0) {
295 $sqlHandler->performUpdateQueries($updateStatements[
'change'], $updateStatements[
'change']);
loadExtLocalconfDatabaseAndExtTables()
static getUserObj($classRef, $checkPrefix='', $silent=FALSE)
static convertVersionNumberToInteger($versionNumber)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]