[BUGFIX] l10n_state field is not created when installing an extension 80/52080/3
authorOliver Hader <oliver@typo3.org>
Fri, 17 Mar 2017 12:23:59 +0000 (13:23 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 17 Mar 2017 13:13:32 +0000 (14:13 +0100)
l10n_state fields are not created automatically when installing an
extension since there is no slot defined for the according signal
InstallUtility::tablesDefinitionIsBeingBuilt.

Change-Id: Ib4d05d3c3a2dde9b6d0a77f89dee650a3872544d
Resolves: #80271
Releases: master
Reviewed-on: https://review.typo3.org/52080
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/DataHandling/DatabaseSchemaService.php
typo3/sysext/core/ext_localconf.php

index 2505395..b180678 100644 (file)
@@ -25,10 +25,41 @@ class DatabaseSchemaService
     /**
      * Add l10n_state field to tables that provide localization
      *
     /**
      * Add l10n_state field to tables that provide localization
      *
+     * @param array $sqlString Current SQL statements to be executed
      * @return string Localization fields database schema
      */
     public function getLocalizationRequiredDatabaseSchema(array $sqlString)
     {
      * @return string Localization fields database schema
      */
     public function getLocalizationRequiredDatabaseSchema(array $sqlString)
     {
+        $additionalSqlString = $this->buildLocalizationRequiredDatabaseSchema();
+        if (!empty($additionalSqlString)) {
+            $sqlString[] = $additionalSqlString;
+        }
+        return ['sqlString' => $sqlString];
+    }
+
+    /**
+     * Add l10n_state field to tables that provide localization
+     *
+     * @param array $sqlString Current SQL statements to be executed
+     * @param string $extensionKey Extension key currently processed
+     * @return string Localization fields database schema
+     */
+    public function getLocalizationRequiredDatabaseSchemaForExtension(array $sqlString, string $extensionKey)
+    {
+        $additionalSqlString = $this->buildLocalizationRequiredDatabaseSchema();
+        if (!empty($additionalSqlString)) {
+            $sqlString[] = $additionalSqlString;
+        }
+        return ['sqlString' => $sqlString, 'extensionKey' => $extensionKey];
+    }
+
+    /**
+     * Add l10n_state field to tables that provide localization
+     *
+     * @return string Localization fields database schema
+     */
+    protected function buildLocalizationRequiredDatabaseSchema()
+    {
         $tableSchemas = [];
 
         foreach ($GLOBALS['TCA'] as $tableName => $tableDefinition) {
         $tableSchemas = [];
 
         foreach ($GLOBALS['TCA'] as $tableName => $tableDefinition) {
@@ -50,10 +81,6 @@ class DatabaseSchemaService
             );
         }
 
             );
         }
 
-        if (!empty($tableSchemas)) {
-            $sqlString[] = implode(LF, $tableSchemas);
-        }
-
-        return ['sqlString' => $sqlString];
+        return implode(LF, $tableSchemas);
     }
 }
     }
 }
index 355e81b..89fc87c 100644 (file)
@@ -76,6 +76,13 @@ $signalSlotDispatcher->connect(
     'getLocalizationRequiredDatabaseSchema'
 );
 
     'getLocalizationRequiredDatabaseSchema'
 );
 
+$signalSlotDispatcher->connect(
+    \TYPO3\CMS\Extensionmanager\Utility\InstallUtility::class,
+    'tablesDefinitionIsBeingBuilt',
+    \TYPO3\CMS\Core\DataHandling\DatabaseSchemaService::class,
+    'getLocalizationRequiredDatabaseSchemaForExtension'
+);
+
 unset($signalSlotDispatcher);
 
 $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['dumpFile'] = \TYPO3\CMS\Core\Controller\FileDumpController::class . '::dumpAction';
 unset($signalSlotDispatcher);
 
 $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['dumpFile'] = \TYPO3\CMS\Core\Controller\FileDumpController::class . '::dumpAction';