[BUGFIX] Limit FileTableSplittingUpdate to TYPO3 6.0/6.1 24/29024/6
authorAlexander Opitz <opitz.alexander@googlemail.com>
Tue, 1 Apr 2014 12:56:04 +0000 (14:56 +0200)
committerMarc Bastian Heinrichs <typo3@mbh-software.de>
Sun, 4 May 2014 12:15:54 +0000 (14:15 +0200)
If the database field does not exist it may be that we have an
installation before 6.0 or after 6.1 so we do not need to migrate
the data to sys_file_metadata. This prevents empty metadata
information which may lead to other issues.
(width/height=0 for images)

Resolves: #57492
Related: #46020
Releases: 6.2
Change-Id: Id5826ea480d4139f2e232587fc2b119928b28bc8
Reviewed-on: https://review.typo3.org/29024
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Wouter Wolters
Reviewed-by: Nicole Cordes
Reviewed-by: Anja Leichsenring
Reviewed-by: Jan Runte
Reviewed-by: Marc Bastian Heinrichs
Tested-by: Marc Bastian Heinrichs
typo3/sysext/install/Classes/Updates/FileTableSplittingUpdate.php

index 7980237..33849a1 100644 (file)
@@ -60,9 +60,14 @@ class FileTableSplittingUpdate extends AbstractUpdate {
                if (!array_key_exists($this->metaDataTable, $GLOBALS['TYPO3_DB']->admin_get_tables())) {
                        $result = TRUE;
                } else {
-                       $sysFileCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'sys_file');
-                       $sysFileMetaDataCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', $this->metaDataTable);
-                       $result = $sysFileCount > $sysFileMetaDataCount;
+                       $fields = $GLOBALS['TYPO3_DB']->admin_get_fields('sys_file');
+                       // Check if the field exists on sys_file if not there is no data to migrate (TYPO3 < 6.0 or >= 6.2)
+                       if (isset($fields['width']) && isset($fields['height'])) {
+                               // Check if the 1:1 integrity is ok, if not we need to migrate the metadata.
+                               $sysFileCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'sys_file');
+                               $sysFileMetaDataCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', $this->metaDataTable);
+                               $result = $sysFileCount > $sysFileMetaDataCount;
+                       }
                }
 
                return $result;