2 namespace TYPO3\CMS\Install\Controller\Action\Step;
35 $configurationManager = $this->objectManager->get(ConfigurationManager::class);
43 if (strlen($password) < 8) {
44 $errorStatus = $this->objectManager->get(ErrorStatus::class);
45 $errorStatus->setTitle(
'Administrator password not secure enough!');
46 $errorStatus->setMessage(
47 'You are setting an important password here! It gives an attacker full control over your instance if cracked.' .
48 ' It should be strong (include lower and upper case characters, special characters and numbers) and must be at least eight characters long.'
50 $result[] = $errorStatus;
56 $configurationManager->setLocalConfigurationValueByPath(
'SYS/sitename',
$postValues[
'sitename']);
59 $result = $this->importDatabaseData();
60 if (!empty($result)) {
65 $adminUserFields = array(
66 'username' => $username,
72 if (
false === $this->getDatabaseConnection()->exec_INSERTquery(
'be_users', $adminUserFields)) {
73 $errorStatus = $this->objectManager->get(ErrorStatus::class);
74 $errorStatus->setTitle(
'Administrator account not created!');
75 $errorStatus->setMessage(
76 'The administrator account could not be created. The following error occurred:' . LF .
77 $this->getDatabaseConnection()->sql_error()
79 $result[] = $errorStatus;
84 $configurationManager->setLocalConfigurationValueByPath(
'BE/installToolPassword', $this->
getHashedPassword($password));
99 $existingTables = $this->getDatabaseConnection()->admin_get_tables();
100 if (empty($existingTables)) {
116 return $this->view->render();
124 protected function importDatabaseData()
133 $database = $this->getDatabaseConnection();
135 $schemaMigrationService = $this->objectManager->get(\TYPO3\CMS\Install\Service\SqlSchemaMigrationService::class);
137 $expectedSchemaService = $this->objectManager->get(\TYPO3\CMS\Install\Service\SqlExpectedSchemaService::class);
140 $expectedSchemaString = $expectedSchemaService->getTablesDefinitionString(
true);
141 $statements = $schemaMigrationService->getStatementArray($expectedSchemaString,
true);
142 list($_, $insertCount) = $schemaMigrationService->getCreateTables($statements,
true);
143 $fieldDefinitionsFile = $schemaMigrationService->getFieldDefinitions_fileContent($expectedSchemaString);
144 $fieldDefinitionsDatabase = $schemaMigrationService->getFieldDefinitions_database();
145 $difference = $schemaMigrationService->getDatabaseExtra($fieldDefinitionsFile, $fieldDefinitionsDatabase);
146 $updateStatements = $schemaMigrationService->getUpdateSuggestions($difference);
148 foreach (array(
'add',
'change',
'create_table') as
$action) {
149 $updateStatus = $schemaMigrationService->performUpdateQueries($updateStatements[$action], $updateStatements[$action]);
150 if ($updateStatus !==
true) {
151 foreach ($updateStatus as $statementIdentifier => $errorMessage) {
152 $result[$updateStatements[
$action][$statementIdentifier]] = $errorMessage;
157 if (empty($result)) {
158 foreach ($insertCount as $table => $count) {
159 $insertStatements = $schemaMigrationService->getTableInsertStatements($statements, $table);
160 foreach ($insertStatements as $insertQuery) {
161 $insertQuery = rtrim($insertQuery,
';');
162 $database->admin_query($insertQuery);
163 if ($database->sql_error()) {
164 $result[$insertQuery] = $database->sql_error();
170 foreach ($result as $statement => &$message) {
171 $errorStatus = $this->objectManager->get(ErrorStatus::class);
172 $errorStatus->setTitle(
'Database query failed!');
173 $errorStatus->setMessage(
175 ' ' . $statement . LF .
179 $message = $errorStatus;
182 return array_values($result);
190 $this->objectManager->get(ConfigurationManager::class)
191 ->setLocalConfigurationValueByPath(
'SYS/isInitialDatabaseImportDone',
true);
201 return $this->objectManager->get(ConfigurationManager::class)
202 ->getConfigurationValueByPath(
'SYS/isInitialDatabaseImportDone');