[TASK] Remove old updates for upgrade wizard 76/33476/9
authorMarkus Klein <klein.t3@reelworx.at>
Wed, 22 Oct 2014 19:45:00 +0000 (21:45 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 1 Nov 2014 21:49:55 +0000 (22:49 +0100)
This patch removes all upgrade wizard updates before version 7.
The old [wizardDone] LocalConfiguration entries are removed with the
SilentConfigurationUpgradeService.

Resolves: #62402
Releases: master
Change-Id: If5aff37a8caf8e74eebac8ff857bcf9be8cd0092
Reviewed-on: http://review.typo3.org/33476
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
30 files changed:
typo3/sysext/cms/ext_localconf.php
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/core/Configuration/FactoryConfiguration.php
typo3/sysext/core/Configuration/TCA/Overrides/compatibility.php
typo3/sysext/core/Migrations/Code/LegacyClassesForIde.php
typo3/sysext/css_styled_content/ext_localconf.php
typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php
typo3/sysext/install/Classes/Updates/AbstractUpdate.php
typo3/sysext/install/Classes/Updates/BackendUserStartModuleUpdate.php
typo3/sysext/install/Classes/Updates/CompatVersionUpdate.php
typo3/sysext/install/Classes/Updates/ExtensionManagerTables.php [deleted file]
typo3/sysext/install/Classes/Updates/FileIdentifierHashUpdate.php [deleted file]
typo3/sysext/install/Classes/Updates/FilePermissionUpdate.php [deleted file]
typo3/sysext/install/Classes/Updates/FileTableSplittingUpdate.php [deleted file]
typo3/sysext/install/Classes/Updates/FilemountUpdateWizard.php [deleted file]
typo3/sysext/install/Classes/Updates/FinalDatabaseSchemaUpdate.php
typo3/sysext/install/Classes/Updates/InitUpdateWizard.php [deleted file]
typo3/sysext/install/Classes/Updates/InitialDatabaseSchemaUpdate.php
typo3/sysext/install/Classes/Updates/InstallerProcessInterface.php [deleted file]
typo3/sysext/install/Classes/Updates/MediaFlexformUpdate.php [deleted file]
typo3/sysext/install/Classes/Updates/ReferenceIntegrityUpdateWizard.php [deleted file]
typo3/sysext/install/Classes/Updates/RootTemplateUpdate.php [deleted file]
typo3/sysext/install/Classes/Updates/RteFileLinksUpdateWizard.php [deleted file]
typo3/sysext/install/Classes/Updates/RteMagicImagesUpdateWizard.php [deleted file]
typo3/sysext/install/Classes/Updates/TceformsUpdateWizard.php [deleted file]
typo3/sysext/install/Classes/Updates/TruncateSysFileProcessedFileTable.php [deleted file]
typo3/sysext/install/Classes/Updates/TtContentUploadsUpdateWizard.php [deleted file]
typo3/sysext/install/Migrations/Code/ClassAliasMap.php
typo3/sysext/install/ext_localconf.php
typo3/sysext/rtehtmlarea/Classes/Hook/Install/DeprecatedRteProperties.php

index 0da0a69..12d0bc3 100644 (file)
@@ -178,15 +178,6 @@ mod.wizards.newContentElement {
 
 ');
 
-
-if ((TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_INSTALL)) {
-       $TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['compat_version']['cms'] = array(
-               'title' => 'CMS Frontend',
-               'version' => 4000000,
-               'description' => '<ul>' . '<li><p>The extension simluatestatic has been removed in TYPO3 6.0</p></li>' . '<li><p>CSS Stylesheets and JavaScript are put into an external file by default.</p>' . '<p>Technically, that means that the default value of "config.inlineStyle2TempFile" is now set to "1" and that of "config.removeDefaultJS" to "external"</p></li>' . '</ul>'
-       );
-}
-
 // Registering hooks for the treelist cache
 $TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = 'TYPO3\\CMS\\Frontend\\Hooks\\TreelistCacheUpdateHooks';
 $TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'][] = 'TYPO3\\CMS\\Frontend\\Hooks\\TreelistCacheUpdateHooks';
index 9d1982e..5cc6c1e 100644 (file)
@@ -779,12 +779,8 @@ class GeneralUtility {
         * @todo Still needs a function to convert versions to branches
         */
        static public function compat_version($verNumberStr) {
-               $currVersionStr = $GLOBALS['TYPO3_CONF_VARS']['SYS']['compat_version'] ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['compat_version'] : TYPO3_branch;
-               if (VersionNumberUtility::convertVersionNumberToInteger($currVersionStr) < VersionNumberUtility::convertVersionNumberToInteger($verNumberStr)) {
-                       return FALSE;
-               } else {
-                       return TRUE;
-               }
+               $currVersionStr = $GLOBALS['TYPO3_CONF_VARS']['SYS']['compat_version'] ?: TYPO3_branch;
+               return VersionNumberUtility::convertVersionNumberToInteger($currVersionStr) >= VersionNumberUtility::convertVersionNumberToInteger($verNumberStr);
        }
 
        /**
index dae2c7e..d9b51fb 100644 (file)
@@ -41,7 +41,7 @@ return array(
                'jpg_quality' => '80',
        ),
        'SYS' => array(
-               'compat_version' => '6.2',
+               'compat_version' => '7.0',
                'isInitialInstallationInProgress' => TRUE,
                'sitename' => 'New TYPO3 site',
        ),
index 6a7237d..d3b1a69 100644 (file)
@@ -43,29 +43,3 @@ if (!\TYPO3\CMS\Core\Utility\GeneralUtility::compat_version('4.2')) {
        '
        );
 }
-
-// Keep old code (pre-FAL) for installations that haven't upgraded yet. please remove this code in TYPO3 6.2
-// @deprecated since TYPO3 6.0, please remove at earliest in TYPO3 6.2
-if (
-       (
-               !isset($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone']['TYPO3\\CMS\\Install\\Updates\\TceformsUpdateWizard'])
-               || !\TYPO3\CMS\Core\Utility\GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone']['TYPO3\\CMS\\Install\\Updates\\TceformsUpdateWizard'], 'pages:media')
-       )
-       && !\TYPO3\CMS\Core\Utility\GeneralUtility::compat_version('6.0')
-) {
-       \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog(
-               'This installation hasn\'t been migrated to FAL for the field $GLOBALS[TCA][pages][columns][media] yet. Please do so before TYPO3 v7.'
-       );
-       // existing installation and no upgrade wizard was executed - and files haven't been merged: use the old code
-       $GLOBALS['TCA']['pages']['columns']['media']['config'] = array(
-               'type' => 'group',
-               'internal_type' => 'file',
-               'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] . ',html,htm,ttf,txt,css',
-               'max_size' => $GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'],
-               'uploadfolder' => 'uploads/media',
-               'show_thumbs' => '1',
-               'size' => '3',
-               'maxitems' => '100',
-               'minitems' => '0'
-       );
-}
index 9a173e9..e846d7a 100644 (file)
@@ -4631,76 +4631,11 @@ class tx_infopagetsconfig_webinfo extends \TYPO3\CMS\InfoPagetsconfig\Controller
 /**
  * @deprecated since 6.0 will be removed in 7.0
  */
-class tx_coreupdates_addflexformstoacl extends \TYPO3\CMS\Install\Updates\AddFlexFormsToAclUpdate {}
-
-/**
- * @deprecated since 6.0 will be removed in 7.0
- */
-class tx_coreupdates_charsetDefaults extends \TYPO3\CMS\Install\Updates\CharsetDefaultsUpdate {}
-
-/**
- * @deprecated since 6.0 will be removed in 7.0
- */
 class tx_coreupdates_compatversion extends \TYPO3\CMS\Install\Updates\CompatVersionUpdate {}
 
 /**
  * @deprecated since 6.0 will be removed in 7.0
  */
-class tx_coreupdates_compressionlevel extends \TYPO3\CMS\Install\Updates\CompressionLevelUpdate {}
-
-/**
- * @deprecated since 6.0 will be removed in 7.0
- */
-class tx_coreupdates_cscsplit extends \TYPO3\CMS\Install\Updates\CscSplitUpdate {}
-
-/**
- * @deprecated since 6.0 will be removed in 7.0
- */
-class tx_coreupdates_flagsfromsprite extends \TYPO3\CMS\Install\Updates\FlagsFromSpriteUpdate {}
-
-/**
- * @deprecated since 6.0 will be removed in 7.0
- */
-class tx_coreupdates_imagecols extends \TYPO3\CMS\Install\Updates\ImagecolsUpdate {}
-
-/**
- * @deprecated since 6.0 will be removed in 7.0
- */
-class tx_coreupdates_imagelink extends \TYPO3\CMS\Install\Updates\ImagelinkUpdate {}
-
-/**
- * @deprecated since 6.0 will be removed in 7.0
- */
-class tx_coreupdates_installsysexts extends \TYPO3\CMS\Install\Updates\InstallSysExtsUpdate {}
-
-/**
- * @deprecated since 6.0 will be removed in 7.0
- */
-class tx_coreupdates_mediaFlexform extends \TYPO3\CMS\Install\Updates\MediaFlexformUpdate {}
-
-/**
- * @deprecated since 6.0 will be removed in 7.0
- */
-class tx_coreupdates_mergeadvanced extends \TYPO3\CMS\Install\Updates\MergeAdvancedUpdate {}
-
-/**
- * @deprecated since 6.0 will be removed in 7.0
- */
-class tx_coreupdates_migrateworkspaces extends \TYPO3\CMS\Install\Updates\MigrateWorkspacesUpdate {}
-
-/**
- * @deprecated since 6.0 will be removed in 7.0
- */
-class tx_coreupdates_notinmenu extends \TYPO3\CMS\Install\Updates\NotInMenuUpdate {}
-
-/**
- * @deprecated since 6.0 will be removed in 7.0
- */
-class tx_coreupdates_t3skin extends \TYPO3\CMS\Install\Updates\T3skinUpdate {}
-
-/**
- * @deprecated since 6.0 will be removed in 7.0
- */
 class Tx_Install_Service_BasicService extends \TYPO3\CMS\Install\Service\EnableFileService {}
 
 /**
@@ -4726,26 +4661,6 @@ abstract class Tx_Install_Updates_Base extends \TYPO3\CMS\Install\Updates\Abstra
 /**
  * @deprecated since 6.0 will be removed in 7.0
  */
-class Tx_Install_Updates_File_FilemountUpdateWizard extends \TYPO3\CMS\Install\Updates\FilemountUpdateWizard {}
-
-/**
- * @deprecated since 6.0 will be removed in 7.0
- */
-class Tx_Install_Updates_File_InitUpdateWizard extends \TYPO3\CMS\Install\Updates\InitUpdateWizard {}
-
-/**
- * @deprecated since 6.0 will be removed in 7.0
- */
-class Tx_Install_Updates_File_TceformsUpdateWizard extends \TYPO3\CMS\Install\Updates\TceformsUpdateWizard {}
-
-/**
- * @deprecated since 6.0 will be removed in 7.0
- */
-class Tx_Install_Updates_File_TtContentUploadsUpdateWizard extends \TYPO3\CMS\Install\Updates\TtContentUploadsUpdateWizard {}
-
-/**
- * @deprecated since 6.0 will be removed in 7.0
- */
 class language extends \TYPO3\CMS\Lang\LanguageService {}
 
 /**
index 8b32aec..1d84f1a 100644 (file)
@@ -12,12 +12,6 @@ if (!$_EXTCONF || $_EXTCONF['removePositionTypes']) {
        ');
 }
 
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['compat_version']['tx_cssstyledcontent_headertag'] = array(
-       'title' => 'CSS Styled Content: &lt;header&gt; tag only when needed',
-       'version' => 6002000,
-       'description' => '<p>lib.stdheader: The &lt;header&gt; tag now only wraps the header if the header element has a date set, else the output is just a straight &lt;hX&gt; tag.</p>',
-);
-
 // Mark the delivered TypoScript templates as "content rendering template" (providing the hooks of "static template 43" = content (default))
 $GLOBALS['TYPO3_CONF_VARS']['FE']['contentRenderingTemplates'][] = 'cssstyledcontent/static/';
 $GLOBALS['TYPO3_CONF_VARS']['FE']['contentRenderingTemplates'][] = 'cssstyledcontent/static/v6.2/';
index 0d6e8a5..f4079a8 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Install\Service;
 
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Install\Controller\Exception\RedirectException;
 
 /**
  * Execute "silent" LocalConfiguration upgrades if needed.
@@ -43,79 +44,29 @@ class SilentConfigurationUpgradeService {
        protected $configurationManager = NULL;
 
        /**
-        * @var array List of obsolete configuration options in LocalConfiguration to be removed
+        * List of obsolete configuration options in LocalConfiguration to be removed
+        * Example:
+        *    // #forge-ticket
+        *    'BE/somesetting',
+        *
+        * @var array
         */
        protected $obsoleteLocalConfigurationSettings = array(
-               // #34092
-               'BE/forceCharset',
-               // #26519
-               'BE/loginLabels',
-               // #44506
-               'BE/loginNews',
-               // #52013
-               'BE/TSconfigConditions',
-               // #30613
-               'BE/useOnContextMenuHandler',
-               // #57921
-               'BE/usePHPFileFunctions',
-               // #48179
-               'EXT/em_mirrorListURL',
-               'EXT/em_wsdlURL',
-               // #43094
-               'EXT/extList',
-               // #47018
-               'EXT/extListArray',
-               // #35877
-               'EXT/extList_FE',
-               // #41813
-               'EXT/noEdit',
-               // #47018
-               'EXT/requiredExt',
-               // #26090
-               'FE/defaultTypoScript_editorcfg',
-               'FE/defaultTypoScript_editorcfg.',
-               // #25099
-               'FE/simulateStaticDocuments',
-               // #52786
-               'FE/logfile_dir',
-               // #55549
-               'FE/dontSetCookie',
-               // #52011
-               'GFX/im_combine_filename',
-               // #52088
-               'GFX/im_imvMaskState',
-               // #22687
-               'GFX/gdlib_2',
-               // #52012
-               'GFX/im_mask_temp_ext_noloss',
-               // #52088
-               'GFX/im_negate_mask',
-               // #52010
-               'GFX/im_no_effects',
-               // #18431
-               'GFX/noIconProc',
-               // #17606
-               'GFX/TTFLocaleConv',
-               // #39164
-               'SYS/additionalAllowedClassPrefixes',
-               // #27689
-               'SYS/caching/cacheBackends',
-               'SYS/caching/cacheFrontends',
-               // #38414
-               'SYS/extCache',
-               // #35923
-               'SYS/multiplyDBfieldSize',
-               // #46993
-               'SYS/T3instID',
-               // #52857
-               'SYS/forceReturnPath',
-           // #54930
-           'INSTALL/wizardDone/tx_coreupdates_compressionlevel',
-           'INSTALL/wizardDone/TYPO3\\CMS\\Install\\Updates\\CompressionLevelUpdate',
-           'INSTALL/wizardDone/tx_coreupdates_installsysexts',
-           'INSTALL/wizardDone/TYPO3\\CMS\\Install\\Updates\\InstallSysExtsUpdate',
-           'INSTALL/wizardDone/tx_coreupdates_migrateworkspaces',
-           'INSTALL/wizardDone/TYPO3\\CMS\\Install\\Updates\\MigrateWorkspacesUpdate',
+               // #62402
+               'INSTALL/wizardDone/TYPO3\\CMS\\Install\\Updates\\ExtensionManagerTables',
+               'INSTALL/wizardDone/TYPO3\\CMS\\Install\\Updates\\FileIdentifierHashUpdate',
+               'INSTALL/wizardDone/TYPO3\\CMS\\Install\\Updates\\FilemountUpdateWizard',
+               'INSTALL/wizardDone/TYPO3\\CMS\\Install\\Updates\\FilePermissionUpdate',
+               'INSTALL/wizardDone/TYPO3\\CMS\\Install\\Updates\\FileTableSplittingUpdate',
+               'INSTALL/wizardDone/TYPO3\\CMS\\Install\\Updates\\InitUpdateWizard',
+               'INSTALL/wizardDone/TYPO3\\CMS\\Install\\Updates\\MediaFlexformUpdate',
+               'INSTALL/wizardDone/TYPO3\\CMS\\Install\\Updates\\ReferenceIntegrityUpdateWizard',
+               'INSTALL/wizardDone/TYPO3\\CMS\\Install\\Updates\\RteFileLinksUpdateWizard',
+               'INSTALL/wizardDone/TYPO3\\CMS\\Install\\Updates\\RteMagicImagesUpdateWizard',
+               'INSTALL/wizardDone/TYPO3\\CMS\\Install\\Updates\\TceformsUpdateWizard',
+               'INSTALL/wizardDone/TYPO3\\CMS\\Install\\Updates\\TtContentUploadsUpdateWizard',
+               'INSTALL/wizardDone/TYPO3\\CMS\\Install\\Updates\\TruncateSysFileProcessedFileTable',
+               'INSTALL/wizardDone/TYPO3\\CMS\\Rtehtmlarea\\Hook\\Install\\DeprecatedRteProperties',
        );
 
        /**
@@ -128,12 +79,10 @@ class SilentConfigurationUpgradeService {
                $this->generateEncryptionKeyIfNeeded();
                $this->configureBackendLoginSecurity();
                $this->configureSaltedPasswords();
-               $this->migrateOldInstallWizardDoneSettingsToNewClassNames();
                $this->setProxyAuthScheme();
                $this->disableImageMagickAndGdlibIfImageProcessingIsDisabled();
                $this->disableImageMagickDetailSettingsIfImageMagickIsDisabled();
                $this->setImageMagickDetailSettings();
-               $this->addFileTableToDefaultCategorizedTablesIfAlreadyCustomized();
                $this->removeObsoleteLocalConfigurationSettings();
        }
 
@@ -148,13 +97,6 @@ class SilentConfigurationUpgradeService {
        protected function removeObsoleteLocalConfigurationSettings() {
                $removed = $this->configurationManager->removeLocalConfigurationKeysByPath($this->obsoleteLocalConfigurationSettings);
 
-               // The old default value is not needed anymore. So if the user
-               // did not set a different value we can remove it.
-               $currentSetDbInitValue = $this->configurationManager->getConfigurationValueByPath('SYS/setDBinit');
-               if (preg_match('/^\s*SET\s+NAMES\s+[\'"]?utf8[\'"]?\s*[;]?\s*$/i', $currentSetDbInitValue) === 1) {
-                       $removed = $removed || $this->configurationManager->removeLocalConfigurationKeysByPath(array('SYS/setDBinit'));
-               }
-
                // If something was changed: Trigger a reload to have new values in next request
                if ($removed) {
                        $this->throwRedirectException();
@@ -424,103 +366,12 @@ class SilentConfigurationUpgradeService {
        }
 
        /**
-        * Make sure file table is categorized as of TYPO3 6.2. To enable DAM Migration
-        * sys_file_metadata table is included in DefaultConfiguration.
-        * If the setting already has been modified but does not contain sys_file_metadata: add it
-        *
-        * @return void
-        */
-       protected function addFileTableToDefaultCategorizedTablesIfAlreadyCustomized() {
-               /** @var \TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager */
-               $configurationManager = $this->objectManager->get('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager');
-
-               $default = $configurationManager->getDefaultConfigurationValueByPath('SYS/defaultCategorizedTables');
-               try {
-                       $actual = $configurationManager->getLocalConfigurationValueByPath('SYS/defaultCategorizedTables');
-               } catch(\RuntimeException $e) {
-                       $actual = '';
-               }
-
-               $tables =  GeneralUtility::trimExplode(',', $actual);
-               if ($actual !== '' && $actual !== $default && !in_array('sys_file_metadata', $tables)) {
-                       $tables[] = 'sys_file_metadata';
-                       $configurationManager->setLocalConfigurationValueByPath('SYS/defaultCategorizedTables', implode(',', $tables));
-                       $this->throwRedirectException();
-               }
-       }
-
-       /**
-        * Migrate old Install Tool Wizard "done"-settings to new class names
-        * this happens usually when an existing 6.0/6.1 has called the TceformsUpdateWizard wizard
-        * and has written Tx_Install_Updates_File_TceformsUpdateWizard in TYPO3's LocalConfiguration.php
-        *
-        * @return void
-        */
-       protected function migrateOldInstallWizardDoneSettingsToNewClassNames() {
-               $classNamesToConvert = array();
-               $localConfiguration = $this->configurationManager->getLocalConfiguration();
-               // check for wizards that have been run already and don't start with TYPO3...
-               if (isset($localConfiguration['INSTALL']['wizardDone']) && is_array($localConfiguration['INSTALL']['wizardDone'])) {
-                       $classNames = array_keys($localConfiguration['INSTALL']['wizardDone']);
-                       foreach ($classNames as $className) {
-                               if (!GeneralUtility::isFirstPartOfStr($className, 'TYPO3')) {
-                                       $classNamesToConvert[] = $className;
-                               }
-                       }
-               }
-               if (!count($classNamesToConvert)) {
-                       return;
-               }
-
-               $migratedClassesMapping = array(
-                       'Tx_Install_Updates_File_TceformsUpdateWizard' => 'TYPO3\\CMS\\Install\\Updates\\TceformsUpdateWizard'
-               );
-
-               $migratedSettings = array();
-               $settingsToRemove = array();
-               foreach ($classNamesToConvert as $oldClassName) {
-                       if (isset($migratedClassesMapping[$oldClassName])) {
-                               $newClassName = $migratedClassesMapping[$oldClassName];
-                       } else {
-                               continue;
-                       }
-                       $oldValue = NULL;
-                       $newValue = NULL;
-                       try {
-                               $oldValue = $this->configurationManager->getLocalConfigurationValueByPath('INSTALL/wizardDone/' . $oldClassName);
-                       } catch (\RuntimeException $e) {
-                               // The old configuration does not exist
-                               continue;
-                       }
-                       try {
-                               $newValue = $this->configurationManager->getLocalConfigurationValueByPath('INSTALL/wizardDone/' . $newClassName);
-                       } catch (\RuntimeException $e) {
-                               // The new configuration does not exist yet
-                       }
-                       if ($newValue === NULL) {
-                               // Migrate the old configuration to the new one
-                               $migratedSettings['INSTALL/wizardDone/' . $newClassName] = $oldValue;
-                       }
-                       $settingsToRemove[] = 'INSTALL/wizardDone/' . $oldClassName;
-
-               }
-
-               if (count($migratedSettings)) {
-                       $this->configurationManager->setLocalConfigurationValuesByPathValuePairs($migratedSettings);
-               }
-               $this->configurationManager->removeLocalConfigurationKeysByPath($settingsToRemove);
-               if (count($migratedSettings) || count($settingsToRemove)) {
-                       $this->throwRedirectException();
-               }
-       }
-
-       /**
         * Throw exception after configuration change to trigger a redirect.
         *
-        * @throws \TYPO3\CMS\Install\Controller\Exception\RedirectException
+        * @throws RedirectException
         */
        protected function throwRedirectException() {
-               throw new \TYPO3\CMS\Install\Controller\Exception\RedirectException(
+               throw new RedirectException(
                        'Configuration updated, reload needed',
                        1379024938
                );
index 7757e06..060203b 100644 (file)
@@ -14,6 +14,9 @@ namespace TYPO3\CMS\Install\Updates;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Install\Controller\Action\Tool\UpgradeWizard;
+
 /**
  * Generic class that every update wizard class inherits from.
  * Used by the update wizard in the install tool.
@@ -39,7 +42,7 @@ abstract class AbstractUpdate {
        /**
         * Parent object
         *
-        * @var \TYPO3\CMS\Install\Installer
+        * @var UpgradeWizard
         */
        public $pObj;
 
@@ -127,7 +130,7 @@ abstract class AbstractUpdate {
                $showUpdate = 0;
                $explanation = '';
                $result = $this->checkForUpdate($explanation, $showUpdate);
-               return $showUpdate != 2 || $result == TRUE;
+               return $showUpdate != 2 || $result;
        }
 
        /**
@@ -137,7 +140,7 @@ abstract class AbstractUpdate {
         * @return bool
         */
        public function checkIfTableExists($table) {
-               $databaseTables = $GLOBALS['TYPO3_DB']->admin_get_tables();
+               $databaseTables = $this->getDatabaseConnection()->admin_get_tables();
                if (array_key_exists($table, $databaseTables)) {
                        return TRUE;
                }
@@ -170,7 +173,7 @@ abstract class AbstractUpdate {
         */
        protected function installExtensions(array $extensionKeys) {
                /** @var $installUtility \TYPO3\CMS\Extensionmanager\Utility\InstallUtility */
-               $installUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
+               $installUtility = GeneralUtility::makeInstance(
                        'TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility'
                );
                foreach ($extensionKeys as $extension) {
@@ -187,7 +190,8 @@ abstract class AbstractUpdate {
         * @return void
         */
        protected function markWizardAsDone($confValue = 1) {
-               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValueByPath('INSTALL/wizardDone/' . get_class($this), $confValue);
+               GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')
+                       ->setLocalConfigurationValueByPath('INSTALL/wizardDone/' . get_class($this), $confValue);
        }
 
        /**
@@ -207,4 +211,11 @@ abstract class AbstractUpdate {
                return $done;
        }
 
+       /**
+        * @return \TYPO3\CMS\Core\Database\DatabaseConnection
+        */
+       protected function getDatabaseConnection() {
+               return $GLOBALS['TYPO3_DB'];
+       }
+
 }
index a8b52c0..5b5372a 100644 (file)
@@ -51,21 +51,22 @@ class BackendUserStartModuleUpdate extends AbstractUpdate {
         * @return bool
         */
        public function performUpdate(array &$databaseQueries, &$customMessages) {
-               $backendUsers = $this->getDatabaseConnection()->exec_SELECTgetRows('uid,uc', 'be_users', '1=1');
+               $db = $this->getDatabaseConnection();
+               $backendUsers = $db->exec_SELECTgetRows('uid,uc', 'be_users', '1=1');
                if (!empty($backendUsers)) {
                        foreach ($backendUsers as $backendUser) {
                                if ($backendUser['uc'] !== NULL) {
                                        $userConfig = unserialize($backendUser['uc']);
                                        if ($userConfig['startModule'] === 'help_aboutmodules') {
                                                $userConfig['startModule'] = 'help_AboutmodulesAboutmodules';
-                                               $this->getDatabaseConnection()->exec_UPDATEquery(
+                                               $db->exec_UPDATEquery(
                                                        'be_users',
                                                        'uid=' . (int)$backendUser['uid'],
                                                        array(
                                                                'uc' => serialize($userConfig),
                                                        )
                                                );
-                                               $databaseQueries[] = $this->getDatabaseConnection()->debug_lastBuiltQuery;
+                                               $databaseQueries[] = $db->debug_lastBuiltQuery;
                                        }
                                }
                        }
@@ -74,13 +75,4 @@ class BackendUserStartModuleUpdate extends AbstractUpdate {
                $this->markWizardAsDone();
                return TRUE;
        }
-
-       /**
-        * Get database connection
-        *
-        * @return \TYPO3\CMS\Core\Database\DatabaseConnection
-        */
-       protected function getDatabaseConnection() {
-               return $GLOBALS['TYPO3_DB'];
-       }
 }
index a7b0fc5..1c0d5b2 100644 (file)
@@ -14,10 +14,21 @@ namespace TYPO3\CMS\Install\Updates;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\VersionNumberUtility;
+
 /**
  * Contains the update class for the compatibility version.
  * Used by the update wizard in the install tool.
  *
+ * The various checks are defined in ext_localconf.php with the following syntax
+ * $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['compat_version']['<internalName>'] = [
+ *      'title' => '',
+ *      'version' => '700000000',
+ *      'description' => '',
+ *      'description_acknowledge' => ''
+ * ];
+ *
  * @author Sebastian Kurf├╝rst <sebastian@garbage-group.de
  */
 class CompatVersionUpdate extends AbstractUpdate {
@@ -58,7 +69,7 @@ class CompatVersionUpdate extends AbstractUpdate {
        /**
         * Second step: get user input if needed
         *
-        * @param string Input prefix, all names of form fields have to start with this. Append custom name in [ ... ]
+        * @param string $inputPrefix All names of form fields have to start with this. Append custom name in [ ... ]
         * @return string HTML output
         */
        public function getUserInput($inputPrefix) {
@@ -74,12 +85,7 @@ class CompatVersionUpdate extends AbstractUpdate {
                                                        <select name="' . $inputPrefix . '[version]" id="version">
                        ';
                        $versions = array(
-                               '3.8' => '<= 3.8',
-                               '4.1' => '<= 4.1',
-                               '4.2' => '<= 4.2',
-                               '4.3' => '<= 4.3',
-                               '4.4' => '<= 4.4',
-                               '4.5' => '<= 4.5'
+                               '6.2' => '<= 6.2'
                        );
                        foreach ($versions as $singleVersion => $caption) {
                                $content .= '
@@ -129,31 +135,37 @@ class CompatVersionUpdate extends AbstractUpdate {
        /**
         * Checks if user input is valid
         *
-        * @param string Pointer to output custom messages
+        * @param string $customMessages Pointer to output custom messages
         * @return bool TRUE if user input is correct, then the update is performed. When FALSE, return to getUserInput
         */
        public function checkUserInput(&$customMessages) {
                if ($this->compatVersionIsCurrent()) {
                        return TRUE;
-               } else {
-                       if ($this->userInput['compatVersion']['all']) {
-                               return TRUE;
-                       } else {
-                               $performUpdate = TRUE;
-                               $oldVersion = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger($GLOBALS['TYPO3_CONF_VARS']['SYS']['compat_version']);
-                               $currentVersion = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_branch);
-                               foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['compat_version'] as $internalName => $details) {
-                                       if ($details['version'] > $oldVersion && $details['version'] <= $currentVersion) {
-                                               if (!$this->userInput['compatVersion'][$internalName]) {
-                                                       $performUpdate = FALSE;
-                                                       $customMessages = 'If you want to update the compatibility version, you need to confirm all checkboxes on the previous page.';
-                                                       break;
-                                               }
-                                       }
+               }
+               if ($this->userInput['compatVersion']['all']) {
+                       return TRUE;
+               }
+
+               if (
+                       !isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['compat_version'])
+                       || !is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['compat_version'])
+               ) {
+                       return TRUE;
+               }
+
+               $performUpdate = TRUE;
+               $oldVersion = VersionNumberUtility::convertVersionNumberToInteger($GLOBALS['TYPO3_CONF_VARS']['SYS']['compat_version']);
+               $newVersion = VersionNumberUtility::convertVersionNumberToInteger(TYPO3_branch);
+               foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['compat_version'] as $internalName => $details) {
+                       if ($details['version'] > $oldVersion && $details['version'] <= $newVersion) {
+                               if (!$this->userInput['compatVersion'][$internalName]) {
+                                       $performUpdate = FALSE;
+                                       $customMessages = 'If you want to update the compatibility version, you need to confirm all checkboxes on the previous page.';
+                                       break;
                                }
-                               return $performUpdate;
                        }
                }
+               return $performUpdate;
        }
 
        /**
@@ -170,7 +182,7 @@ class CompatVersionUpdate extends AbstractUpdate {
                        $customMessages .= 'If you want to see what you need to do to use the new features, run the update wizard again!';
                }
                $version = $this->userInput['version'] ? $this->userInput['version'] : TYPO3_branch;
-               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValueByPath('SYS/compat_version', $version);
+               GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValueByPath('SYS/compat_version', $version);
                $customMessages .= '<br />The compatibility version has been set to ' . $version . '.';
                return TRUE;
        }
@@ -181,50 +193,48 @@ class CompatVersionUpdate extends AbstractUpdate {
         * @return bool TRUE if compat version is equal the current version
         */
        protected function compatVersionIsCurrent() {
-               if (TYPO3_branch != $GLOBALS['TYPO3_CONF_VARS']['SYS']['compat_version']) {
-                       return FALSE;
-               } else {
-                       return TRUE;
-               }
+               return TYPO3_branch == $GLOBALS['TYPO3_CONF_VARS']['SYS']['compat_version'];
        }
 
        /**
         * Show changes needed
         *
-        * @param string Input prefix to prepend all form fields with.
+        * @param string $inputPrefix Input prefix to prepend all form fields with
         * @return string HTML output
         */
        protected function showChangesNeeded($inputPrefix = '') {
-               $oldVersion = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger($GLOBALS['TYPO3_CONF_VARS']['SYS']['compat_version']);
-               $currentVersion = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_branch);
-               $tableContents = '';
-               if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['compat_version'])) {
-                       $upgradeWizardBoxes = '';
-                       foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['compat_version'] as $internalName => $details) {
-                               if ($details['version'] > $oldVersion && $details['version'] <= $currentVersion) {
-                                       $description = str_replace(chr(10), '<br />', $details['description']);
-                                       $description_acknowledge = isset($details['description_acknowledge']) ? str_replace(chr(10), '<br />', $details['description_acknowledge']) : '';
-                                       $upgradeWizardBoxes .= '
-                                               <div style="border: 1px solid; padding: 10px; margin: 10px; padding-top: 0px; width: 500px;">
-                                                       <h3>' . (isset($details['title']) ? $details['title'] : $internalName) . '</h3>
-                                                       ' . $description . (strlen($description_acknowledge) ? '<p>' . $description_acknowledge . '</p>' : '') . (strlen($inputPrefix) ? '
-                                                               <fieldset>
-                                                                       <ol>
-                                                                               <li class="labelAfter">
-                                                                                       <input type="checkbox" name="' . $inputPrefix . '[compatVersion][' . $internalName . ']" id="compatVersion' . $internalName . '" value="1" />
-                                                                                       <label for="compatVersion' . $internalName . '">Acknowledged</label>
-                                                                               </li>
-                                                                       </ol>
-                                                               </fieldset>
-                                                       ' : '') . '
-                                               </div>';
-                               }
-                       }
+               if (
+                       !isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['compat_version'])
+                       || !is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['compat_version'])
+               ) {
+                       return '';
                }
-               if (strlen($upgradeWizardBoxes)) {
-                       return $upgradeWizardBoxes;
+
+               $oldVersion = VersionNumberUtility::convertVersionNumberToInteger($GLOBALS['TYPO3_CONF_VARS']['SYS']['compat_version']);
+               $newVersion = VersionNumberUtility::convertVersionNumberToInteger(TYPO3_branch);
+
+               $upgradeWizardBoxes = '';
+               foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['compat_version'] as $internalName => $details) {
+                       if ($details['version'] > $oldVersion && $details['version'] <= $newVersion) {
+                               $description = str_replace(chr(10), '<br />', $details['description']);
+                               $description_acknowledge = isset($details['description_acknowledge']) ? str_replace(chr(10), '<br />', $details['description_acknowledge']) : '';
+                               $upgradeWizardBoxes .= '
+                                       <div style="border: 1px solid; padding: 0 10px 10px 10px; margin: 10px; width: 500px;">
+                                               <h3>' . (isset($details['title']) ? $details['title'] : $internalName) . '</h3>
+                                               ' . $description . ($description_acknowledge !== '' ? '<p>' . $description_acknowledge . '</p>' : '') . ($inputPrefix !== '' ? '
+                                                       <fieldset>
+                                                               <ol>
+                                                                       <li class="labelAfter">
+                                                                               <input type="checkbox" name="' . $inputPrefix . '[compatVersion][' . $internalName . ']" id="compatVersion' . $internalName . '" value="1" />
+                                                                               <label for="compatVersion' . $internalName . '">Acknowledged</label>
+                                                                       </li>
+                                                               </ol>
+                                                       </fieldset>
+                                               ' : '') . '
+                                       </div>';
+                       }
                }
-               return '';
+               return $upgradeWizardBoxes;
        }
 
 }
diff --git a/typo3/sysext/install/Classes/Updates/ExtensionManagerTables.php b/typo3/sysext/install/Classes/Updates/ExtensionManagerTables.php
deleted file mode 100644 (file)
index 3f5e2ea..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\Updates;
-
-/**
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Contains the update class for filling the basic repository record of the extension manager
- *
- * @author Georg Ringer <typo3@ringerge.org>
- */
-class ExtensionManagerTables extends AbstractUpdate {
-
-       /**
-        * @var string
-        */
-       protected $title = 'Add the default Extension Manager database tables';
-
-       /**
-        * @var NULL|\TYPO3\CMS\Install\Service\SqlSchemaMigrationService
-        */
-       protected $installToolSqlParser = NULL;
-
-       /**
-        * @return \TYPO3\CMS\Install\Service\SqlSchemaMigrationService
-        */
-       protected function getInstallToolSqlParser() {
-               if ($this->installToolSqlParser === NULL) {
-                       $this->installToolSqlParser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Install\\Service\\SqlSchemaMigrationService');
-               }
-
-               return $this->installToolSqlParser;
-       }
-
-       /**
-        * Gets all create, add and change queries from ext_tables.sql
-        *
-        * @return array
-        */
-       protected function getUpdateStatements() {
-               $updateStatements = array();
-
-               // Get all necessary statements for ext_tables.sql file
-               $rawDefinitions = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('extensionmanager') . '/ext_tables.sql');
-               $fieldDefinitionsFromFile = $this->getInstallToolSqlParser()->getFieldDefinitions_fileContent($rawDefinitions);
-               if (count($fieldDefinitionsFromFile)) {
-                       $fieldDefinitionsFromCurrentDatabase = $this->getInstallToolSqlParser()->getFieldDefinitions_database();
-                       $diff = $this->getInstallToolSqlParser()->getDatabaseExtra($fieldDefinitionsFromFile, $fieldDefinitionsFromCurrentDatabase);
-                       $updateStatements = $this->getInstallToolSqlParser()->getUpdateSuggestions($diff);
-               }
-
-               return $updateStatements;
-       }
-
-       /**
-        * Checks if an update is needed
-        *
-        * @param string &$description The description for the update
-        * @return bool Whether an update is needed (TRUE) or not (FALSE)
-        */
-       public function checkForUpdate(&$description) {
-               $result = FALSE;
-               $description = 'Creates necessary database tables and adds static tables for the new Extension Manager.';
-
-               // First check necessary database update
-               $updateStatements = $this->getUpdateStatements();
-               if (empty($updateStatements)) {
-                       // Check for repository database table
-                       $databaseTables = $GLOBALS['TYPO3_DB']->admin_get_tables();
-                       if (!isset($databaseTables['tx_extensionmanager_domain_model_repository'])) {
-                               $result = TRUE;
-                       } else {
-                               // Get count of rows in repository database table
-                               $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', 'tx_extensionmanager_domain_model_repository');
-                               if ($count === 0) {
-                                       $result = TRUE;
-                               }
-                       }
-               } else {
-                       $result = TRUE;
-               }
-
-               return $result;
-       }
-
-       /**
-        * @param mixed &$customMessages Custom messages
-        *
-        * @return bool
-        */
-       protected function hasError(&$customMessages) {
-               $result = FALSE;
-               if ($GLOBALS['TYPO3_DB']->sql_error()) {
-                       $customMessages .= '<br /><br />SQL-ERROR: ' . htmlspecialchars($GLOBALS['TYPO3_DB']->sql_error());
-                       $result = TRUE;
-               }
-
-               return $result;
-       }
-
-       /**
-        * Performs the database update.
-        *
-        * @param array &$dbQueries Queries done in this update
-        * @param mixed &$customMessages Custom messages
-        * @return bool Whether it worked (TRUE) or not (FALSE)
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               $result = FALSE;
-
-               // First perform all create, add and change queries
-               $updateStatements = $this->getUpdateStatements();
-               foreach ((array) $updateStatements['add'] as $string) {
-                       $GLOBALS['TYPO3_DB']->admin_query($string);
-                       $dbQueries[] = $string;
-                       $result = ($result || $this->hasError($customMessages));
-               }
-               foreach ((array) $updateStatements['change'] as $string) {
-                       $GLOBALS['TYPO3_DB']->admin_query($string);
-                       $dbQueries[] = $string;
-                       $result = ($result || $this->hasError($customMessages));
-               }
-               foreach ((array) $updateStatements['create_table'] as $string) {
-                       $GLOBALS['TYPO3_DB']->admin_query($string);
-                       $dbQueries[] = $string;
-                       $result = ($result || $this->hasError($customMessages));
-               }
-
-               // Perform statis import anyway
-               $rawDefinitions = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('extensionmanager') . 'ext_tables_static+adt.sql');
-               $statements = $this->getInstallToolSqlParser()->getStatementarray($rawDefinitions, 1);
-               foreach ($statements as $statement) {
-                       if (trim($statement) !== '') {
-                               $GLOBALS['TYPO3_DB']->admin_query($statement);
-                               $dbQueries[] = $statement;
-                               $result = ($result || $this->hasError($customMessages));
-                       }
-               }
-
-               return !$result;
-       }
-
-}
diff --git a/typo3/sysext/install/Classes/Updates/FileIdentifierHashUpdate.php b/typo3/sysext/install/Classes/Updates/FileIdentifierHashUpdate.php
deleted file mode 100644 (file)
index 5cbc809..0000000
+++ /dev/null
@@ -1,245 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\Updates;
-
-/**
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use TYPO3\CMS\Core\Resource\ResourceStorage;
-use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
-
-/**
- * Class FileIdentifierHashUpdate adds IdentifierHashes
- */
-class FileIdentifierHashUpdate extends AbstractUpdate {
-
-       /**
-        * @var string
-        */
-       protected $title = 'Add the file identifier hash to existing sys_file records and update the settings for local storages';
-
-       /**
-        * @var \TYPO3\CMS\Core\Database\DatabaseConnection
-        */
-       protected $db;
-
-       /**
-        * @var array
-        */
-       protected $sqlQueries = array();
-
-       /**
-        * @var ResourceStorage[]
-        */
-       protected $storages;
-
-       /**
-        * @var \TYPO3\CMS\Core\Resource\StorageRepository
-        */
-       protected $storageRepository;
-
-       /**
-        * Creates this object
-        */
-       public function __construct() {
-               $this->db = $GLOBALS['TYPO3_DB'];
-       }
-
-       /**
-        * Initialize the storage repository.
-        */
-       public function init() {
-               $this->storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\StorageRepository');
-               $this->storages = $this->storageRepository->findAll();
-               // Add default storage for core files
-               $this->storages[] = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getStorageObject(0);
-       }
-
-       /**
-        * Checks if an update is needed.
-        *
-        * @param string &$description The description for the update
-        * @return bool TRUE if an update is needed, FALSE otherwise
-        */
-       public function checkForUpdate(&$description) {
-               $description = 'Add file identifier hash to sys_file records, where it is missing. Additionally upgrade storage configurations.';
-               $unhashedFileCount = $this->db->exec_SELECTcountRows(
-                       'uid',
-                       'sys_file',
-                       'identifier_hash = "" OR folder_hash = ""'
-               );
-
-               $unmigratedStorageCount = $this->db->exec_SELECTcountRows(
-                       'uid',
-                       'sys_file_storage',
-                       'driver = "Local" AND configuration NOT LIKE "%caseSensitive%"'
-               );
-
-               return $unhashedFileCount > 0 || $unmigratedStorageCount > 0;
-       }
-
-       /**
-        * Performs the database update.
-        *
-        * @param array &$dbQueries Queries done in this update
-        * @param mixed &$customMessages Custom messages
-        * @return bool TRUE on success, FALSE on error
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               $this->init();
-               foreach ($this->storages as $storage) {
-                       $dbQueries = array_merge($dbQueries, $this->updateIdentifierHashesForStorage($storage));
-               }
-
-               $dbQueries = array_merge($dbQueries, $this->migrateStorages());
-
-               $this->markWizardAsDone();
-               return TRUE;
-       }
-
-       /**
-        * @return array
-        */
-       protected function migrateStorages() {
-               $dbQueries = array();
-               $unmigratedStorages = $this->db->exec_SELECTgetRows(
-                       'uid, configuration',
-                       'sys_file_storage',
-                       'driver = "Local" AND configuration NOT LIKE "%caseSensitive%"'
-               );
-
-               /** @var $flexObj \TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools */
-               $flexObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\FlexForm\\FlexFormTools');
-
-
-               foreach ($unmigratedStorages as $storage) {
-                       $flexFormXml = $storage['configuration'];
-                       $configurationArray = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($flexFormXml);
-
-                       $caseSensitive = $this->testCaseSensitivity(
-                               $configurationArray['data']['sDEF']['lDEF']['pathType']['vDEF'] == 'relative' ?
-                                       PATH_site . $configurationArray['data']['sDEF']['lDEF']['basePath']['vDEF'] :
-                                       $configurationArray['data']['sDEF']['lDEF']['basePath']['vDEF']
-                       );
-                       $configurationArray['data']['sDEF']['lDEF']['caseSensitive'] = array('vDEF' => $caseSensitive);
-
-                       $configuration = $flexObj->flexArray2Xml($configurationArray);
-                       $dbQueries[] = $query = $this->db->UPDATEquery(
-                               'sys_file_storage',
-                               'uid=' . $storage['uid'],
-                               array(
-                                       'configuration' => $configuration
-                               )
-                       );
-                       $this->db->sql_query($query);
-               }
-               return $dbQueries;
-       }
-
-       /**
-        * Creates file identifier hashes for a single storage.
-        *
-        * @param ResourceStorage $storage The storage to update
-        * @return array The executed database queries
-        */
-       protected function updateIdentifierHashesForStorage(ResourceStorage $storage) {
-               $queries = array();
-
-               if (!ExtensionManagementUtility::isLoaded('dbal')) {
-                       // if DBAL is not loaded, we're using MySQL and can thus use their
-                       // SHA1() function
-                       if ($storage->usesCaseSensitiveIdentifiers()) {
-                               $updateCall = 'SHA1(identifier)';
-                       } else {
-                               $updateCall = 'SHA1(LOWER(identifier))';
-                       }
-                       $queries[] = $query = sprintf(
-                               'UPDATE sys_file SET identifier_hash = %s WHERE storage=%d',
-                               $updateCall,
-                               $storage->getUid()
-                       );
-                       $this->db->sql_query($query);
-
-                       // folder hashes cannot be done with one call: so do it manually
-                       $files = $this->db->exec_SELECTgetRows('uid, storage, identifier', 'sys_file',
-                               sprintf('storage=%d AND folder_hash=""', $storage->getUid())
-                       );
-
-                       foreach ($files as $file) {
-                               $folderHash = $storage->hashFileIdentifier($storage->getFolderIdentifierFromFileIdentifier($file['identifier']));
-
-                               $queries[] = $query = $this->db->UPDATEquery(
-                                       'sys_file',
-                                       'uid=' . $file['uid'],
-                                       array(
-                                               'folder_hash' => $folderHash
-                                       )
-                               );
-
-                               $this->db->sql_query($query);
-                       }
-               } else {
-                       // manually hash the identifiers when using DBAL
-                       $files = $this->db->exec_SELECTgetRows('uid, storage, identifier', 'sys_file',
-                               sprintf('storage=%d AND identifier_hash=""', $storage->getUid())
-                       );
-
-                       foreach ($files as $file) {
-                               $hash = $storage->hashFileIdentifier($file['identifier']);
-                               $folderHash = $storage->hashFileIdentifier($storage->getFolderIdentifierFromFileIdentifier($file['identifier']));
-
-                               $queries[] = $query = $this->db->UPDATEquery(
-                                       'sys_file',
-                                       'uid=' . $file['uid'],
-                                       array(
-                                               'identifier_hash' => $hash,
-                                               'folder_hash' => $folderHash
-                                       )
-                               );
-
-                               $this->db->sql_query($query);
-                       }
-               }
-
-               return $queries;
-       }
-
-
-       /**
-        * Test if the local filesystem is case sensitive
-        *
-        * @param $absolutePath
-        * @return bool
-        */
-       protected function testCaseSensitivity($absolutePath) {
-               $caseSensitive = TRUE;
-               $path = rtrim($absolutePath, '/') . '/aAbB';
-               $testFileExists = file_exists($path);
-
-               // create test file
-               if (!$testFileExists) {
-                       @touch($path);
-               }
-
-               // do the actual sensitivity check
-               if (file_exists(strtoupper($path)) && file_exists(strtolower($path))) {
-                       $caseSensitive = FALSE;
-               }
-
-               // clean filesystem
-               if (!$testFileExists) {
-                       @unlink($path);
-               }
-
-               return $caseSensitive;
-       }
-}
diff --git a/typo3/sysext/install/Classes/Updates/FilePermissionUpdate.php b/typo3/sysext/install/Classes/Updates/FilePermissionUpdate.php
deleted file mode 100644 (file)
index 76a149c..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\Updates;
-
-/**
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Upgrade wizard which goes through all users and groups file permissions and stores them as list in a new field.
- */
-class FilePermissionUpdate extends AbstractUpdate {
-
-       /**
-        * @var \TYPO3\CMS\Install\Service\SqlSchemaMigrationService
-        */
-       protected $installToolSqlParser;
-
-       /**
-        * @var string
-        */
-       protected $title = 'Rewrite binary file permissions into detailed list';
-
-       /**
-        * Constructor function.
-        */
-       public function __construct() {
-               $this->installToolSqlParser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Install\\Service\\SqlSchemaMigrationService');
-       }
-
-       /**
-        * Checks if an update is needed
-        *
-        * @param string &$description The description for the update
-        * @return bool TRUE if an update is needed, FALSE otherwise
-        */
-       public function checkForUpdate(&$description) {
-               $description = 'There are backend users and backend groups with specified file permissions.' .
-                       ' This update migrates old combined (binary) file permissions to new separate ones.';
-               $updateNeeded = FALSE;
-               $updateStatements = $this->getUpdateStatements();
-               if (!empty($updateStatements['add'])) {
-                       // Field might not be there, so we need an update run to add the field
-                       return TRUE;
-               }
-               $beUsersFieldInformation = $GLOBALS['TYPO3_DB']->admin_get_fields('be_users');
-               if (isset($beUsersFieldInformation['fileoper_perms'])) {
-                       // Fetch user records where the old permission field is not empty but the new one is
-                       $notMigratedRowsCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows(
-                               'uid',
-                               'be_users',
-                               $this->getWhereClause()
-                       );
-                       if ($notMigratedRowsCount > 0) {
-                               $updateNeeded = TRUE;
-                       }
-               } else {
-                       $beGroupsFieldInformation = $GLOBALS['TYPO3_DB']->admin_get_fields('be_groups');
-                       if (isset($beGroupsFieldInformation['fileoper_perms'])) {
-                               // Fetch group records where the old permission field is not empty but the new one is
-                               $notMigratedRowsCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows(
-                                       'uid',
-                                       'be_groups',
-                                       $this->getWhereClause()
-                               );
-                               if ($notMigratedRowsCount > 0) {
-                                       $updateNeeded = TRUE;
-                               }
-                       }
-               }
-               return $updateNeeded;
-       }
-
-       /**
-        * Performs the database update.
-        *
-        * @param array &$dbQueries Queries done in this update
-        * @param mixed &$customMessages Custom messages
-        * @return bool TRUE on success, FALSE on error
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               // First perform all add update statements to database
-               $updateStatements = $this->getUpdateStatements();
-               foreach ((array) $updateStatements['add'] as $query) {
-                       $GLOBALS['TYPO3_DB']->admin_query($query);
-                       $dbQueries[] = $query;
-                       if ($GLOBALS['TYPO3_DB']->sql_error()) {
-                               $customMessages = 'SQL-ERROR: ' . htmlspecialchars($GLOBALS['TYPO3_DB']->sql_error());
-                               return FALSE;
-                       }
-               }
-
-               // Iterate over users and groups table to perform permission updates
-               $tablesToProcess = array('be_groups', 'be_users');
-               foreach ($tablesToProcess as $table) {
-                       $records = $this->getRecordsFromTable($table);
-                       foreach ($records as $singleRecord) {
-                               $filePermission = $this->getFilePermissions($singleRecord['fileoper_perms']);
-                               $updateArray = array(
-                                       'file_permissions' => $filePermission
-                               );
-                               $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . (int)$singleRecord['uid'], $updateArray);
-                               // Get last executed query
-                               $dbQueries[] = str_replace(chr(10), ' ', $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery);
-                               // Check for errors
-                               if ($GLOBALS['TYPO3_DB']->sql_error()) {
-                                       $customMessages = 'SQL-ERROR: ' . htmlspecialchars($GLOBALS['TYPO3_DB']->sql_error());
-                                       return FALSE;
-                               }
-                       }
-               }
-
-               return TRUE;
-       }
-
-       /**
-        * Gets all create, add and change queries from core/ext_tables.sql
-        *
-        * @return array
-        */
-       protected function getUpdateStatements() {
-               $updateStatements = array();
-
-               // Get all necessary statements for ext_tables.sql file
-               $rawDefinitions = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('core') . '/ext_tables.sql');
-               $fieldDefinitionsFromFile = $this->installToolSqlParser->getFieldDefinitions_fileContent($rawDefinitions);
-               if (count($fieldDefinitionsFromFile)) {
-                       $fieldDefinitionsFromCurrentDatabase = $this->installToolSqlParser->getFieldDefinitions_database();
-                       $diff = $this->installToolSqlParser->getDatabaseExtra($fieldDefinitionsFromFile, $fieldDefinitionsFromCurrentDatabase);
-                       $updateStatements = $this->installToolSqlParser->getUpdateSuggestions($diff);
-               }
-
-               return $updateStatements;
-       }
-
-       /**
-        * Processes the actual transformation from old binary file permissions to new separate list
-        *
-        * @param int $oldFileOperationPermissions
-        * @return string
-        */
-       protected function getFilePermissions($oldFileOperationPermissions) {
-               if ($oldFileOperationPermissions == 0) {
-                       return '';
-               }
-               $defaultOptions = array(
-                       // File permissions
-                       'addFile' => TRUE,
-                       'readFile' => TRUE,
-                       'writeFile' => TRUE,
-                       'copyFile' => TRUE,
-                       'moveFile' => TRUE,
-                       'renameFile' => TRUE,
-                       'unzipFile' => TRUE,
-                       'deleteFile' => TRUE,
-                       // Folder permissions
-                       'addFolder' => TRUE,
-                       'readFolder' => TRUE,
-                       'writeFolder' => TRUE,
-                       'copyFolder' => TRUE,
-                       'moveFolder' => TRUE,
-                       'renameFolder' => TRUE,
-                       'deleteFolder' => TRUE,
-                       'recursivedeleteFolder' => TRUE
-               );
-               if (!($oldFileOperationPermissions & 1)) {
-                       unset($defaultOptions['addFile']);
-                       unset($defaultOptions['readFile']);
-                       unset($defaultOptions['writeFile']);
-                       unset($defaultOptions['copyFile']);
-                       unset($defaultOptions['moveFile']);
-                       unset($defaultOptions['renameFile']);
-                       unset($defaultOptions['deleteFile']);
-               }
-               if (!($oldFileOperationPermissions & 2)) {
-                       unset($defaultOptions['unzipFile']);
-               }
-               if (!($oldFileOperationPermissions & 4)) {
-                       unset($defaultOptions['addFolder']);
-                       unset($defaultOptions['writeFolder']);
-                       unset($defaultOptions['moveFolder']);
-                       unset($defaultOptions['renameFolder']);
-                       unset($defaultOptions['deleteFolder']);
-               }
-               if (!($oldFileOperationPermissions & 8)) {
-                       unset($defaultOptions['copyFolder']);
-               }
-               if (!($oldFileOperationPermissions & 16)) {
-                       unset($defaultOptions['recursivedeleteFolder']);
-               }
-
-               return implode(',', array_keys($defaultOptions));
-       }
-
-       /**
-        * Retrieve every record which needs to be processed
-        *
-        * @param string $table
-        * @return array
-        */
-       protected function getRecordsFromTable($table) {
-               $fields = implode(',', array('uid', 'fileoper_perms'));
-               $records = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($fields, $table, $this->getWhereClause());
-               return $records;
-       }
-
-       /**
-        * Returns the where clause for database requests
-        *
-        * @return string
-        */
-       protected function getWhereClause() {
-               return 'fileoper_perms>0 AND ISNULL(file_permissions)';
-       }
-
-}
diff --git a/typo3/sysext/install/Classes/Updates/FileTableSplittingUpdate.php b/typo3/sysext/install/Classes/Updates/FileTableSplittingUpdate.php
deleted file mode 100644 (file)
index 48914d5..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\Updates;
-
-/**
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Migrate metadata from sys_file table to sys_filemetadata.
- * Also takes care of custom TCA fields if they have been created beforehand.
- *
- * @author Steffen Ritter <steffen.ritter@typo3.org>
- */
-class FileTableSplittingUpdate extends AbstractUpdate {
-
-       /**
-        * The table the metadata is to be stored in
-        * @var string
-        */
-       protected $metaDataTable = 'sys_file_metadata';
-
-       /**
-        * @var string
-        */
-       protected $title = 'Migrate file metadata from sys_file to an external metadata table';
-
-       /**
-        * Checks if an update is needed
-        *
-        * @param string &$description The description for the update
-        * @return bool Whether an update is needed (TRUE) or not (FALSE)
-        */
-       public function checkForUpdate(&$description) {
-               $result = FALSE;
-
-               $description = 'In TYPO3 CMS 6.2 LTS the metadata has been split off to an external table. This wizard will migrate the data. If you have extended the sys_file table manually your custom data will be included, too, if you create TCA and columns in sys_file_metadata before running this wizard.';
-
-               if (!array_key_exists($this->metaDataTable, $GLOBALS['TYPO3_DB']->admin_get_tables())) {
-                       $result = TRUE;
-               } else {
-                       $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;
-       }
-
-       /**
-        * Performs the database update. Won't run if the table is not present.
-        * Will stop if the table does not exist to give users the possibility to
-        * migrate custom fields to and therefore move their TCA and sql upfront.
-        *
-        * @param array &$dbQueries Queries done in this update
-        * @param mixed &$customMessages Custom messages
-        * @return bool Whether it worked (TRUE) or not (FALSE)
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-
-               if (!array_key_exists($this->metaDataTable, $GLOBALS['TYPO3_DB']->admin_get_tables())) {
-                       $customMessages = 'ERROR! Make sure you already created the table. If you added custom metadata to sys_file table add TCA ' .
-                               'configuration as well as SQL definitions to sys_file_metadata, too.';
-                       return FALSE;
-               }
-
-               $fieldsToMigrate = $this->detectFieldsToMigrate();
-               if (empty($fieldsToMigrate)) {
-                       return TRUE;
-               }
-               $fieldsToWrite = $fieldsToMigrate;
-               $fieldsToWrite[] = 'file';
-               $fieldsToSelect = $fieldsToMigrate;
-               $fieldsToSelect[] = 'uid AS file';
-
-               $resultObject = $GLOBALS['TYPO3_DB']->sql_query(
-                               'INSERT INTO ' . $this->metaDataTable . ' (' . implode(',', $fieldsToWrite) . ')' .
-                               ' SELECT ' . implode(',', $fieldsToSelect) .
-                               ' FROM sys_file' .
-                               ' WHERE uid NOT IN (SELECT file FROM ' . $this->metaDataTable . ')');
-
-               return $resultObject !== FALSE;
-       }
-
-       /**
-        * Looks at the table sql definitions and checks which fields are present in both tables.
-        * ignories some Management field
-        *
-        * @return array
-        */
-       protected function detectFieldsToMigrate() {
-               $fieldsBlackListed = array('uid', 'deleted', 'sys_language_uid');
-               $fieldsInSysFile = array_keys($GLOBALS['TYPO3_DB']->admin_get_fields('sys_file'));
-               $fieldsInSysFileMetaData = array_keys($GLOBALS['TYPO3_DB']->admin_get_fields($this->metaDataTable));
-
-               $commonFields = array_intersect($fieldsInSysFileMetaData, $fieldsInSysFile);
-               $commonFields = array_diff($commonFields, $fieldsBlackListed);
-
-               return $commonFields;
-
-       }
-}
diff --git a/typo3/sysext/install/Classes/Updates/FilemountUpdateWizard.php b/typo3/sysext/install/Classes/Updates/FilemountUpdateWizard.php
deleted file mode 100644 (file)
index 11c6cac..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\Updates;
-
-/**
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use TYPO3\CMS\Backend\Utility\BackendUtility;
-
-/**
- * Upgrade wizard which checks all existing filemounts
- * and upgrades this them in case we have:
- * a) absolute filemounts (base = 0) without related storage
- * b) relative filemounts (base = 1) which aren't related to a storage
- * further we assume that all other filemounts (base > 1) are already related to a storage
- *
- * @author Tolleiv Nietsch <typo3@tolleiv.de>
- */
-class FilemountUpdateWizard extends AbstractUpdate {
-
-       /**
-        * @var string
-        */
-       protected $title = 'Migrate existing filemounts to be file abstraction layer compatible.';
-
-       /**
-        * @var \TYPO3\CMS\Core\Database\DatabaseConnection
-        */
-       protected $db;
-
-       /**
-        * @var array
-        */
-       protected $sqlQueries = array();
-
-       /**
-        * @var \TYPO3\CMS\Core\Resource\ResourceStorage
-        */
-       protected $storage;
-
-       /**
-        * @var \TYPO3\CMS\Core\Resource\StorageRepository
-        */
-       protected $storageRepository;
-
-       /**
-        * Creates this object
-        */
-       public function __construct() {
-               $this->db = $GLOBALS['TYPO3_DB'];
-       }
-
-       /**
-        * Initialize the storage repository.
-        */
-       public function init() {
-               $this->storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\StorageRepository');
-               $storages = $this->storageRepository->findAll();
-               $this->storage = $storages[0];
-       }
-
-       /**
-        * Checks if an update is needed.
-        *
-        * @param string &$description The description for the update
-        * @return bool TRUE if an update is needed, FALSE otherwise
-        */
-       public function checkForUpdate(&$description) {
-               $description = 'Migrate all filemounts to be based on file abstraction layer storages.';
-               $filemountCount = $this->db->exec_SELECTcountRows(
-                       '*',
-                       'sys_filemounts',
-                       'base IN (0,1) ' . BackendUtility::deleteClause('sys_filemounts')
-               );
-               return $filemountCount > 0 && !$this->isWizardDone();
-       }
-
-       /**
-        * Performs the database update.
-        *
-        * @param array &$dbQueries Queries done in this update
-        * @param mixed &$customMessages Custom messages
-        * @return bool TRUE on success, FALSE on error
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               $this->init();
-               $this->migrateAbsoluteFilemounts();
-               $this->migrateRelativeFilemounts();
-               if (is_array($this->sqlQueries) && is_array($dbQueries)) {
-                       $dbQueries = array_merge($dbQueries, $this->sqlQueries);
-               }
-               $this->markWizardAsDone();
-               return TRUE;
-       }
-
-       /**
-        * Takes the existing absolute filemounts (base=0) and migrates them to use
-        * the existing fileadmin/ storage or a new storage.
-        *
-        * @return void
-        */
-       protected function migrateAbsoluteFilemounts() {
-               $description = 'This is the local %s directory. This storage mount has been created by the TYPO3 upgrade wizards.';
-               $fileadminDir = PATH_site . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'];
-               $absoluteFilemounts = $this->db->exec_SELECTgetRows(
-                       '*',
-                       'sys_filemounts',
-                       'base = 0' . BackendUtility::deleteClause('sys_filemounts')
-               );
-               foreach ($absoluteFilemounts as $filemount) {
-                       if (stristr($filemount['path'], $fileadminDir)) {
-                               $storageId = $this->storage->getUid();
-                               $storagePath = str_replace($fileadminDir, '', $filemount['path']);
-                       } else {
-                               $storageId = $this->storageRepository->createLocalStorage(
-                                       $filemount['title'] . ' (auto-created)',
-                                       $filemount['path'],
-                                       'absolute',
-                                       sprintf($description, $filemount['path'])
-                               );
-                               $storagePath = '/';
-                               $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
-                       }
-                       $this->db->exec_UPDATEquery(
-                               'sys_filemounts',
-                               'uid=' . (int)$filemount['uid'],
-                               array('base' => $storageId, 'path' => $storagePath)
-                       );
-                       $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
-               }
-       }
-
-       /**
-        * Relative filemounts are transformed to relate to our fileadmin/ storage
-        * and their path is modified to be a valid resource location
-        *
-        * @return void
-        */
-       protected function migrateRelativeFilemounts() {
-               $relativeFilemounts = $this->db->exec_SELECTgetRows(
-                       '*',
-                       'sys_filemounts',
-                       'base = 1' . BackendUtility::deleteClause('sys_filemounts')
-               );
-               foreach ($relativeFilemounts as $filemount) {
-                       $this->db->exec_UPDATEquery(
-                               'sys_filemounts',
-                               'uid=' . (int)$filemount['uid'],
-                               array('base' => $this->storage->getUid(), 'path' => '/' . ltrim($filemount['path'], '/'))
-                       );
-                       $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
-               }
-       }
-
-}
index ec27bf6..f0b5c60 100644 (file)
@@ -122,12 +122,13 @@ class FinalDatabaseSchemaUpdate extends AbstractDatabaseSchemaUpdate {
                $databaseDifferences = $this->getDatabaseDifferences();
                $updateStatements = $this->schemaMigrationService->getUpdateSuggestions($databaseDifferences);
 
+               $db = $this->getDatabaseConnection();
                $customMessagesArray = array();
                foreach ((array)$updateStatements['change'] as $query) {
-                       $GLOBALS['TYPO3_DB']->admin_query($query);
+                       $db->admin_query($query);
                        $dbQueries[] = $query;
-                       if ($GLOBALS['TYPO3_DB']->sql_error()) {
-                               $customMessagesArray[] = 'SQL-ERROR: ' . htmlspecialchars($GLOBALS['TYPO3_DB']->sql_error());
+                       if ($db->sql_error()) {
+                               $customMessagesArray[] = 'SQL-ERROR: ' . htmlspecialchars($db->sql_error());
                        }
                }
 
@@ -136,6 +137,6 @@ class FinalDatabaseSchemaUpdate extends AbstractDatabaseSchemaUpdate {
                                'indexes. Please repeat this step! Following errors occurred:' . LF . LF . implode(LF, $customMessagesArray);
                }
 
-               return count($customMessagesArray) === 0;
+               return empty($customMessagesArray);
        }
 }
diff --git a/typo3/sysext/install/Classes/Updates/InitUpdateWizard.php b/typo3/sysext/install/Classes/Updates/InitUpdateWizard.php
deleted file mode 100644 (file)
index de83df3..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\Updates;
-
-/**
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Upgrade wizard which creates all sys_file* tables. Required to ensure that all
- * other FAL migration wizards can run properly.
- *
- * @author Tolleiv Nietsch <info@tolleiv.de>
- */
-class InitUpdateWizard extends AbstractUpdate {
-
-       /**
-        * @var string
-        */
-       protected $title = 'Initialize database tables for the File Abstraction Layer (FAL)';
-
-       /**
-        * @var \TYPO3\CMS\Install\Service\SqlSchemaMigrationService
-        */
-       protected $installerSql;
-
-       /**
-        * Creates this object.
-        */
-       public function __construct() {
-               $this->installerSql = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Install\\Service\\SqlSchemaMigrationService');
-       }
-
-       /**
-        * Checks if an update is needed
-        *
-        * @param string &$description The description for the update
-        * @return bool TRUE if an update is needed, FALSE otherwise
-        */
-       public function checkForUpdate(&$description) {
-               $description = 'Create the database tables which are required for the File Abstraction Layer in order to work. Do this as the first step for all further wizards related to FAL.';
-               return count($this->getRequiredUpdates()) > 0;
-       }
-
-       /**
-        * Performs the database update.
-        *
-        * @param array &$dbQueries Queries done in this update
-        * @param mixed &$customMessages Custom messages
-        * @return bool TRUE on success, FALSE on error
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               $updates = $this->getRequiredUpdates();
-               foreach ($updates as $update) {
-                       $GLOBALS['TYPO3_DB']->admin_query($update);
-                       $dbQueries[] = $update;
-               }
-               return TRUE;
-       }
-
-       /**
-        * Determine all create table statements which create the sys_file* tables
-        *
-        * @return array
-        */
-       protected function getRequiredUpdates() {
-               $requiredUpdates = array();
-               $fileContent = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl(
-                       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('core') . 'ext_tables.sql'
-               );
-               $FDfile = $this->installerSql->getFieldDefinitions_fileContent($fileContent);
-               $FDdb = $this->installerSql->getFieldDefinitions_database(TYPO3_db);
-               $diff = $this->installerSql->getDatabaseExtra($FDfile, $FDdb);
-               $update_statements = $this->installerSql->getUpdateSuggestions($diff);
-               foreach ((array) $update_statements['create_table'] as $string) {
-                       if (preg_match('/^CREATE TABLE sys_file($|_)?/', $string)) {
-                               $requiredUpdates[] = $string;
-                       }
-               }
-               return $requiredUpdates;
-       }
-
-}
index c15e908..535dbd3 100644 (file)
@@ -144,20 +144,21 @@ class InitialDatabaseSchemaUpdate extends AbstractDatabaseSchemaUpdate {
                $databaseDifferences = $this->getDatabaseDifferences();
                $updateStatements = $this->schemaMigrationService->getUpdateSuggestions($databaseDifferences);
 
+               $db = $this->getDatabaseConnection();
                foreach ((array)$updateStatements['create_table'] as $query) {
-                       $GLOBALS['TYPO3_DB']->admin_query($query);
+                       $db->admin_query($query);
                        $dbQueries[] = $query;
-                       if ($GLOBALS['TYPO3_DB']->sql_error()) {
-                               $customMessages = 'SQL-ERROR: ' . htmlspecialchars($GLOBALS['TYPO3_DB']->sql_error());
+                       if ($db->sql_error()) {
+                               $customMessages = 'SQL-ERROR: ' . htmlspecialchars($db->sql_error());
                                return FALSE;
                        }
                }
 
                foreach ((array)$updateStatements['add'] as $query) {
-                       $GLOBALS['TYPO3_DB']->admin_query($query);
+                       $db->admin_query($query);
                        $dbQueries[] = $query;
-                       if ($GLOBALS['TYPO3_DB']->sql_error()) {
-                               $customMessages = 'SQL-ERROR: ' . htmlspecialchars($GLOBALS['TYPO3_DB']->sql_error());
+                       if ($db->sql_error()) {
+                               $customMessages = 'SQL-ERROR: ' . htmlspecialchars($db->sql_error());
                                return FALSE;
                        }
                }
diff --git a/typo3/sysext/install/Classes/Updates/InstallerProcessInterface.php b/typo3/sysext/install/Classes/Updates/InstallerProcessInterface.php
deleted file mode 100644 (file)
index 217ef8f..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\Updates;
-
-/**
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Interface to tell that updates shall be executed
- * on initializing a new TYPO3 instance.
- *
- * @author Oliver Hader <oliver.hader@typo3.org>
- */
-interface InstallerProcessInterface {
-
-}
diff --git a/typo3/sysext/install/Classes/Updates/MediaFlexformUpdate.php b/typo3/sysext/install/Classes/Updates/MediaFlexformUpdate.php
deleted file mode 100644 (file)
index 1630418..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\Updates;
-
-/**
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Migrates the old media FlexForm to the new
- */
-class MediaFlexformUpdate extends AbstractUpdate {
-
-       /**
-        * @var string
-        */
-       protected $title = 'FlexForm Data from Media Element';
-
-       /**
-        * Checks whether updates need to be performed
-        *
-        * @param string &$description The description for the update
-        * @param int &$showUpdate 0=dont show update; 1=show update and next button; 2=only show description
-        * @return bool
-        */
-       public function checkForUpdate(&$description, &$showUpdate = 0) {
-               $mediaElements = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', 'tt_content', 'CType = "media" AND pi_flexform LIKE "%<sheet index=\\"sDEF\\">%"');
-               if ($mediaElements > 0) {
-                       $description = 'You have media elements within your installation. As the structure of the flexform changed, your data needs to be migrated.';
-                       $showUpdate = 1;
-               } else {
-                       $description = 'You currently have no media elements within your installation. Therefore nothing to be migrated';
-                       $showUpdate = 0;
-               }
-               return $showUpdate > 0;
-       }
-
-       /**
-        * Perform update
-        *
-        * @param array &$dbQueries Queries done in this update
-        * @param mixed &$customMessages Custom messages
-        * @return bool Whether the updated was made or not
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
-                       'uid,pi_flexform',
-                       'tt_content',
-                       'CType = "media" AND pi_flexform LIKE "%<sheet index=\\"sDEF\\">%"'
-               );
-               /** @var $flexformTools \TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools */
-               $flexformTools = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\FlexForm\\FlexFormTools');
-               foreach ($rows as $row) {
-                       $flexFormXML = $row['pi_flexform'];
-                       $data = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($flexFormXML);
-                       $sDEF = $data['data']['sDEF']['lDEF'];
-                       unset($data['data']['sDEF']);
-                       $type = $sDEF['mmType']['vDEF'];
-                       $data['data']['sGeneral'] = array(
-                               'lDEF' => array(
-                                       'mmType' => array('vDEF' => $type)
-                               )
-                       );
-                       $width = $sDEF['mmWidth']['vDEF'];
-                       if ($width) {
-                               $data['data']['sGeneral']['lDEF']['mmWidth'] = array('vDEF' => (int)$width);
-                       }
-                       $height = $sDEF['mmHeight']['vDEF'];
-                       if ($height) {
-                               $data['data']['sGeneral']['lDEF']['mmHeight'] = array('vDEF' => (int)$height);
-                       }
-                       switch ($type) {
-                               case 'video':
-                                       $data['data']['sVideo'] = array('lDEF' => array('mmFile' => array('vDEF' => $sDEF['mmFile']['vDEF'])));
-                                       break;
-                               case 'audio':
-                                       $data['data']['sAudio'] = array('lDEF' => array('mmAudioFallback' => array('vDEF' => $sDEF['mmFile']['vDEF'])));
-                                       break;
-                               default:
-                                       continue;
-                       }
-                       $newXML = $flexformTools->flexArray2Xml($data, TRUE);
-                       $newXML = str_replace('encoding=""', 'encoding="utf-8"', $newXML);
-                       $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
-                               'tt_content',
-                               'uid = ' . $row['uid'],
-                               array('pi_flexform' => $newXML)
-                       );
-               }
-               return TRUE;
-       }
-
-}
diff --git a/typo3/sysext/install/Classes/Updates/ReferenceIntegrityUpdateWizard.php b/typo3/sysext/install/Classes/Updates/ReferenceIntegrityUpdateWizard.php
deleted file mode 100644 (file)
index cca37b2..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\Updates;
-
-/**
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Performs certain DB updates in order to ensure that the DB fields
- * are set properly.
- * 1) Ensure that there are no sys_file_reference records with PID=0
- *    where the connected parent records (e.g. a tt_content record) are
- *    not on PID=0.
- * 2) Make sure that all sys_file_references point to tables that still
- *    exist.
- *
- * @author Benni Mack <benni@typo3.org>
- */
-class ReferenceIntegrityUpdateWizard extends AbstractUpdate {
-
-       /**
-        * @var string
-        */
-       protected $title = 'Ensures the database integrity for File Abstraction records';
-
-       /**
-        * Checks if an update is needed
-        *
-        * @param string &$description The description for the update
-        * @return bool TRUE if an update is needed, FALSE otherwise
-        */
-       public function checkForUpdate(&$description) {
-               $description = 'Checks if there are file references that are on the root level. ' .
-                       'This could have happened due to a misconfigured previous migration. ' .
-                       'This migration will also remove references to tables that no longer exist.';
-               return count($this->getRequiredUpdates()) > 0;
-       }
-
-       /**
-        * Performs the database update.
-        *
-        * @param array &$dbQueries Queries done in this update
-        * @param mixed &$customMessages Custom messages
-        * @return bool TRUE on success, FALSE on error
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               $updates = $this->getRequiredUpdates();
-               if (isset($updates['referenceToMissingTables'])) {
-                       foreach ($updates['referenceToMissingTables'] as $missingTable) {
-                               $deleteQuery = $GLOBALS['TYPO3_DB']->DELETEquery(
-                                       'sys_file_reference',
-                                       'tablenames=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($missingTable, 'sys_file_reference')
-                               );
-                               $GLOBALS['TYPO3_DB']->sql_query($deleteQuery);
-                               $dbQueries[] = $deleteQuery;
-                       }
-               }
-               if (isset($updates['improperConnectedFileReferences'])) {
-                       foreach ($updates['improperConnectedFileReferences'] as $fileReferenceRecord) {
-                               if ($fileReferenceRecord['newpid'] > 0) {
-                                       $updateQuery = $GLOBALS['TYPO3_DB']->UPDATEquery(
-                                               'sys_file_reference',
-                                               'uid=' . (int)$fileReferenceRecord['uid'],
-                                               array('pid' => $fileReferenceRecord['newpid'])
-                                       );
-                                       $GLOBALS['TYPO3_DB']->sql_query($updateQuery);
-                                       $dbQueries[] = $updateQuery;
-                               }
-                       }
-               }
-               return TRUE;
-       }
-
-       /**
-        * Determine all DB updates that need to be done
-        *
-        * @return array
-        */
-       protected function getRequiredUpdates() {
-               $requiredUpdates = array();
-               $referenceToMissingTables = $this->getFileReferencesPointingToMissingTables();
-               if (count($referenceToMissingTables) > 0) {
-                       $requiredUpdates['referenceToMissingTables'] = $referenceToMissingTables;
-               }
-               $improperConnectedFileReferences = $this->getImproperConnectedFileReferences($referenceToMissingTables);
-               if (count($improperConnectedFileReferences) > 0) {
-                       $requiredUpdates['improperConnectedFileReferences'] = $improperConnectedFileReferences;
-               }
-               return $requiredUpdates;
-       }
-
-       /**
-        * A list of tables that are referenced by sys_file_reference that are no longer existing
-        *
-        * @return array
-        */
-       protected function getFileReferencesPointingToMissingTables() {
-               $existingTables = array_flip(array_keys($GLOBALS['TYPO3_DB']->admin_get_tables()));
-               $missingTables = array();
-               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('DISTINCT tablenames', 'sys_file_reference', '');
-               while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
-                       $thisTablename = $row['tablenames'];
-                       if (!isset($existingTables[$thisTablename])) {
-                               $missingTables[] = $thisTablename;
-                       }
-               }
-               return $missingTables;
-       }
-
-       /**
-        * Fetches a list of all sys_file_references that have PID=0
-        *
-        * @return mixed
-        */
-       protected function getFileReferencesOnRootlevel() {
-               return $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
-                       'uid, pid, uid_local AS fileuid, uid_foreign AS targetuid, tablenames AS targettable',
-                       'sys_file_reference',
-                       'pid=0 AND deleted=0'
-               );
-       }
-
-       /**
-        * Fetches all sys_file_reference records that are on PID=0 BUT their counter parts (the target record)
-        * is NOT on pid=0
-        *
-        * @param array $skipTables Table names to skip checking
-        * @return array
-        */
-       protected function getImproperConnectedFileReferences(array $skipTables = array()) {
-               $improperConnectedReferences = array();
-               // fetch all references on root level
-               $sysFileReferences = $this->getFileReferencesOnRootlevel();
-               foreach ($sysFileReferences as $fileReferenceRecord) {
-                       $tableName = $fileReferenceRecord['targettable'];
-                       if (in_array($tableName, $skipTables)) {
-                               continue;
-                       }
-                       // if the target table is pages (e.g. when adding a file reference to the pages->media
-                       // record, then the
-                       $whereClause = 'uid=' . (int)$fileReferenceRecord['targetuid'];
-                       if ($fileReferenceRecord['targettable'] === 'pages') {
-                               $isPageReference = TRUE;
-                       } else {
-                               $isPageReference = FALSE;
-                               $whereClause .= ' AND pid<>0';
-                       }
-                       // check the target table, if the target record is NOT on the rootlevel
-                       $targetRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
-                               'uid, pid',
-                               $tableName,
-                               $whereClause
-                       );
-                       // only add the file reference if the target record is not on PID=0
-                       if ($targetRecord !== NULL) {
-                               $fileReferenceRecord['newpid'] = ($isPageReference ? $targetRecord['uid'] : $targetRecord['pid']);
-                               $improperConnectedReferences[] = $fileReferenceRecord;
-                       }
-               }
-               return $improperConnectedReferences;
-       }
-}
diff --git a/typo3/sysext/install/Classes/Updates/RootTemplateUpdate.php b/typo3/sysext/install/Classes/Updates/RootTemplateUpdate.php
deleted file mode 100644 (file)
index 0c9b007..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\Updates;
-
-/**
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Migrates the old media FlexForm to the new
- */
-class RootTemplateUpdate extends AbstractUpdate implements InstallerProcessInterface {
-
-       /**
-        * @var string
-        */
-       protected $title = 'Integrate TypoScript Root Template';
-
-       /**
-        * Checks whether updates need to be performed
-        *
-        * @param string &$description The description for the update
-        * @param int &$showUpdate 0=dont show update; 1=show update and next button; 2=only show description
-        * @return bool
-        */
-       public function checkForUpdate(&$description, &$showUpdate = 0) {
-               $pages = $this->findRootLevelPages();
-
-               if ($pages !== NULL && $this->findRootTemplates(array_keys($pages)) !== NULL) {
-                       $description = 'There is already at least one TypoScript root template available.';
-                       $showUpdate = 0;
-               } else {
-                       $description = 'There is no TypoScript root template! However, one is required for Extbase to behave correctly.';
-                       $showUpdate = 1;
-               }
-
-               return $showUpdate > 0;
-       }
-
-       /**
-        * Performs updates and creates one page and Typoscript root template.
-        *
-        * @param array &$dbQueries Queries done in this update
-        * @param mixed &$customMessages Custom messages
-        * @return bool Whether the updated was made or not
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               $now = time();
-               $result = FALSE;
-
-               $status = $GLOBALS['TYPO3_DB']->exec_INSERTquery(
-                       'pages',
-                       array(
-                               'pid' => 0,
-                               'title' => 'Home',
-                               'is_siteroot' => 1,
-                               'crdate' => $now,
-                               'tstamp' => $now,
-                       )
-               );
-
-               $dbQueries[] = str_replace(chr(10), ' ', $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery);
-
-               if ($status) {
-                       $pageId = $GLOBALS['TYPO3_DB']->sql_insert_id();
-
-                       $status = $GLOBALS['TYPO3_DB']->exec_INSERTquery(
-                               'sys_template',
-                               array(
-                                       'pid' => $pageId,
-                                       'title' => 'Default Root Template',
-                                       'root' => 1,
-                                       'clear' => 1,
-                                       'crdate' => $now,
-                                       'tstamp' => $now,
-                               )
-                       );
-
-                       $dbQueries[] = str_replace(chr(10), ' ', $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery);
-
-                       if ($status) {
-                               $result = TRUE;
-                       }
-               }
-
-               return $result;
-       }
-
-       /**
-        * Finds pages on the root level (pid 0).
-        *
-        * @return array|NULL
-        */
-       protected function findRootLevelPages() {
-               $pages = NULL;
-
-               $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
-                       'uid,pid',
-                       'pages',
-                       'pid=0 AND deleted=0',
-                       '',
-                       '',
-                       '',
-                       'uid'
-               );
-
-               if (is_array($rows) && !empty($rows)) {
-                       $pages = $rows;
-               }
-
-               return $pages;
-       }
-
-       /**
-        * Finds root templates in the given pages.
-        *
-        * @param array $pageUids
-        * @return array|NULL
-        */
-       protected function findRootTemplates(array $pageUids) {
-               $templates = NULL;
-
-               $pageUids = array_map('intval', $pageUids);
-               $pageUidList = implode(', ', $pageUids);
-
-               $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
-                       'uid,pid',
-                       'sys_template',
-                       'deleted=0 AND root=1 AND pid IN (' . $pageUidList . ')',
-                       '',
-                       '',
-                       '',
-                       'uid'
-               );
-
-               if (is_array($rows)) {
-                       $templates = $rows;
-               }
-
-               return $templates;
-       }
-}
diff --git a/typo3/sysext/install/Classes/Updates/RteFileLinksUpdateWizard.php b/typo3/sysext/install/Classes/Updates/RteFileLinksUpdateWizard.php
deleted file mode 100644 (file)
index b430fd2..0000000
+++ /dev/null
@@ -1,306 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\Updates;
-
-/**
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-
-/**
- * Upgrade wizard that rewrites all file links to FAL references.
- *
- * The content string and the reference index (sys_refindex) are updated accordingly.
- */
-class RteFileLinksUpdateWizard extends AbstractUpdate {
-
-       /**
-        * Title of the update wizard
-        * @var string
-        */
-       protected $title = 'Migrate all file links of RTE-enabled fields to FAL';
-
-       /**
-        * @var string Path the to fileadmin directory
-        */
-       protected $fileAdminDir;
-
-       /**
-        * The default storage
-        * @var \TYPO3\CMS\Core\Resource\ResourceStorage
-        */
-       protected $storage;
-
-       /**
-        * @var \TYPO3\CMS\Core\Html\RteHtmlParser
-        */
-       protected $rteHtmlParser;
-
-       /**
-        * Count of converted links
-        * @var integer
-        */
-       protected $convertedLinkCounter = 0;
-
-       /**
-        * Is DBAL installed or not (if not, we can use transactions)
-        * @var boolean
-        */
-       protected $isDbalInstalled = FALSE;
-
-       /**
-        * Array to store file conversion errors
-        * @var array
-        */
-       protected $errors = array();
-
-       /**
-        * List of update queries
-        * @var array
-        */
-       protected $queries = array();
-
-       /**
-        * Initialize some objects
-        *
-        * @return void
-        */
-       public function init() {
-               $this->rteHtmlParser = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Html\\RteHtmlParser');
-               /** @var $storageRepository \TYPO3\CMS\Core\Resource\StorageRepository */
-               $storageRepository = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\StorageRepository');
-               $storages = $storageRepository->findAll();
-               $this->storage = $storages[0];
-               $this->fileAdminDir = $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'];
-               // Check if DBAL is installed or not
-               $this->isDbalInstalled = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('dbal');
-       }
-
-       /**
-        * Checks if an update is needed
-        *
-        * @param string $description The description for the update
-        * @return bool TRUE if an update is needed, FALSE otherwise
-        */
-       public function checkForUpdate(&$description) {
-               $description = 'This update wizard goes through all file links in all rich-text fields and changes them to FAL references.';
-               $description .= 'If the process times out, please run it again.';
-               // Issue warning about sys_refindex needing to be up to date
-               /** @var \TYPO3\CMS\Core\Messaging\FlashMessage $message */
-               $message = GeneralUtility::makeInstance(
-                       'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
-                       'This script bases itself on the references contained in the general reference index (sys_refindex). It is strongly advised to update it before running this wizard.',
-                       'Updating the reference index',
-                       \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING
-               );
-               $description .= $message->render();
-
-               // Confirm activation only if some old-style links are found
-               $oldRecords = $this->findOldLinks();
-               if (count($oldRecords) > 0) {
-                       $description .= '<br />There are currently <strong>' . count($oldRecords) . '</strong> links to update.<br />';
-                       return TRUE;
-               }
-
-               // No update needed, disable the wizard
-               return FALSE;
-       }
-
-       /**
-        * Performs the database update.
-        *
-        * @param array $dbQueries queries done in this update
-        * @param mixed $customMessages custom messages
-        * @return bool TRUE on success, FALSE on error
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               $this->init();
-
-               // Make sure we have a storage
-               if (!$this->storage) {
-                       $customMessages = 'No file resource storage found';
-                       return FALSE;
-               }
-
-               // Get the references and migrate them
-               $records = $this->findOldLinks();
-               foreach ($records as $singleRecord) {
-                       $this->migrateRecord($singleRecord);
-               }
-               $dbQueries = $this->queries;
-
-               if (count($this->errors) > 0) {
-                       $customMessages .= implode(PHP_EOL, $this->errors);
-                       if ($this->convertedLinkCounter == 0) {
-                               // no links converted only missing files: UPDATE was not successful
-                               return FALSE;
-                       }
-               }
-
-               if ($this->convertedLinkCounter > 0) {
-                       $customMessages = $this->convertedLinkCounter . ' links converted.' . PHP_EOL . $customMessages;
-               } else {
-                       $customMessages .= 'No file links found';
-               }
-               return TRUE;
-       }
-
-       /**
-        *  Processes each record and updates the database
-        *
-        * @param array $reference Reference to a record from sys_refindex
-        * @return void
-        */
-       protected function migrateRecord(array $reference) {
-               // Get the current record based on the sys_refindex information
-               $record = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
-                       'uid, ' . $reference['field'],
-                       $reference['tablename'],
-                       'uid = ' . $reference['recuid']
-               );
-               if (is_array($record)) {
-                       $this->convertFileLinks($reference, $record);
-               } else {
-                       // Original record could not be found (happens if sys_refindex is not up to date), issue error
-                       $this->errors[] = 'Original record not found for reference to element ' . $reference['recuid'] . ' of table ' . $reference['tablename'] . ' in field ' . $reference['field'] . '. Not migrated.';
-               }
-       }
-
-       /**
-        * The actual transformation of the links
-        * pretty similar to TS_links_rte in RteHtmlParser
-        *
-        * @param array $reference sys_refindex information
-        * @param array $record Original record pointed to by the sys_refindex reference
-        * @return void
-        */
-       protected function convertFileLinks(array $reference, array $record) {
-               // First of all, try to get the referenced file. Continue only if found.
-               try {
-                       $fileObject = $this->fetchReferencedFile($reference['ref_string'], $reference);
-               } catch (\InvalidArgumentException $exception) {
-                       $fileObject = NULL;
-                       $this->errors[] = $reference['ref_string'] . ' could not be replaced. File does not exist.';
-               }
-               if ($fileObject instanceof \TYPO3\CMS\Core\Resource\AbstractFile) {
-                       // Next, match the reference path in the content to be sure it's present inside a <link> tag
-                       $content = $record[$reference['field']];
-                       $regularExpression = '$<((link|LINK) ' . str_replace(' ', '%20', $reference['ref_string']) . ').*>$';
-                       $matches = array();
-                       $result = preg_match($regularExpression, $content, $matches);
-                       if ($result) {
-                               // Replace the file path with the file reference
-                               $modifiedContent = str_replace(
-                                       $matches[1],
-                                       'link file:' . $fileObject->getUid(),
-                                       $record[$reference['field']]
-                               );
-                               // Save the changes and stop looping
-                               $this->saveChanges($modifiedContent, $reference, $fileObject);
-                               $this->convertedLinkCounter++;
-                       } else {
-                               $this->errors[] = $reference['ref_string'] . ' not found in referenced element (uid: ' . $reference['recuid'] . ' of table ' . $reference['tablename'] . ' in field ' . $reference['field'] . '). Reference index was probably out of date.';
-                       }
-               }
-       }
-
-       /**
-        * Tries to fetch the file object corresponding to the given path.
-        *
-        * @param string $path Path to a file (starting with "fileadmin/")
-        * @param array $reference Corresponding sys_refindex entry
-        * @return null|\TYPO3\CMS\Core\Resource\FileInterface
-        */
-       protected function fetchReferencedFile($path, array $reference) {
-               $fileObject = NULL;
-               if (@file_exists(PATH_site . '/' . $path)) {
-                       try {
-                               $fileObject = $this->storage->getFile(
-                                       '/' . str_replace(
-                                               $this->fileAdminDir,
-                                               '',
-                                               $path
-                                       )
-                               );
-                       } catch (\TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException $notFoundException) {
-                               // This should really not happen, since we are testing existence of the file just before
-                               $this->errors[] = $path . ' not found (referenced in element ' . $reference['recuid'] . ' of table ' . $reference['tablename'] . ' in field ' . $reference['field'] . ')';
-                       }
-               } else {
-                       // Nothing to be done if file not found
-                       $this->errors[] = $path . ' not found (referenced in element ' . $reference['recuid'] . ' of table ' . $reference['tablename'] . ' in field ' . $reference['field'] . ')';
-               }
-               return $fileObject;
-       }
-
-       /**
-        * Saves the modified content to the database and updates the sys_refindex accordingly.
-        *
-        * @param string $modifiedText Original content with the file links replaced
-        * @param array $reference sys_refindex record
-        * @param \TYPO3\CMS\Core\Resource\AbstractFile $file
-        * @return void
-        */
-       protected function saveChanges($modifiedText, array $reference, $file) {
-
-               // If DBAL is not installed, we can start a transaction before saving
-               // This ensures that a possible time out doesn't break the database integrity
-               // by occurring between the two needed DB writes.
-               if (!$this->isDbalInstalled) {
-                       $GLOBALS['TYPO3_DB']->sql_query('START TRANSACTION');
-               }
-
-               // Save the changed field
-               $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
-                       $reference['tablename'],
-                       'uid = ' . $reference['recuid'],
-                       array(
-                               $reference['field'] => $modifiedText
-                       )
-               );
-               $this->queries[] = htmlspecialchars(str_replace(LF, ' ', $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery));
-
-               // Finally, update the sys_refindex table as well
-               $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
-                       'sys_refindex',
-                       'hash = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($reference['hash'], 'sys_refindex'),
-                       array(
-                               'ref_table'  => 'sys_file',
-                               'ref_uid'    => $file->getUid(),
-                               'ref_string' => ''
-                       )
-               );
-               $this->queries[] = str_replace(LF, ' ', $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery);
-
-               // Confirm the transaction
-               if (!$this->isDbalInstalled) {
-                       $GLOBALS['TYPO3_DB']->sql_query('COMMIT');
-               }
-       }
-
-       /**
-        * Use sys_refindex to find all links to "old" files in typolink tags.
-        *
-        * This will find any RTE-enabled field.
-        *
-        * @return array Entries from sys_refindex
-        */
-       protected function findOldLinks() {
-               $records = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
-                       'hash, tablename, recuid, field, ref_table, ref_uid, ref_string',
-                       'sys_refindex',
-                       'softref_key = \'typolink_tag\' AND ref_table = \'_FILE\' '
-               );
-               return $records;
-       }
-
-}
diff --git a/typo3/sysext/install/Classes/Updates/RteMagicImagesUpdateWizard.php b/typo3/sysext/install/Classes/Updates/RteMagicImagesUpdateWizard.php
deleted file mode 100644 (file)
index 182186c..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\Updates;
-
-/**
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Upgrade wizard that moves all RTE magic images (usually in uploads/)
- * that have the prefix RTEmagicC_* to the default storage (usually fileadmin/_migrated/RTE/)
- * and also updates the according fields (e.g. tt_content:123:bodytext) with the new string, and updates
- * the softreference index
- *
- * @author Benjamin Mack <benni@typo3.org>
- */
-class RteMagicImagesUpdateWizard extends AbstractUpdate {
-
-       /**
-        * Title of the update wizard
-        * @var string
-        */
-       protected $title = 'Migrate all RTE magic images from uploads/RTEmagicC_* to fileadmin/_migrated/RTE/';
-
-       /**
-        * The default storage
-        * @var \TYPO3\CMS\Core\Resource\ResourceStorage
-        */
-       protected $storage;
-
-       /**
-        * The old location of the file name, e.g. "uploads/RTEmagicC_"
-        * @var string
-        */
-       protected $oldPrefix = NULL;
-
-       /**
-        * @var \TYPO3\CMS\Core\Log\Logger
-        */
-       protected $logger;
-
-       /**
-        * Constructor
-        */
-       public function __construct() {
-               /** @var $logManager \TYPO3\CMS\Core\Log\LogManager */
-               $logManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogManager');
-               $this->logger = $logManager->getLogger(__CLASS__);
-
-               // Set it to uploads/RTEmagicC_*
-               if (!empty($GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir'])) {
-                       $this->oldPrefix = $GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir'] . 'RTEmagicC_';
-               }
-       }
-
-       /**
-        * Initialize the storage repository.
-        *
-        * @return void
-        */
-       public function init() {
-               /** @var $storageRepository \TYPO3\CMS\Core\Resource\StorageRepository */
-               $storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\StorageRepository');
-               $storages = $storageRepository->findAll();
-               $this->storage = $storages[0];
-       }
-
-       /**
-        * Checks if an update is needed
-        *
-        * @param string $description The description for the update
-        * @return bool TRUE if an update is needed, FALSE otherwise
-        */
-       public function checkForUpdate(&$description) {
-               $description = 'This update wizard goes through all magic images, located in "' . htmlspecialchars($this->oldPrefix) . '", and moves the files to fileadmin/_migrated/RTE/.';
-               $description .= '<br />It also moves the files from uploads/ to the fileadmin/_migrated/ path.';
-               // Issue warning about sys_refindex needing to be up to date
-               /** @var \TYPO3\CMS\Core\Messaging\FlashMessage $message */
-               $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
-                       'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
-                       'This script bases itself on the references contained in the general reference index (sys_refindex). It is strongly advised to update it before running this wizard.',
-                       'Updating the reference index',
-                       \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING
-               );
-               $description .= $message->render();
-
-               // Wizard is only available if oldPrefix set
-               if ($this->oldPrefix) {
-                       $oldRecords = $this->findMagicImagesInOldLocation();
-                       if (count($oldRecords) > 0) {
-                               $description .= '<br />There are currently <strong>' . count($oldRecords) . '</strong> magic images in the old directory.<br />';
-                               return TRUE;
-                       }
-               }
-
-               // Disable the update wizard if there are no old RTE magic images
-               return FALSE;
-       }
-
-       /**
-        * Performs the database update.
-        *
-        * @param array $dbQueries queries done in this update
-        * @param mixed $customMessages custom messages
-        * @return bool TRUE on success, FALSE on error
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               $this->init();
-
-               if (!PATH_site) {
-                       throw new \Exception('PATH_site was undefined.');
-               }
-
-               $fileadminDirectory = rtrim($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], '/');
-               $targetDirectory = '/_migrated/RTE/';
-               $fullTargetDirectory = PATH_site . $fileadminDirectory . $targetDirectory;
-
-               // Create the directory, if necessary
-               if (!is_dir($fullTargetDirectory)) {
-                       \TYPO3\CMS\Core\Utility\GeneralUtility::mkdir_deep($fullTargetDirectory);
-               }
-
-
-               $oldRecords = $this->findMagicImagesInOldLocation();
-               foreach ($oldRecords as $refRecord) {
-
-                       // Is usually uploads/RTE_magicC_123423324.png.png
-                       $sourceFileName     = $refRecord['ref_string'];
-                       // Absolute path/filename
-                       $fullSourceFileName = PATH_site . $refRecord['ref_string'];
-                       $targetFileName     = $targetDirectory . \TYPO3\CMS\Core\Utility\PathUtility::basename($refRecord['ref_string']);
-                       // Full directory
-                       $fullTargetFileName = $fullTargetDirectory . \TYPO3\CMS\Core\Utility\PathUtility::basename($refRecord['ref_string']);
-
-                       // maybe the file has been moved previously
-                       if (!file_exists($fullTargetFileName)) {
-                               // If the source file does not exist, we should just continue, but leave a message in the docs;
-                               // ideally, the user would be informed after the update as well.
-                               if (!file_exists(PATH_site . $sourceFileName)) {
-                                       $this->logger->notice('File ' . $sourceFileName . ' does not exist. Reference was not migrated.', array());
-
-                                       $format = 'File \'%s\' does not exist. Referencing field: %s.%d.%s. The reference was not migrated.';
-                                       $message = sprintf($format, $sourceFileName, $refRecord['tablename'], $refRecord['recuid'], $refRecord['field']);
-                                       $customMessages .= PHP_EOL . $message;
-
-                                       continue;
-                               }
-
-                               rename($fullSourceFileName, $fullTargetFileName);
-                       }
-
-                       // Get the File object
-                       $file = $this->storage->getFile($targetFileName);
-                       if ($file instanceof \TYPO3\CMS\Core\Resource\File) {
-                               // And now update the referencing field
-                               $targetFieldName = $refRecord['field'];
-                               $targetRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
-                                       'uid, ' . $targetFieldName,
-                                       $refRecord['tablename'],
-                                       'uid=' . (int)$refRecord['recuid']
-                               );
-                               if ($targetRecord) {
-                                       // Replace the old filename with the new one, and add data-* attributes used by the RTE
-                                       $searchString = 'src="' . $sourceFileName . '"';
-                                       $replacementString = 'src="' . $fileadminDirectory . $targetFileName . '"';
-                                       $replacementString .= ' data-htmlarea-file-uid="' . $file->getUid() . '"';
-                                       $replacementString .= ' data-htmlarea-file-table="sys_file"';
-                                       $targetRecord[$targetFieldName] = str_replace(
-                                               $searchString,
-                                               $replacementString,
-                                               $targetRecord[$targetFieldName]
-                                       );
-                                       // Update the record
-                                       $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
-                                               $refRecord['tablename'],
-                                               'uid=' . (int)$refRecord['recuid'],
-                                               array($targetFieldName => $targetRecord[$targetFieldName])
-                                       );
-                                       $queries[] = str_replace(LF, ' ', $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery);
-
-                                       // Finally, update the sys_refindex table as well
-                                       $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
-                                               'sys_refindex',
-                                               'hash=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($refRecord['hash'], 'sys_refindex'),
-                                               array(
-                                                       'ref_table'  => 'sys_file',
-                                                       'softref_key' => 'rtehtmlarea_images',
-                                                       'ref_uid'    => $file->getUid(),
-                                                       'ref_string' => $fileadminDirectory . $targetFileName
-                                               )
-                                       );
-                                       $queries[] = str_replace(LF, ' ', $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery);
-                               }
-
-                       }
-               }
-
-               return TRUE;
-       }
-
-       /**
-        * Go through the soft refindex and find all occurences where the old filename
-        * is still written in the ref_string
-        *
-        * @return array Entries from sys_refindex
-        */
-       protected function findMagicImagesInOldLocation() {
-               $records = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
-                       'hash, tablename, recuid, field, ref_table, ref_uid, ref_string',
-                       'sys_refindex',
-                       'ref_string LIKE "' . $GLOBALS['TYPO3_DB']->escapeStrForLike($this->oldPrefix, 'sys_refindex') . '%"',
-                       '',
-                       'ref_string ASC'
-               );
-               return $records;
-       }
-
-}
diff --git a/typo3/sysext/install/Classes/Updates/TceformsUpdateWizard.php b/typo3/sysext/install/Classes/Updates/TceformsUpdateWizard.php
deleted file mode 100644 (file)
index 92df947..0000000
+++ /dev/null
@@ -1,382 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\Updates;
-
-/**
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use TYPO3\CMS\Core\Database\DatabaseConnection;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Extbase\Domain\Model\File;
-
-/**
- * Upgrade wizard which goes through all files referenced in the tt_content.image filed
- * and creates sys_file records as well as sys_file_reference records for the individual usages.
- *
- * @author Ingmar Schlecht <ingmar@typo3.org>
- */
-class TceformsUpdateWizard extends AbstractUpdate {
-
-       /**
-        * Number of records fetched per database query
-        * Used to prevent memory overflows for huge databases
-        */
-       const RECORDS_PER_QUERY = 1000;
-
-       /**
-        * @var string
-        */
-       protected $title = 'Migrate all file relations from tt_content.image and pages.media';
-
-       /**
-        * @var \TYPO3\CMS\Core\Resource\ResourceStorage
-        */
-       protected $storage;
-
-       /**
-        * @var \TYPO3\CMS\Core\Log\Logger
-        */
-       protected $logger;
-
-       /**
-        * @var DatabaseConnection
-        */
-       protected $database;
-
-       /**
-        * Table fields to migrate
-        * @var array
-        */
-       protected $tables = array(
-               'tt_content' => array(
-                       'image' => array(
-                               'sourcePath' => 'uploads/pics/',
-                               // Relative to fileadmin
-                               'targetPath' => '_migrated/pics/',
-                               'titleTexts' => 'titleText',
-                               'captions' => 'imagecaption',
-                               'links' => 'image_link',
-                               'alternativeTexts' => 'altText'
-                       )
-               ),
-               'pages' => array(
-                       'media' => array(
-                               'sourcePath' => 'uploads/media/',
-                               // Relative to fileadmin
-                               'targetPath' => '_migrated/media/'
-                       )
-               ),
-               'pages_language_overlay' => array(
-                       'media' => array(
-                               'sourcePath' => 'uploads/media/',
-                               // Relative to fileadmin
-                               'targetPath' => '_migrated/media/'
-                       )
-               )
-       );
-
-       /**
-        * Constructor
-        */
-       public function __construct() {
-               /** @var $logManager \TYPO3\CMS\Core\Log\LogManager */
-               $logManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogManager');
-               $this->logger = $logManager->getLogger(__CLASS__);
-               $this->database = $GLOBALS['TYPO3_DB'];
-       }
-
-       /**
-        * Initialize the storage repository.
-        */
-       public function init() {
-               /** @var $storageRepository \TYPO3\CMS\Core\Resource\StorageRepository */
-               $storageRepository = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\StorageRepository');
-               $storages = $storageRepository->findAll();
-               $this->storage = $storages[0];
-       }
-
-       /**
-        * Checks if an update is needed
-        *
-        * @param string &$description The description for the update
-        * @return bool TRUE if an update is needed, FALSE otherwise
-        */
-       public function checkForUpdate(&$description) {
-               $description = 'This update wizard goes through all files that are referenced in the tt_content.image and '
-                       . 'pages.media / pages_language_overlay.media field and adds the files to the new File Index.<br />'
-                       . 'It also moves the files from uploads/ to the fileadmin/_migrated/ path.<br /><br />'
-                       . 'This update wizard can be called multiple times in case it didn\'t finish after running once.';
-
-               if ($this->versionNumber < 6000000) {
-                       // Nothing to do
-                       return FALSE;
-               }
-
-               $finishedFields = $this->getFinishedFields();
-               if (count($finishedFields) === 0) {
-                       // Nothing done yet, so there's plenty of work left
-                       return TRUE;
-               }
-
-               $numberOfFieldsToMigrate = 0;
-               foreach ($this->tables as $table => $tableConfiguration) {
-                       // find all additional fields we should get from the database
-                       foreach (array_keys($tableConfiguration) as $fieldToMigrate) {
-                               $fieldKey = $table . ':' . $fieldToMigrate;
-                               if (!in_array($fieldKey, $finishedFields)) {
-                                       $numberOfFieldsToMigrate++;
-                               }
-                       }
-               }
-               return $numberOfFieldsToMigrate > 0;
-       }
-
-       /**
-        * Performs the database update.
-        *
-        * @param array &$dbQueries Queries done in this update
-        * @param mixed &$customMessages Custom messages
-        * @return bool TRUE on success, FALSE on error
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               if ($this->versionNumber < 6000000) {
-                       // Nothing to do
-                       return TRUE;
-               }
-               try {
-                       $this->init();
-                       $finishedFields = $this->getFinishedFields();
-                       foreach ($this->tables as $table => $tableConfiguration) {
-                               // find all additional fields we should get from the database
-                               foreach ($tableConfiguration as $fieldToMigrate => $fieldConfiguration) {
-                                       $fieldKey = $table . ':' . $fieldToMigrate;
-                                       if (in_array($fieldKey, $finishedFields)) {
-                                               // this field was already migrated
-                                               continue;
-                                       }
-                                       $fieldsToGet = array($fieldToMigrate);
-                                       if (isset($fieldConfiguration['titleTexts'])) {
-                                               $fieldsToGet[] = $fieldConfiguration['titleTexts'];
-                                       }
-                                       if (isset($fieldConfiguration['alternativeTexts'])) {
-                                               $fieldsToGet[] = $fieldConfiguration['alternativeTexts'];
-                                       }
-                                       if (isset($fieldConfiguration['captions'])) {
-                                               $fieldsToGet[] = $fieldConfiguration['captions'];
-                                       }
-                                       if (isset($fieldConfiguration['links'])) {
-                                               $fieldsToGet[] = $fieldConfiguration['links'];
-                                       }
-
-                                       do {
-                                               $records = $this->getRecordsFromTable($table, $fieldToMigrate, $fieldsToGet, self::RECORDS_PER_QUERY);
-                                               foreach ($records as $record) {
-                                                       $this->migrateField($table, $record, $fieldToMigrate, $fieldConfiguration, $customMessages);
-                                               }
-                                       } while (count($records) === self::RECORDS_PER_QUERY);
-
-                                       // add the field to the "finished fields" if things didn't fail above
-                                       if (is_array($records)) {
-                                               $finishedFields[] = $fieldKey;
-                                       }
-                               }
-                       }
-                       $this->markWizardAsDone(implode(',', $finishedFields));
-               } catch (\Exception $e) {
-                       $customMessages .= PHP_EOL . $e->getMessage();
-               }
-               return empty($customMessages);
-       }
-
-       /**
-        * We write down the fields that were migrated. Like this: tt_content:media
-        * so you can check whether a field was already migrated
-        *
-        * @return array
-        */
-       protected function getFinishedFields() {
-               $className = 'TYPO3\\CMS\\Install\\Updates\\TceformsUpdateWizard';
-               return isset($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone'][$className])
-                       ? explode(',', $GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone'][$className])
-                       : array();
-       }
-
-       /**
-        * Get records from table where the field to migrate is not empty (NOT NULL and != '')
-        * and also not numeric (which means that it is migrated)
-        *
-        * @param string $table
-        * @param string $fieldToMigrate
-        * @param array $relationFields
-        * @param int $limit Maximum number records to select
-        * @throws \RuntimeException
-        * @return array
-        */
-       protected function getRecordsFromTable($table, $fieldToMigrate, $relationFields, $limit) {
-               $fields = implode(',', array_merge($relationFields, array('uid', 'pid')));
-               $deletedCheck = isset($GLOBALS['TCA'][$table]['ctrl']['delete'])
-                       ? ' AND ' . $GLOBALS['TCA'][$table]['ctrl']['delete'] . '=0'
-                       : '';
-               $where = $fieldToMigrate . ' IS NOT NULL'
-                       . ' AND ' . $fieldToMigrate . ' != \'\''
-                       . ' AND CAST(CAST(' . $fieldToMigrate . ' AS DECIMAL) AS CHAR) <> CAST(' . $fieldToMigrate . ' AS CHAR)'
-                       . $deletedCheck;
-               $result = $this->database->exec_SELECTgetRows($fields, $table, $where, '', '', $limit);
-               if ($result === NULL) {
-                       throw new \RuntimeException('Database query failed. Error was: ' . $this->database->sql_error());
-               }
-               return $result;
-       }
-
-       /**
-        * Migrates a single field.
-        *
-        * @param string $table
-        * @param array $row
-        * @param string $fieldname
-        * @param array $fieldConfiguration
-        * @param string $customMessages
-        * @return array A list of performed database queries
-        * @throws \Exception
-        */
-       protected function migrateField($table, $row, $fieldname, $fieldConfiguration, &$customMessages) {
-               $titleTextContents = array();
-               $alternativeTextContents = array();
-               $captionContents = array();
-               $linkContents = array();
-
-               $fieldItems = GeneralUtility::trimExplode(',', $row[$fieldname], TRUE);
-               if (empty($fieldItems) || is_numeric($row[$fieldname])) {
-                       return array();
-               }
-               if (isset($fieldConfiguration['titleTexts'])) {
-                       $titleTextField = $fieldConfiguration['titleTexts'];
-                       $titleTextContents = explode(LF, $row[$titleTextField]);
-               }
-
-               if (isset($fieldConfiguration['alternativeTexts'])) {
-                       $alternativeTextField = $fieldConfiguration['alternativeTexts'];
-                       $alternativeTextContents = explode(LF, $row[$alternativeTextField]);
-               }
-               if (isset($fieldConfiguration['captions'])) {
-                       $captionField = $fieldConfiguration['captions'];
-                       $captionContents = explode(LF, $row[$captionField]);
-               }
-               if (isset($fieldConfiguration['links'])) {
-                       $linkField = $fieldConfiguration['links'];
-                       $linkContents = explode(LF, $row[$linkField]);
-               }
-               $fileadminDirectory = rtrim($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], '/') . '/';
-               $queries = array();
-               $i = 0;
-
-               if (!PATH_site) {
-                       throw new \Exception('PATH_site was undefined.');
-               }
-
-               $storageUid = (int)$this->storage->getUid();
-
-               foreach ($fieldItems as $item) {
-                       $fileUid = NULL;
-                       $sourcePath = PATH_site . $fieldConfiguration['sourcePath'] . $item;
-                       $targetDirectory = PATH_site . $fileadminDirectory . $fieldConfiguration['targetPath'];
-                       $targetPath = $targetDirectory . $item;
-
-                       // maybe the file was already moved, so check if the original file still exists
-                       if (file_exists($sourcePath)) {
-                               if (!is_dir($targetDirectory)) {
-                                       GeneralUtility::mkdir_deep($targetDirectory);
-                               }
-
-                               // see if the file already exists in the storage
-                               $fileSha1 = sha1_file($sourcePath);
-
-                               $existingFileRecord = $this->database->exec_SELECTgetSingleRow(
-                                       'uid',
-                                       'sys_file',
-                                       'sha1=' . $this->database->fullQuoteStr($fileSha1, 'sys_file') . ' AND storage=' . $storageUid
-                               );
-                               // the file exists, the file does not have to be moved again
-                               if (is_array($existingFileRecord)) {
-                                       $fileUid = $existingFileRecord['uid'];
-                               } else {
-                                       // just move the file (no duplicate)
-                                       rename($sourcePath, $targetPath);
-                               }
-                       }
-
-                       if ($fileUid === NULL) {
-                               // get the File object if it hasn't been fetched before
-                               try {
-                                       // if the source file does not exist, we should just continue, but leave a message in the docs;
-                                       // ideally, the user would be informed after the update as well.
-                                       /** @var File $file */
-                                       $file = $this->storage->getFile($fieldConfiguration['targetPath'] . $item);
-                                       $fileUid = $file->getUid();
-
-                               } catch (\InvalidArgumentException $e) {
-
-                                       // no file found, no reference can be set
-                                       $this->logger->notice(
-                                               'File ' . $fieldConfiguration['sourcePath'] . $item . ' does not exist. Reference was not migrated.',
-                                               array('table' => $table, 'record' => $row, 'field' => $fieldname)
-                                       );
-
-                                       $format = 'File \'%s\' does not exist. Referencing field: %s.%d.%s. The reference was not migrated.';
-                                       $message = sprintf($format, $fieldConfiguration['sourcePath'] . $item, $table, $row['uid'], $fieldname);
-                                       $customMessages .= PHP_EOL . $message;
-
-                                       continue;
-                               }
-                       }
-
-                       if ($fileUid > 0) {
-                               $fields = array(
-                                       // TODO add sorting/sorting_foreign
-                                       'fieldname' => $fieldname,
-                                       'table_local' => 'sys_file',
-                                       // the sys_file_reference record should always placed on the same page
-                                       // as the record to link to, see issue #46497
-                                       'pid' => ($table === 'pages' ? $row['uid'] : $row['pid']),
-                                       'uid_foreign' => $row['uid'],
-                                       'uid_local' => $fileUid,
-                                       'tablenames' => $table,
-                                       'crdate' => time(),
-                                       'tstamp' => time()
-                               );
-                               if (isset($titleTextField)) {
-                                       $fields['title'] = trim($titleTextContents[$i]);
-                               }
-                               if (isset($alternativeTextField)) {
-                                       $fields['alternative'] = trim($alternativeTextContents[$i]);
-                               }
-                               if (isset($captionField)) {
-                                       $fields['description'] = trim($captionContents[$i]);
-                               }
-                               if (isset($linkField)) {
-                                       $fields['link'] = trim($linkContents[$i]);
-                               }
-                               $this->database->exec_INSERTquery('sys_file_reference', $fields);
-                               $queries[] = str_replace(LF, ' ', $this->database->debug_lastBuiltQuery);
-                               ++$i;
-                       }
-               }
-
-               // Update referencing table's original field to now contain the count of references,
-               // but only if all new references could be set
-               if ($i === count($fieldItems)) {
-                       $this->database->exec_UPDATEquery($table, 'uid=' . $row['uid'], array($fieldname => $i));
-                       $queries[] = str_replace(LF, ' ', $this->database->debug_lastBuiltQuery);
-               }
-               return $queries;
-       }
-}
diff --git a/typo3/sysext/install/Classes/Updates/TruncateSysFileProcessedFileTable.php b/typo3/sysext/install/Classes/Updates/TruncateSysFileProcessedFileTable.php
deleted file mode 100644 (file)
index a598fdd..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\Updates;
-
-/**
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Upgrade wizard which will truncate the sys_file_processedfile table
- */
-class TruncateSysFileProcessedFileTable extends AbstractUpdate {
-
-       /**
-        * @var string
-        */
-       protected $title = 'Truncate all processed files to clean up obsolete records.';
-
-       /**
-        * Checks whether updates are required.
-        *
-        * @param string &$description The description for the update
-        * @return bool Whether an update is required (TRUE) or not (FALSE)
-        */
-       public function checkForUpdate(&$description) {
-               if ($this->isWizardDone() || !$this->checkIfTableExists('sys_file_processedfile')) {
-                       return FALSE;
-               }
-
-               $description = 'To re-process all files correctly we truncate the table. This will make sure there are no obsolete files in the database.';
-               return TRUE;
-       }
-
-       /**
-        * Performs the accordant updates.
-        *
-        * @param array &$databaseQueries Queries done in this update
-        * @param mixed &$customMessages Custom messages
-        * @return bool Whether everything went smoothly or not
-        */
-       public function performUpdate(array &$databaseQueries, &$customMessages) {
-               $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('sys_file_processedfile');
-               $databaseQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
-               $this->markWizardAsDone();
-               return TRUE;
-       }
-
-}
diff --git a/typo3/sysext/install/Classes/Updates/TtContentUploadsUpdateWizard.php b/typo3/sysext/install/Classes/Updates/TtContentUploadsUpdateWizard.php
deleted file mode 100644 (file)
index 54b1089..0000000
+++ /dev/null
@@ -1,319 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\Updates;
-
-/**
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Upgrade wizard which goes through all files referenced in the tt_content.media filed
- * and creates sys_file records as well as sys_file_reference records for the individual usages.
- *
- * @author Steffen Ritter <steffen.ritter@typo3.org>
- */
-class TtContentUploadsUpdateWizard extends AbstractUpdate {
-
-       const FOLDER_ContentUploads = '_migrated/content_uploads';
-
-       /**
-        * @var string
-        */
-       protected $title = 'Migrate file relations of tt_content "uploads"';
-
-       /**
-        * @var string
-        */
-       protected $targetDirectory;
-
-       /**
-        * @var \TYPO3\CMS\Core\Resource\ResourceFactory
-        */
-       protected $fileFactory;
-
-       /**
-        * @var \TYPO3\CMS\Core\Resource\Index\FileIndexRepository
-        */
-       protected $fileIndexRepository;
-
-       /**
-        * @var \TYPO3\CMS\Core\Resource\ResourceStorage
-        */
-       protected $storage;
-
-       /**
-        * Initialize all required repository and factory objects.
-        *
-        * @throws \RuntimeException
-        */
-       protected function init() {
-               $fileadminDirectory = rtrim($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], '/') . '/';
-               /** @var $storageRepository \TYPO3\CMS\Core\Resource\StorageRepository */
-               $storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\StorageRepository');
-               $storages = $storageRepository->findAll();
-               foreach ($storages as $storage) {
-                       $storageRecord = $storage->getStorageRecord();
-                       $configuration = $storage->getConfiguration();
-                       $isLocalDriver = $storageRecord['driver'] === 'Local';
-                       $isOnFileadmin = !empty($configuration['basePath']) && \TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($configuration['basePath'], $fileadminDirectory);
-                       if ($isLocalDriver && $isOnFileadmin) {
-                               $this->storage = $storage;
-                               break;
-                       }
-               }
-               if (!isset($this->storage)) {
-                       throw new \RuntimeException('Local default storage could not be initialized - might be due to missing sys_file* tables.');
-               }
-               $this->fileFactory = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\ResourceFactory');
-               $this->fileIndexRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\Index\\FileIndexRepository');
-               $this->targetDirectory = PATH_site . $fileadminDirectory . self::FOLDER_ContentUploads . '/';
-       }
-
-       /**
-        * Checks if an update is needed
-        *
-        * @param string &$description The description for the update
-        * @return bool TRUE if an update is needed, FALSE otherwise
-        */
-       public function checkForUpdate(&$description) {
-               $updateNeeded = FALSE;
-               // Fetch records where the field media does not contain a plain integer value
-               // * check whether media field is not empty
-               // * then check whether media field does not contain a reference count (= not integer)
-               $mapping = $this->getTableColumnMapping();
-               $sql = $GLOBALS['TYPO3_DB']->SELECTquery(
-                       'COUNT(' . $mapping['mapFieldNames']['uid'] . ')',
-                       $mapping['mapTableName'],
-                       '1=1'
-               );
-               $whereClause = $this->getDbalCompliantUpdateWhereClause();
-               $sql = str_replace('WHERE 1=1', $whereClause, $sql);
-               $resultSet = $GLOBALS['TYPO3_DB']->sql_query($sql);
-               $notMigratedRowsCount = 0;
-               if ($resultSet !== FALSE) {
-                       list($notMigratedRowsCount) = $GLOBALS['TYPO3_DB']->sql_fetch_row($resultSet);
-                       $notMigratedRowsCount = (int)$notMigratedRowsCount;
-                       $GLOBALS['TYPO3_DB']->sql_free_result($resultSet);
-               }
-               if ($notMigratedRowsCount > 0) {
-                       $description = 'There are Content Elements of type "upload" which are referencing files that are not using ' . ' the File Abstraction Layer. This wizard will move the files to fileadmin/' . self::FOLDER_ContentUploads . ' and index them.';
-                       $updateNeeded = TRUE;
-               }
-               return $updateNeeded;
-       }
-
-       /**
-        * Performs the database update.
-        *
-        * @param array &$dbQueries Queries done in this update
-        * @param mixed &$customMessages Custom messages
-        * @return bool TRUE on success, FALSE on error
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               $this->init();
-               $records = $this->getRecordsFromTable('tt_content');
-               $this->checkPrerequisites();
-               foreach ($records as $singleRecord) {
-                       $this->migrateRecord($singleRecord);
-               }
-               return TRUE;
-       }
-
-       /**
-        * Ensures a new folder "fileadmin/content_upload/" is available.
-        *
-        * @return void
-        */
-       protected function checkPrerequisites() {
-               if (!$this->storage->hasFolder(self::FOLDER_ContentUploads)) {
-                       $this->storage->createFolder(self::FOLDER_ContentUploads, $this->storage->getRootLevelFolder());
-               }
-       }
-
-       /**
-        * Processes the actual transformation from CSV to sys_file_references
-        *
-        * @param array $record
-        * @return void
-        */
-       protected function migrateRecord(array $record) {
-               $collections = array();
-               if (trim($record['select_key'])) {
-                       $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_file_collection', array(
-                               'pid' => $record['pid'],
-                               'title' => $record['select_key'],
-                               'storage' => $this->storage->getUid(),
-                               'folder' => ltrim('fileadmin/', $record['select_key'])
-                       ));
-                       $collections[] = $GLOBALS['TYPO3_DB']->sql_insert_id();
-               }
-               $files = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $record['media'], TRUE);
-               $descriptions = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('
-', $record['imagecaption']);
-               $titleText = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('
-', $record['titleText']);
-               $i = 0;
-               foreach ($files as $file) {
-                       if (file_exists(PATH_site . 'uploads/media/' . $file)) {
-                               \TYPO3\CMS\Core\Utility\GeneralUtility::upload_copy_move(PATH_site . 'uploads/media/' . $file, $this->targetDirectory . $file);
-                               $fileObject = $this->storage->getFile(self::FOLDER_ContentUploads . '/' . $file);
-                               $this->fileIndexRepository->add($fileObject);
-                               $dataArray = array(
-                                       'uid_local' => $fileObject->getUid(),
-                                       'tablenames' => 'tt_content',
-                                       'uid_foreign' => $record['uid'],
-                                       // the sys_file_reference record should always placed on the same page
-                                       // as the record to link to, see issue #46497
-                                       'pid' => $record['pid'],
-                                       'fieldname' => 'media',
-                                       'sorting_foreign' => $i
-                               );
-                               if (isset($descriptions[$i])) {
-                                       $dataArray['description'] = $descriptions[$i];
-                               }
-                               if (isset($titleText[$i])) {
-                                       $dataArray['alternative'] = $titleText[$i];
-                               }
-                               $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_file_reference', $dataArray);
-                               unlink(PATH_site . 'uploads/media/' . $file);
-                       }
-                       $i++;
-               }
-               $this->cleanRecord($record, $i, $collections);
-       }
-
-       /**
-        * Removes the old fields from the database-record
-        *
-        * @param array $record
-        * @param int $fileCount
-        * @param array $collectionUids
-        * @return void
-        */
-       protected function cleanRecord(array $record, $fileCount, array $collectionUids) {
-               $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tt_content', 'uid = ' . $record['uid'], array(
-                       'media' => $fileCount,
-                       'imagecaption' => '',
-                       'titleText' => '',
-                       'altText' => '',
-                       'select_key' => '',
-                       'file_collections' => implode(',', $collectionUids)
-               ));
-       }
-
-       /**
-        * Retrieve every record which needs to be processed
-        *
-        * @return array
-        */
-       protected function getRecordsFromTable() {
-               $mapping = $this->getTableColumnMapping();
-               $reverseFieldMapping = array_flip($mapping['mapFieldNames']);
-
-               $fields = array();
-               foreach (array('uid', 'pid', 'select_key', 'media', 'imagecaption', 'titleText') as $columnName) {
-                       $fields[] = $mapping['mapFieldNames'][$columnName];
-               }
-               $fields = implode(',', $fields);
-
-               $sql = $GLOBALS['TYPO3_DB']->SELECTquery(
-                       $fields,
-                       $mapping['mapTableName'],
-                       '1=1'
-               );
-               $whereClause = $this->getDbalCompliantUpdateWhereClause();
-               $sql = str_replace('WHERE 1=1', $whereClause, $sql);
-               $resultSet = $GLOBALS['TYPO3_DB']->sql_query($sql);
-               $records = array();
-               if (!$GLOBALS['TYPO3_DB']->sql_error()) {
-                       while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultSet)) !== FALSE) {
-                               // Mapping back column names to native TYPO3 names
-                               $record = array();
-                               foreach ($reverseFieldMapping as $columnName => $finalColumnName) {
-                                       $record[$finalColumnName] = $row[$columnName];
-                               }
-                               $records[] = $record;
-                       }
-                       $GLOBALS['TYPO3_DB']->sql_free_result($resultSet);
-               }
-               return $records;
-       }
-
-       /**
-        * Returns a DBAL-compliant where clause to be used for the update where clause.
-        * We have DBAL-related code here because the SQL parser is not able to properly
-        * parse this complex condition but we know that it is compatible with the DBMS
-        * we support in TYPO3 Core.
-        *
-        * @return string
-        */
-       protected function getDbalCompliantUpdateWhereClause() {
-               $mapping = $this->getTableColumnMapping();
-               $this->quoteIdentifiers($mapping);
-
-               $where = sprintf(
-                       'WHERE %s <> \'\' AND CAST(CAST(%s AS DECIMAL) AS CHAR) <> CAST(%s AS CHAR) OR (%s = \'uploads\' AND %s != \'\')',
-                       $mapping['mapFieldNames']['media'],
-                       $mapping['mapFieldNames']['media'],
-                       $mapping['mapFieldNames']['media'],
-                       $mapping['mapFieldNames']['CType'],
-                       $mapping['mapFieldNames']['select_key']
-               );
-
-               return $where;
-       }
-
-       /**
-        * Returns the table and column mapping.
-        *
-        * @return array
-        */
-       protected function getTableColumnMapping() {
-               $mapping = array(
-                       'mapTableName' => 'tt_content',
-                       'mapFieldNames' => array(
-                               'uid'          => 'uid',
-                               'pid'          => 'pid',
-                               'media'        => 'media',
-                               'imagecaption' => 'imagecaption',
-                               'titleText'    => 'titleText',
-                               'CType'        => 'CType',
-                               'select_key'   => 'select_key',
-                       )
-               );
-
-               if ($GLOBALS['TYPO3_DB'] instanceof \TYPO3\CMS\Dbal\Database\DatabaseConnection) {
-                       if (!empty($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['dbal']['mapping']['tt_content'])) {
-                               $mapping = array_merge_recursive($mapping, $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['dbal']['mapping']['tt_content']);
-                       }
-               }
-
-               return $mapping;
-       }
-
-       /**
-        * Quotes identifiers for DBAL-compliant query.
-        *
-        * @param array &$mapping
-        * @return void
-        */
-       protected function quoteIdentifiers(array &$mapping) {
-               if ($GLOBALS['TYPO3_DB'] instanceof \TYPO3\CMS\Dbal\Database\DatabaseConnection) {
-                       if (!$GLOBALS['TYPO3_DB']->runningNative() && !$GLOBALS['TYPO3_DB']->runningADOdbDriver('mysql')) {
-                               $mapping['mapTableName'] = '"' . $mapping['mapTableName'] . '"';
-                               foreach ($mapping['mapFieldNames'] as $key => &$value) {
-                                       $value = '"' . $value . '"';
-                               }
-                       }
-               }
-       }
-
-}
index b8a43d2..c84c6ad 100644 (file)
@@ -1,19 +1,6 @@
 <?php
 return array(
-       'tx_coreupdates_addflexformstoacl' => 'TYPO3\\CMS\\Install\\CoreUpdates\\AddFlexFormsToAclUpdate',
-       'tx_coreupdates_charsetDefaults' => 'TYPO3\\CMS\\Install\\CoreUpdates\\CharsetDefaultsUpdate',
        'tx_coreupdates_compatversion' => 'TYPO3\\CMS\\Install\\CoreUpdates\\CompatVersionUpdate',
-       'tx_coreupdates_compressionlevel' => 'TYPO3\\CMS\\Install\\CoreUpdates\\CompressionLevelUpdate',
-       'tx_coreupdates_cscsplit' => 'TYPO3\\CMS\\Install\\CoreUpdates\\CscSplitUpdate',
-       'tx_coreupdates_flagsfromsprite' => 'TYPO3\\CMS\\Install\\CoreUpdates\\FlagsFromSpriteUpdate',
-       'tx_coreupdates_imagecols' => 'TYPO3\\CMS\\Install\\CoreUpdates\\ImagecolsUpdate',
-       'tx_coreupdates_imagelink' => 'TYPO3\\CMS\\Install\\CoreUpdates\\ImagelinkUpdate',
-       'tx_coreupdates_installsysexts' => 'TYPO3\\CMS\\Install\\CoreUpdates\\InstallSysExtsUpdate',
-       'tx_coreupdates_mediaFlexform' => 'TYPO3\\CMS\\Install\\CoreUpdates\\MediaFlexformUpdate',
-       'tx_coreupdates_mergeadvanced' => 'TYPO3\\CMS\\Install\\CoreUpdates\\MergeAdvancedUpdate',
-       'tx_coreupdates_migrateworkspaces' => 'TYPO3\\CMS\\Install\\CoreUpdates\\MigrateWorkspacesUpdate',
-       'tx_coreupdates_notinmenu' => 'TYPO3\\CMS\\Install\\CoreUpdates\\NotInMenuUpdate',
-       'tx_coreupdates_t3skin' => 'TYPO3\\CMS\\Install\\CoreUpdates\\T3skinUpdate',
        'Tx_Install_Service_BasicService' => 'TYPO3\\CMS\\Install\\Service\\EnableFileService',
        'TYPO3\\CMS\\Install\\EnableFileService' => 'TYPO3\\CMS\\Install\\Service\\EnableFileService',
        'tx_install_report_InstallStatus' => 'TYPO3\\CMS\\Install\\Report\\InstallStatusReport',
@@ -22,8 +9,4 @@ return array(
        't3lib_install_Sql' => 'TYPO3\\CMS\\Install\\Service\\SqlSchemaMigrationService',
        'TYPO3\\CMS\\Install\\Sql\\SchemaMigrator' => 'TYPO3\\CMS\\Install\\Service\\SqlSchemaMigrationService',
        'Tx_Install_Updates_Base' => 'TYPO3\\CMS\\Install\\Updates\\AbstractUpdate',
-       'Tx_Install_Updates_File_FilemountUpdateWizard' => 'TYPO3\\CMS\\Install\\Updates\\FilemountUpdateWizard',
-       'Tx_Install_Updates_File_InitUpdateWizard' => 'TYPO3\\CMS\\Install\\Updates\\InitUpdateWizard',
-       'Tx_Install_Updates_File_TceformsUpdateWizard' => 'TYPO3\\CMS\\Install\\Updates\\TceformsUpdateWizard',
-       'Tx_Install_Updates_File_TtContentUploadsUpdateWizard' => 'TYPO3\\CMS\\Install\\Updates\\TtContentUploadsUpdateWizard',
 );
index 2f9bc88..828910f 100644 (file)
@@ -1,32 +1,12 @@
 <?php
 defined('TYPO3_MODE') or die();
 
-// TYPO3 6.0 - Create page and TypoScript root template (automatically executed in 123-mode)
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['rootTemplate'] = 'TYPO3\\CMS\\Install\\Updates\\RootTemplateUpdate';
+// All versions
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['changeCompatibilityVersion'] = 'TYPO3\\CMS\\Install\\Updates\\CompatVersionUpdate';
-// TYPO3 6.0 - Add new tables for ExtensionManager
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['extensionManagerTables'] = 'TYPO3\\CMS\\Install\\Updates\\ExtensionManagerTables';
-// Split backend user and backend groups file permissions to single ones.
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['file_permissions'] = 'TYPO3\\CMS\\Install\\Updates\\FilePermissionUpdate';
-// Version 6.0: Migrate files content elements to use File Abstraction Layer
-// Migrations of tt_content.image DB fields and captions, alt texts, etc. into sys_file_reference records.
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['sysext_file_init'] = 'TYPO3\\CMS\\Install\\Updates\\InitUpdateWizard';
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['sysext_file_images'] = 'TYPO3\\CMS\\Install\\Updates\\TceformsUpdateWizard';
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['sysext_file_uploads'] = 'TYPO3\\CMS\\Install\\Updates\\TtContentUploadsUpdateWizard';
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['sysext_file_splitMetaData'] = 'TYPO3\\CMS\\Install\\Updates\\FileTableSplittingUpdate';
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['sysext_file_truncateProcessedFileTable'] = 'TYPO3\\CMS\\Install\\Updates\\TruncateSysFileProcessedFileTable';
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['referenceIntegrity'] = 'TYPO3\\CMS\\Install\\Updates\\ReferenceIntegrityUpdateWizard';
-
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['sysext_file_filemounts'] = 'TYPO3\\CMS\\Install\\Updates\\FilemountUpdateWizard';
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['fal_identifierhash'] = 'TYPO3\\CMS\\Install\\Updates\\FileIdentifierHashUpdate';
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['sysext_file_rtemagicimages'] = 'TYPO3\\CMS\\Install\\Updates\\RteMagicImagesUpdateWizard';
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['sysext_file_rtefilelinks'] = 'TYPO3\\CMS\\Install\\Updates\\RteFileLinksUpdateWizard';
 
+// TYPO3 7
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['backendUserStartModule'] = 'TYPO3\\CMS\\Install\\Updates\\BackendUserStartModuleUpdate';
 
-// Version 4.7: Migrate the flexforms of MediaElement
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['mediaElementFlexform'] = 'TYPO3\\CMS\\Install\\Updates\\MediaFlexformUpdate';
-
 $signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher');
 $signalSlotDispatcher->connect(
        'TYPO3\\CMS\\Install\\Service\\SqlExpectedSchemaService',
index 3458e13..6105419 100644 (file)
@@ -13,16 +13,28 @@ namespace TYPO3\CMS\Rtehtmlarea\Hook\Install;
  *
  * The TYPO3 project - inspiring people to share!
  */
+
+use TYPO3\CMS\Install\Updates\AbstractUpdate;
+
 /**
- * Contains the update class for the replacement of deprecated RTE properties in Page TSconfig. Used by the update wizard in the install tool.
+ * Contains the update class for the replacement of deprecated RTE properties in Page TSconfig.
+ * Used by the upgrade wizard in the install tool.
  *
  * @author Stanislas Rolland <typo3@sjbr.ca>
  */
-class DeprecatedRteProperties extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
+class DeprecatedRteProperties extends AbstractUpdate {
 
+       /**
+        * @var string
+        */
        protected $title = 'Deprecated RTE properties in Page TSconfig';
 
-       // Properties that may be replaced automatically in Page TSconfig (except inludes from external files)
+       /**
+        * Properties that may be replaced automatically in Page TSconfig (except inludes from external files)
+        * Syntax: 'oldProperty' => 'newProperty'
+        *
+        * @var array
+        */
        protected $replacementRteProperties = array(
                'disableRightClick' => 'contextMenu.disable',
                'disableContextMenu' => 'contextMenu.disable',
@@ -41,6 +53,12 @@ class DeprecatedRteProperties extends \TYPO3\CMS\Install\Updates\AbstractUpdate
                'defaultLinkTarget' => 'buttons.link.properties.target.default'
        );
 
+       /**
+        * Properties that may be replaced automatically in Page TSconfig (except inludes from external files)
+        * Syntax: 'oldProperty' => [ 'newProperty', 'newProperty' ]
+        *
+        * @var array
+        */
        protected $doubleReplacementRteProperties = array(
                'disableTYPO3Browsers' => array(
                        'buttons.image.TYPO3Browser.disabled',
@@ -56,7 +74,12 @@ class DeprecatedRteProperties extends \TYPO3\CMS\Install\Updates\AbstractUpdate
                )
        );
 
-       // Properties that may not be replaced automatically in Page TSconfig
+       /**
+        * Properties that may not be replaced automatically in Page TSconfig
+        * Syntax: 'oldProperty' => 'newProperty'
+        *
+        * @var array
+        */
        protected $useInsteadRteProperties = array(
                'fontSize' => 'buttons.fontsize.addItems',
                'RTE.default.classesAnchor' => 'RTE.default.buttons.link.properties.class.allowedClasses',
@@ -74,68 +97,67 @@ class DeprecatedRteProperties extends \TYPO3\CMS\Install\Updates\AbstractUpdate
        /**
         * Function which checks if update is needed. Called in the beginning of an update process.
         *
-        * @param string pointer to description for the update
+        * @param string $description Pointer to description for the update
         * @return bool TRUE if update is needs to be performed, FALSE otherwise.
         */
        public function checkForUpdate(&$description) {
                $result = FALSE;
-               // TYPO3 version 4.6 and above
-               if ($this->versionNumber >= 4006000) {
-                       $pages = $this->getPagesWithDeprecatedRteProperties($dbQueries, $customMessages);
-                       $pagesCount = count($pages);
-                       $deprecatedProperties = '';
-                       $deprecatedRteProperties = array_merge($this->replacementRteProperties, $this->useInsteadRteProperties);
-                       foreach ($deprecatedRteProperties as $deprecatedProperty => $replacementProperty) {
-                               $deprecatedProperties .= '<tr><td>' . $deprecatedProperty . '</td><td>' . $replacementProperty . '</td></tr>' . LF;
-                       }
-                       foreach ($this->doubleReplacementRteProperties as $deprecatedProperty => $replacementProperties) {
-                               $deprecatedProperties .= '<tr><td>' . $deprecatedProperty . '</td><td>' . implode(' and ', $replacementProperties) . '</td></tr>' . LF;
-                       }
-                       $description = '<p>The following Page TSconfig RTE properties are deprecated since TYPO3 4.6 and have been removed in TYPO3 6.0.</p>' . LF . '<table><thead><tr><th>Deprecated property</th><th>Use instead</th></tr></thead>' . LF . '<tbody>' . $deprecatedProperties . '</tboby></table>' . LF . '<p>You are currently using some of these properties on <strong>' . strval($pagesCount) . '&nbsp;pages</strong>  (including deleted and hidden pages).</p>' . LF;
-                       if ($pagesCount) {
-                               $pagesUids = array();
-                               foreach ($pages as $page) {
-                                       $pagesUids[] = $page['uid'];
-                               }
-                               $description .= '<p>Pages id\'s: ' . implode(', ', $pagesUids) . '</p>';
-                       }
-                       $replacementProperties = '';
-                       foreach ($this->useInsteadRteProperties as $deprecatedProperty => $replacementProperty) {
-                               $replacementProperties .= '<tr><td>' . $deprecatedProperty . '</td><td>' . $replacementProperty . '</td></tr>' . LF;
+
+               $pages = $this->getPagesWithDeprecatedRteProperties($dbQueries, $customMessages);
+               $pagesCount = count($pages);
+               $deprecatedProperties = '';
+               $deprecatedRteProperties = array_merge($this->replacementRteProperties, $this->useInsteadRteProperties);
+               foreach ($deprecatedRteProperties as $deprecatedProperty => $replacementProperty) {
+                       $deprecatedProperties .= '<tr><td>' . $deprecatedProperty . '</td><td>' . $replacementProperty . '</td></tr>' . LF;
+               }
+               foreach ($this->doubleReplacementRteProperties as $deprecatedProperty => $replacementProperties) {
+                       $deprecatedProperties .= '<tr><td>' . $deprecatedProperty . '</td><td>' . implode(' and ', $replacementProperties) . '</td></tr>' . LF;
+               }
+               $description = '<p>The following Page TSconfig RTE properties are deprecated since TYPO3 4.6 and have been removed in TYPO3 6.0.</p>' . LF . '<table><thead><tr><th>Deprecated property</th><th>Use instead</th></tr></thead>' . LF . '<tbody>' . $deprecatedProperties . '</tboby></table>' . LF . '<p>You are currently using some of these properties on <strong>' . strval($pagesCount) . '&nbsp;pages</strong>  (including deleted and hidden pages).</p>' . LF;
+               if ($pagesCount) {
+                       $pagesUids = array();
+                       foreach ($pages as $page) {
+                               $pagesUids[] = $page['uid'];
                        }
-                       if ($pagesCount) {
-                               $updateablePages = $this->findUpdateablePagesWithDeprecatedRteProperties($pages);
-                               if (count($updateablePages)) {
-                                       $replacementProperties = '';
-                                       foreach ($this->replacementRteProperties as $deprecatedProperty => $replacementProperty) {
-                                               $replacementProperties .= '<tr><td>' . $deprecatedProperty . '</td><td>' . $replacementProperty . '</td></tr>' . LF;
-                                       }
-                                       $description .= '<p>This wizard will perform automatic replacement of the following properties on <strong>' . strval(count($updateablePages)) . '&nbsp;pages</strong> (including deleted and hidden):</p>' . LF . '<table><thead><tr><th>Deprecated property</th><th>Will be replaced by</th></tr></thead><tbody>' . $replacementProperties . '</tboby></table>' . LF . '<p>The Page TSconfig column of the remaining pages will need to be updated manually.</p>' . LF;
-                               } else {
-                                       $replacementProperties = '';
-                                       foreach (array_keys(array_merge($this->useInsteadRteProperties, $this->doubleReplacementRteProperties)) as $deprecatedProperty) {
-                                               $replacementProperties .= '<tr><td>' . $deprecatedProperty . '</td></tr>' . LF;
-                                       }
-                                       $description .= '<p>This wizard cannot update the following properties, some of which are present on those pages:</p>' . LF . '<table><thead><tr><th>Deprecated property</th></tr></thead><tbody>' . $replacementProperties . '</tboby></table>' . LF . '<p>Therefore, the Page TSconfig column of those pages will need to be updated manually.</p>' . LF;
+                       $description .= '<p>Pages id\'s: ' . implode(', ', $pagesUids) . '</p>';
+               }
+               $replacementProperties = '';
+               foreach ($this->useInsteadRteProperties as $deprecatedProperty => $replacementProperty) {
+                       $replacementProperties .= '<tr><td>' . $deprecatedProperty . '</td><td>' . $replacementProperty . '</td></tr>' . LF;
+               }
+               if ($pagesCount) {
+                       $updateablePages = $this->findUpdateablePagesWithDeprecatedRteProperties($pages);
+                       if (count($updateablePages)) {
+                               $replacementProperties = '';
+                               foreach ($this->replacementRteProperties as $deprecatedProperty => $replacementProperty) {
+                                       $replacementProperties .= '<tr><td>' . $deprecatedProperty . '</td><td>' . $replacementProperty . '</td></tr>' . LF;
                                }
-                               $result = TRUE;
+                               $description .= '<p>This wizard will perform automatic replacement of the following properties on <strong>' . strval(count($updateablePages)) . '&nbsp;pages</strong> (including deleted and hidden):</p>' . LF . '<table><thead><tr><th>Deprecated property</th><th>Will be replaced by</th></tr></thead><tbody>' . $replacementProperties . '</tboby></table>' . LF . '<p>The Page TSconfig column of the remaining pages will need to be updated manually.</p>' . LF;
                        } else {
-                               // if we found no occurence of deprecated settings and wizard was already executed, then
-                               // we do not show up anymore
-                               if ($this->isWizardDone()) {
-                                       $result = FALSE;
+                               $replacementProperties = '';
+                               foreach (array_keys(array_merge($this->useInsteadRteProperties, $this->doubleReplacementRteProperties)) as $deprecatedProperty) {
+                                       $replacementProperties .= '<tr><td>' . $deprecatedProperty . '</td></tr>' . LF;
                                }
+                               $description .= '<p>This wizard cannot update the following properties, some of which are present on those pages:</p>' . LF . '<table><thead><tr><th>Deprecated property</th></tr></thead><tbody>' . $replacementProperties . '</tboby></table>' . LF . '<p>Therefore, the Page TSconfig column of those pages will need to be updated manually.</p>' . LF;
+                       }
+                       $result = TRUE;
+               } else {
+                       // if we found no occurrence of deprecated settings and wizard was already executed, then
+                       // we do not show up anymore
+                       if ($this->isWizardDone()) {
+                               $result = FALSE;
                        }
-                       $description .= '<p>Only page records are searched for deprecated properties. However, such properties can also be used in BE group and BE user records (prepended with page.). These are not searched nor updated by this wizard.</p>' . LF . '<p>Page TSconfig may also be included from external files. These are not updated by this wizard. If required, the update will need to be done manually.</p>' . LF . '<p>Note also that deprecated properties have been replaced in default configurations provided by htmlArea RTE';
                }
+               $description .= '<p>Only page records are searched for deprecated properties. However, such properties can also be used in BE group and BE user records (prepended with page.). These are not searched nor updated by this wizard.</p>' . LF . '<p>Page TSconfig may also be included from external files. These are not updated by this wizard. If required, the update will need to be done manually.</p>' . LF . '<p>Note also that deprecated properties have been replaced in default configurations provided by htmlArea RTE';
+
                return $result;
        }
 
        /**
         * Performs the update itself
         *
-        * @param array pointer where to insert all DB queries made, so they can be shown to the user if wanted
-        * @param string pointer to output custom messages
+        * @param array $dbQueries Pointer where to insert all DB queries made, so they can be shown to the user if wanted
+        * @param string $customMessages Pointer to output custom messages
         * @return bool TRUE if update succeeded, FALSE otherwise
         */
        public function performUpdate(array &$dbQueries, &$customMessages) {
@@ -173,8 +195,8 @@ class DeprecatedRteProperties extends \TYPO3\CMS\Install\Updates\AbstractUpdate
        /**
         * Gets the pages with deprecated RTE properties in TSConfig column
         *
-        * @param array pointer where to insert all DB queries made, so they can be shown to the user if wanted
-        * @param string pointer to output custom messages
+        * @param array $dbQueries Pointer where to insert all DB queries made, so they can be shown to the user if wanted
+        * @param string $customMessages Pointer to output custom messages
         * @return array uid and inclusion string for the pages with deprecated RTE properties in TSConfig column
         */
        protected function getPagesWithDeprecatedRteProperties(&$dbQueries, &$customMessages) {
@@ -185,13 +207,14 @@ class DeprecatedRteProperties extends \TYPO3\CMS\Install\Updates\AbstractUpdate
                foreach ($deprecatedRteProperties as $deprecatedRteProperty) {
                        $where .= ($where ? ' OR ' : '') . '(TSConfig LIKE BINARY "%RTE.%' . $deprecatedRteProperty . '%" AND TSConfig NOT LIKE BINARY "%RTE.%' . $deprecatedRteProperty . 's%") ';
                }
-               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where);
-               $dbQueries[] = str_replace(chr(10), ' ', $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery);
-               if ($GLOBALS['TYPO3_DB']->sql_error()) {
-                       $customMessages = 'SQL-ERROR: ' . htmlspecialchars($GLOBALS['TYPO3_DB']->sql_error());
+               $db = $this->getDatabaseConnection();
+               $res = $db->exec_SELECTquery($fields, $table, $where);
+               $dbQueries[] = str_replace(chr(10), ' ', $db->debug_lastBuiltQuery);
+               if ($db->sql_error()) {
+                       $customMessages = 'SQL-ERROR: ' . htmlspecialchars($db->sql_error());
                }
                $pages = array();
-               while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
+               while ($row = $db->sql_fetch_assoc($res)) {
                        $pages[] = $row;
                }
                return $pages;
@@ -200,7 +223,7 @@ class DeprecatedRteProperties extends \TYPO3\CMS\Install\Updates\AbstractUpdate
        /**
         * Gets the pages with updateable deprecated RTE properties in TSConfig column
         *
-        * @param array $pages: reference to pages with deprecated property
+        * @param array $pages reference to pages with deprecated property
         * @return array uid and inclusion string for the pages with deprecated RTE properties in TSConfig column
         */
        protected function findUpdateablePagesWithDeprecatedRteProperties(&$pages) {
@@ -220,23 +243,23 @@ class DeprecatedRteProperties extends \TYPO3\CMS\Install\Updates\AbstractUpdate
        /**
         * updates the pages records with updateable Page TSconfig properties
         *
-        * @param array pages records to update, fetched by getTemplates() and filtered by
-        * @param array pointer where to insert all DB queries made, so they can be shown to the user if wanted
-        * @param string pointer to output custom messages
+        * @param array $pages Page records to update, fetched by getTemplates() and filtered by
+        * @param array $dbQueries Pointer where to insert all DB queries made, so they can be shown to the user if wanted
+        * @param string $customMessages Pointer to output custom messages
         */
        protected function updatePages($pages, &$dbQueries, &$customMessages) {
+               $db = $this->getDatabaseConnection();
                foreach ($pages as $page) {
                        $table = 'pages';
                        $where = 'uid =' . $page['uid'];
                        $field_values = array(
                                'TSconfig' => $page['TSconfig']
                        );
-                       $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, $where, $field_values);
-                       $dbQueries[] = str_replace(chr(10), ' ', $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery);
-                       if ($GLOBALS['TYPO3_DB']->sql_error()) {
-                               $customMessages .= 'SQL-ERROR: ' . htmlspecialchars($GLOBALS['TYPO3_DB']->sql_error()) . LF . LF;
+                       $db->exec_UPDATEquery($table, $where, $field_values);
+                       $dbQueries[] = str_replace(chr(10), ' ', $db->debug_lastBuiltQuery);
+                       if ($db->sql_error()) {
+                               $customMessages .= 'SQL-ERROR: ' . htmlspecialchars($db->sql_error()) . LF . LF;
                        }
                }
        }
-
 }