[TASK] Cleanup update wizard in Install Tool 54/22754/4
authorWouter Wolters <typo3@wouterwolters.nl>
Thu, 1 Aug 2013 15:51:04 +0000 (17:51 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Mon, 5 Aug 2013 20:47:00 +0000 (22:47 +0200)
Cleanup the update wizard classes and move all
classes to one folder instead of the two that
are used now.

Change-Id: Id6a000fe75892d1596984954b2b2f8a78eaf0483
Resolves: #50670
Releases: 6.2
Reviewed-on: https://review.typo3.org/22754
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
42 files changed:
typo3/sysext/install/Classes/Controller/Action/Tool/UpdateWizard.php
typo3/sysext/install/Classes/CoreUpdates/AddFlexFormsToAclUpdate.php [deleted file]
typo3/sysext/install/Classes/CoreUpdates/CharsetDefaultsUpdate.php [deleted file]
typo3/sysext/install/Classes/CoreUpdates/CompatVersionUpdate.php [deleted file]
typo3/sysext/install/Classes/CoreUpdates/CompressionLevelUpdate.php [deleted file]
typo3/sysext/install/Classes/CoreUpdates/CscSplitUpdate.php [deleted file]
typo3/sysext/install/Classes/CoreUpdates/ExtensionManagerTables.php [deleted file]
typo3/sysext/install/Classes/CoreUpdates/FlagsFromSpriteUpdate.php [deleted file]
typo3/sysext/install/Classes/CoreUpdates/ImagecolsUpdate.php [deleted file]
typo3/sysext/install/Classes/CoreUpdates/ImagelinkUpdate.php [deleted file]
typo3/sysext/install/Classes/CoreUpdates/InstallSysExtsUpdate.php [deleted file]
typo3/sysext/install/Classes/CoreUpdates/MediaFlexformUpdate.php [deleted file]
typo3/sysext/install/Classes/CoreUpdates/MergeAdvancedUpdate.php [deleted file]
typo3/sysext/install/Classes/CoreUpdates/MigrateWorkspacesUpdate.php [deleted file]
typo3/sysext/install/Classes/CoreUpdates/NotInMenuUpdate.php [deleted file]
typo3/sysext/install/Classes/CoreUpdates/RootTemplateUpdate.php [deleted file]
typo3/sysext/install/Classes/CoreUpdates/T3skinUpdate.php [deleted file]
typo3/sysext/install/Classes/Updates/AbstractUpdate.php
typo3/sysext/install/Classes/Updates/AddFlexFormsToAclUpdate.php [new file with mode: 0644]
typo3/sysext/install/Classes/Updates/CharsetDefaultsUpdate.php [new file with mode: 0644]
typo3/sysext/install/Classes/Updates/CompatVersionUpdate.php [new file with mode: 0644]
typo3/sysext/install/Classes/Updates/CompressionLevelUpdate.php [new file with mode: 0644]
typo3/sysext/install/Classes/Updates/CscSplitUpdate.php [new file with mode: 0644]
typo3/sysext/install/Classes/Updates/ExtensionManagerTables.php [new file with mode: 0644]
typo3/sysext/install/Classes/Updates/FilemountUpdateWizard.php
typo3/sysext/install/Classes/Updates/FlagsFromSpriteUpdate.php [new file with mode: 0644]
typo3/sysext/install/Classes/Updates/ImagecolsUpdate.php [new file with mode: 0644]
typo3/sysext/install/Classes/Updates/ImagelinkUpdate.php [new file with mode: 0644]
typo3/sysext/install/Classes/Updates/InitUpdateWizard.php
typo3/sysext/install/Classes/Updates/InstallSysExtsUpdate.php [new file with mode: 0644]
typo3/sysext/install/Classes/Updates/MediaFlexformUpdate.php [new file with mode: 0644]
typo3/sysext/install/Classes/Updates/MergeAdvancedUpdate.php [new file with mode: 0644]
typo3/sysext/install/Classes/Updates/MigrateWorkspacesUpdate.php [new file with mode: 0644]
typo3/sysext/install/Classes/Updates/NotInMenuUpdate.php [new file with mode: 0644]
typo3/sysext/install/Classes/Updates/ReferenceIntegrityUpdateWizard.php
typo3/sysext/install/Classes/Updates/RootTemplateUpdate.php [new file with mode: 0644]
typo3/sysext/install/Classes/Updates/RteFileLinksUpdateWizard.php
typo3/sysext/install/Classes/Updates/RteMagicImagesUpdateWizard.php
typo3/sysext/install/Classes/Updates/T3skinUpdate.php [new file with mode: 0644]
typo3/sysext/install/Classes/Updates/TceformsUpdateWizard.php
typo3/sysext/install/Classes/Updates/TtContentUploadsUpdateWizard.php
typo3/sysext/install/ext_localconf.php

index e0b0aad..e2139b7 100644 (file)
@@ -207,7 +207,7 @@ class UpdateWizard extends Action\AbstractAction implements Action\ActionInterfa
        }
 
        /**
-        * Creates instance of an upgrade object, setting the pObj, versionNumber and pObj
+        * Creates instance of an upgrade object, setting the pObj, versionNumber and userInput
         *
         * @param string $className The class name
         * @param string $identifier The identifier of upgrade object - needed to fetch user input
diff --git a/typo3/sysext/install/Classes/CoreUpdates/AddFlexFormsToAclUpdate.php b/typo3/sysext/install/Classes/CoreUpdates/AddFlexFormsToAclUpdate.php
deleted file mode 100644 (file)
index e3db259..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\CoreUpdates;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010-2013 Kai Vogel (kai.vogel(at)speedprogs.de)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Contains the update for group access lists, adds all excludeable FlexForm fields. Used by the update wizard in the install tool.
- *
- * @author Kai Vogel <kai.vogel(at)speedprogs.de>
- */
-class AddFlexFormsToAclUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
-
-       protected $title = 'Add Excludable FlexForm Fields to Group Access Lists';
-
-       /**
-        * Checks if FlexForm fields are missing in group access lists.
-        *
-        * @param string &$description The description for the update
-        * @return boolean Whether an update is required (TRUE) or not (FALSE)
-        */
-       public function checkForUpdate(&$description) {
-               $description = '
-                       <br />TYPO3 4.5 introduced the possibility to exclude FlexForm fields like normal fields in group access control lists (ACL).
-                       All excludeable fields will be hidden for non-admins if you do not add them to the ACL of each user group manually or with
-                       this update wizard.
-               ';
-               // Check access lists
-               if (!$this->getGroupAddFields()) {
-                       return FALSE;
-               }
-               return TRUE;
-       }
-
-       /**
-        * Get user confirmation
-        *
-        * @param string $inputPrefix The input prefix, all names of form fields have to start with this
-        * @return string HTML output
-        */
-       public function getUserInput($inputPrefix) {
-               $description = '
-                       <br />You are about to update group access control lists to include excludable FlexForm fields. Each backend group will be checked
-                       and only those that already have entries in the access control lists will be updated.
-               ';
-               return $description;
-       }
-
-       /**
-        * Performs the action of the UpdateManager
-        *
-        * @param array &$dbQueries Queries done in this update
-        * @param mixed &$customMessages Custom messages
-        * @return boolean Whether update was successful or not
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               // Get additional FlexForm fields for group access lists
-               $addFields = $this->getGroupAddFields();
-               if (empty($addFields)) {
-                       $customMessages = 'No missing FlexForm fields found!';
-                       return FALSE;
-               }
-               return $this->updateGroupAccessLists($addFields, $dbQueries, $customMessages);
-       }
-
-       /**
-        * Get all FlexForm fields which must be added to group access lists
-        *
-        * @return array Additional FlexForm fields for ACL
-        */
-       protected function getGroupAddFields() {
-               $addFields = array();
-               $contentTable = !empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable']) ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'] : 'tt_content';
-               // Initialize TCA if not loaded yet
-               if (empty($GLOBALS['TCA'])) {
-                       $this->pObj->includeTCA();
-               }
-               // Get all access lists from groups which are allowed to select or modify the content-table
-               $search = $GLOBALS['TYPO3_DB']->escapeStrForLike($contentTable, 'be_groups');
-               $where = 'deleted = 0 AND non_exclude_fields IS NOT NULL AND non_exclude_fields != ""';
-               $where .= ' AND (tables_select LIKE "%' . $search . '%" OR tables_modify LIKE "%' . $search . '%")';
-               $accessLists = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid, non_exclude_fields', 'be_groups', $where);
-               if (empty($accessLists)) {
-                       return array();
-               }
-               // Get all excludeable FlexForm fields from content-table
-               $flexExcludeFields = array();
-               $flexFormArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRegisteredFlexForms($contentTable);
-               if (!empty($flexFormArray) && is_array($flexFormArray)) {
-                       foreach ($flexFormArray as $tableField => $flexForms) {
-                               // Get all sheets
-                               foreach ($flexForms as $flexFormIdentifier => $flexFormConfig) {
-                                       // Get all excludeable fields in sheet
-                                       foreach ($flexFormConfig['ds']['sheets'] as $sheetName => $sheet) {
-                                               if (empty($sheet['ROOT']['el']) || !is_array($sheet['ROOT']['el'])) {
-                                                       continue;
-                                               }
-                                               foreach ($sheet['ROOT']['el'] as $fieldName => $field) {
-                                                       if (empty($field['TCEforms']['exclude'])) {
-                                                               continue;
-                                                       }
-                                                       $flexExcludeFields[] = $contentTable . ':' . $tableField . ';' . $flexFormIdentifier . ';' . $sheetName . ';' . $fieldName;
-                                               }
-                                       }
-                               }
-                       }
-               }
-               if (empty($flexExcludeFields)) {
-                       return array();
-               }
-               // Get FlexForm fields from access lists
-               foreach ($accessLists as $accessList) {
-                       $nonExcludeFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $accessList['non_exclude_fields']);
-                       if (empty($nonExcludeFields)) {
-                               continue;
-                       }
-                       // Add FlexForm fields only if the field was not already selected by a user
-                       $nonExcludeFields = array_diff($flexExcludeFields, $nonExcludeFields);
-                       if (!empty($nonExcludeFields) && $nonExcludeFields == $flexExcludeFields) {
-                               $addFields[$accessList['uid']] = $nonExcludeFields;
-                       }
-               }
-               return $addFields;
-       }
-
-       /**
-        * Update Backend user groups, add FlexForm fields to access list
-        *
-        * @param array $addFields All missing FlexForm fields by groups
-        * @param array &$dbQueries Queries done in this update
-        * @param mixed &$customMessages Custom messages
-        * @return boolean Whether update was successful or not
-        */
-       protected function updateGroupAccessLists(array $addFields, array &$dbQueries, &$customMessages) {
-               foreach ($addFields as $groupUID => $flexExcludeFields) {
-                       // First get current fields
-                       $result = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('non_exclude_fields', 'be_groups', 'uid=' . (int) $groupUID);
-                       if (!isset($result['non_exclude_fields'])) {
-                               continue;
-                       }
-                       $nonExcludeFields = $result['non_exclude_fields'];
-                       // Now add new ones
-                       $flexExcludeFields = implode(',', $flexExcludeFields);
-                       $nonExcludeFields = trim($nonExcludeFields . ',' . $flexExcludeFields, ', ');
-                       // Finally override with new fields
-                       $GLOBALS['TYPO3_DB']->exec_UPDATEquery('be_groups', 'uid=' . (int) $groupUID, array('non_exclude_fields' => $nonExcludeFields));
-                       // 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;
-       }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/CoreUpdates/CharsetDefaultsUpdate.php b/typo3/sysext/install/Classes/CoreUpdates/CharsetDefaultsUpdate.php
deleted file mode 100644 (file)
index ef04ff2..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\CoreUpdates;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010-2013 Michael Stucki <michael@typo3.org>, Benjamin Mack <benni@typo3.org>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Displays warnings and information about the database character set
- */
-class CharsetDefaultsUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
-
-       protected $title = 'Database Character Set';
-
-       /**
-        * Checks if the configuration is relying on old default values or not.
-        * If needed, this updater will fix the configuration appropriately.
-        *
-        * @param       string          &$description: The description for the update
-        * @param       string          &$showUpdate: 0=dont show update; 1=show update and next button; 2=only show description
-        * @return      boolean         whether an update is needed (TRUE) or not (FALSE)
-        */
-       public function checkForUpdate(&$description, &$showUpdate = FALSE) {
-               if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['setDBinit'] === '-1') {
-                       $description = 'The configuration variables $TYPO3_CONF_VARS[\'SYS\'][\'setDBinit\']
-                               is relying on empty default values.<br />
-                               However, the default has changed in TYPO3 4.5.<br /><br />
-                               Please click "Next" to write the former default settings to your localconf.php,
-                               so that your setup will continue to work like before.';
-                       $showUpdate = 1;
-               }
-       }
-
-       /**
-        * Write the current configuration to localconf.php
-        * This is needed for any sites that were relying on the former default
-        * values which are going to change in TYPO3 4.5.
-        *
-        * @param       array           &$dbQueries: queries done in this update
-        * @param       mixed           &$customMessages: custom messages
-        * @return      boolean         whether the updated was made or not
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               // Update "setDBinit" setting
-               $result1 = FALSE;
-               if (\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->getLocalConfigurationValueByPath('SYS/setDBinit') === '-1') {
-                       $result1 = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValueByPath('SYS/setDBinit', '');
-               }
-               if ($result1) {
-                       $customMessages[] = 'The configuration was successfully updated.';
-                       return TRUE;
-               } else {
-                       return FALSE;
-               }
-       }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/CoreUpdates/CompatVersionUpdate.php b/typo3/sysext/install/Classes/CoreUpdates/CompatVersionUpdate.php
deleted file mode 100644 (file)
index a3517e9..0000000
+++ /dev/null
@@ -1,257 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\CoreUpdates;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 1999-2013 Sebastian Kurfürst <sebastian@garbage-group.de>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Contains the update class for the compatibility version. Used by the update wizard in the install tool.
- *
- * @author Sebastian Kurfürst <sebastian@garbage-group.de
- */
-class CompatVersionUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
-
-       protected $title = 'Version Compatibility';
-
-       /**
-        * Function which checks if update is needed. Called in the beginning of an update process.
-        *
-        * @param       string          pointer to description for the update
-        * @return      boolean         TRUE if update is needs to be performed, FALSE otherwise.
-        * @todo Define visibility
-        */
-       public function checkForUpdate(&$description) {
-               global $TYPO3_CONF_VARS;
-               if (!$this->compatVersionIsCurrent()) {
-                       $description = '
-                               <p>
-                                       Your current TYPO3 installation is configured to
-                                       <strong>behave like version
-                                       ' . htmlspecialchars($TYPO3_CONF_VARS['SYS']['compat_version']) . '
-                                       </strong> of TYPO3. If you just upgraded from this version,
-                                       you most likely want to <strong>use new features</strong> as
-                                       well.
-                               </p>
-                               <p>
-                                       In the next step, you will see the things that need to be
-                                       adjusted to make your installation compatible with the new
-                                       features.
-                               </p>
-                       ';
-                       return 1;
-               }
-               return 0;
-       }
-
-       /**
-        * 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 [ ... ]
-        * @return      string          HTML output
-        * @todo Define visibility
-        */
-       public function getUserInput($inputPrefix) {
-               global $TYPO3_CONF_VARS;
-               if ($this->compatVersionIsCurrent()) {
-                       $content = '
-                               <fieldset>
-                                       <ol>
-                                               <li>
-                                                       <strong>You updated from an older version of TYPO3</strong>:
-                                               </li>
-                                               <li>
-                                                       <label for="version">Select the version where you have upgraded from:</label>
-                                                       <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'
-                       );
-                       foreach ($versions as $singleVersion => $caption) {
-                               $content .= '
-                                                               <option value="' . $singleVersion . '">' . $caption . '</option>
-                               ';
-                       }
-                       $content .= '
-                                                       </select>
-                                               </li>
-                                       </ol>
-                               </fieldset>
-                       ';
-               } else {
-                       $content = '
-                               <p>
-                                       TYPO3 output is currently compatible to version ' . htmlspecialchars($TYPO3_CONF_VARS['SYS']['compat_version']) . '.
-                                       To use all the new features in the current TYPO3 version,
-                                       make sure you follow the guidelines below to upgrade without
-                                       problems.
-                               </p>
-                               <p>
-                                       <strong>
-                                               Follow the steps below carefully and confirm every step!
-                                       </strong>
-                                       <br />
-                                       You will see this list again after you performed the update.
-                               </p>
-                       ';
-                       $content .= $this->showChangesNeeded($inputPrefix);
-                       $content .= '
-                               <fieldset>
-                                       <ol>
-                                               <li class="labelAfter">
-                                                       <input type="checkbox" name="' . $inputPrefix . '[compatVersion][all]" id="compatVersionAll" value="1" />
-                                                       <label for="compatVersionAll">Check all (ignore selection above)</label>
-                                               </li>
-                                               <li>
-                                                       WARNING: this might break the output of your website.
-                                               </li>
-                                       </ol>
-                               </fieldset>
-                       ';
-               }
-               return $content;
-       }
-
-       /**
-        * Checks if user input is valid
-        *
-        * @param       string          pointer to output custom messages
-        * @return      boolean         TRUE if user input is correct, then the update is performed. When FALSE, return to getUserInput
-        * @todo Define visibility
-        */
-       public function checkUserInput(&$customMessages) {
-               global $TYPO3_CONF_VARS;
-               if ($this->compatVersionIsCurrent()) {
-                       return 1;
-               } else {
-                       if ($this->userInput['compatVersion']['all']) {
-                               return 1;
-                       } else {
-                               $performUpdate = 1;
-                               $oldVersion = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger($TYPO3_CONF_VARS['SYS']['compat_version']);
-                               $currentVersion = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_branch);
-                               foreach ($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 = 0;
-                                                       $customMessages = 'If you want to update the compatibility version, you need to confirm all checkboxes on the previous page.';
-                                                       break;
-                                               }
-                                       }
-                               }
-                               return $performUpdate;
-                       }
-               }
-       }
-
-       /**
-        * 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
-        * @return      boolean         TRUE if update succeeded, FALSE otherwise
-        * @todo Define visibility
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               $customMessages = '';
-               // if we just set it to an older version
-               if ($this->userInput['version']) {
-                       $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);
-               $customMessages .= '<br />The compatibility version has been set to ' . $version . '.';
-               return 1;
-       }
-
-       /**********************
-        *
-        * HELPER FUNCTIONS - just used in this update method
-        *
-        **********************/
-       /**
-        * checks if compatibility version is set to current version
-        *
-        * @return      boolean         TRUE if compat version is equal the current version
-        * @todo Define visibility
-        */
-       public function compatVersionIsCurrent() {
-               global $TYPO3_CONF_VARS;
-               if (TYPO3_branch != $TYPO3_CONF_VARS['SYS']['compat_version']) {
-                       return 0;
-               } else {
-                       return 1;
-               }
-       }
-
-       /**
-        * show changes needed
-        *
-        * @param       string          input prefix to prepend all form fields with.
-        * @return      string          HTML output
-        * @todo Define visibility
-        */
-       public function showChangesNeeded($inputPrefix = '') {
-               global $TYPO3_CONF_VARS;
-               $oldVersion = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger($TYPO3_CONF_VARS['SYS']['compat_version']);
-               $currentVersion = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_branch);
-               $tableContents = '';
-               if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['compat_version'])) {
-                       $updateWizardBoxes = '';
-                       foreach ($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']) : '';
-                                       $updateWizardBoxes .= '
-                                               <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 (strlen($updateWizardBoxes)) {
-                       return $updateWizardBoxes;
-               }
-               return '';
-       }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/CoreUpdates/CompressionLevelUpdate.php b/typo3/sysext/install/Classes/CoreUpdates/CompressionLevelUpdate.php
deleted file mode 100644 (file)
index 9558082..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\CoreUpdates;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010-2013  Steffen Ritter (info@rs-websystems.de)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Contains the update class checking against configured compressionlevel. Used by the update wizard in the install tool.
- *
- * @author     Steffen Ritter <info@rs-websystems.de>
- */
-class CompressionLevelUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
-
-       protected $title = 'Check Compression Level';
-
-       /**
-        * Checks if there there is an compression level configured which may break the BE.
-        *
-        * @param       string          &$description: The description for the update
-        * @return      boolean         whether an update is needed (TRUE) or not (FALSE)
-        */
-       public function checkForUpdate(&$description) {
-               $description = '<p><strong>TYPO3_CONF_VARS[BE][compressionLevel] is enabled.</strong><br />
-               In TYPO3 4.4, compressionLevel was expanded to include automatic gzip compression of JavaScript and CSS stylessheet files.
-               <strong>To prevent the TYPO3 backend from being unusable, you must include the relevant lines from _.htaccess.</strong></p>';
-               if (!$this->isWizardDone() && intval($GLOBALS['TYPO3_CONF_VARS']['BE']['compressionLevel']) > 0) {
-                       return TRUE;
-               }
-               return FALSE;
-       }
-
-       /**
-        * second step: get user info
-        *
-        * @param       string          input prefix, all names of form fields have to start with this. Append custom name in [ ... ]
-        * @return      string          HTML output
-        */
-       public function getUserInput($inputPrefix) {
-               $content = '<p><strong>This configuration cannot be fixed automatically and requires a manual update.</strong> Please include the following lines from _.htaccess on top of your .htacess file.
-                                       <br /><br />
-                                       <pre>
-&lt;FilesMatch "\\.js\\.gzip$"&gt;
- AddType "text/javascript" .gzip
-&lt;/FilesMatch&gt;
-&lt;FilesMatch "\\.css\\.gzip$"&gt;
-  AddType "text/css" .gzip
-&lt;/FilesMatch&gt;
-AddEncoding gzip .gzip
-                                       </pre></p>';
-               return $content;
-       }
-
-       /**
-        * performs the action of the UpdateManager
-        *
-        * @param       array           &$dbQueries: queries done in this update
-        * @param       mixed           &$customMessages: custom messages
-        * @return      bool            whether everything went smoothly or not
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               $customMessages = 'Cannot automatically fix this problem! Please check manually.';
-               $this->markWizardAsDone();
-               return FALSE;
-       }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/CoreUpdates/CscSplitUpdate.php b/typo3/sysext/install/Classes/CoreUpdates/CscSplitUpdate.php
deleted file mode 100644 (file)
index 0fcf29c..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\CoreUpdates;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 1999-2013 Susanne Moog <typo3@susanne-moog.de>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Contains the update class for the split of css styled content templates. Used by the update wizard in the install tool.
- *
- * @author Susanne Moog <typo3@susanne-moog.de>
- */
-class CscSplitUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
-
-       protected $title = 'Split TypoScript Templates from CSS Styled Content';
-
-       /**
-        * Function which checks if update is needed. Called in the beginning of an update process.
-        *
-        * @param       string          pointer to description for the update
-        * @return      boolean         TRUE if update is needs to be performed, FALSE otherwise.
-        * @todo Define visibility
-        */
-       public function checkForUpdate(&$description) {
-               $templates = $this->getTemplatesWithCsc($dbQueries, $customMessages);
-               $templates = $this->findUpdateableTemplatesWithCsc($templates);
-               if (count($templates)) {
-                       $description = '<p>Run this wizard if you use CSS styled content in your templates, as the inclusion of the static templates changed. </p>' . '<p>You are currently using CSS styled content in <strong>' . count($templates) . '&nbsp;templates</strong>  (including deleted and hidden),' . ' so if you did not run this wizard before, <strong>do it now</strong>.</p>' . '<p>The wizard will automatically choose the right template according to your compatibility version. So if you want to ' . 'change the rendering back to an older version, you will have to use the changeCompatibilityVersion wizard above ' . 'first, and then return back to this one.</p>';
-                       return TRUE;
-               }
-               return FALSE;
-       }
-
-       /**
-        * 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
-        * @return      boolean         TRUE if update succeeded, FALSE otherwise
-        * @todo Define visibility
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               $templates = $this->getTemplatesWithCsc($dbQueries, $customMessages);
-               $templates = $this->findUpdateableTemplatesWithCsc($templates);
-               $this->updateCscTemplates($templates, $dbQueries, $customMessages);
-               if ($customMessages) {
-                       return FALSE;
-               } else {
-                       return TRUE;
-               }
-       }
-
-       /**
-        * Gets the templates that include the static css styled content template
-        *
-        * @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
-        * @return      array           uid and inclusion string for the templates, that include csc
-        * @todo Define visibility
-        */
-       public function getTemplatesWithCsc(&$dbQueries, &$customMessages) {
-               $fields = 'uid, include_static_file';
-               $table = 'sys_template';
-               $where = 'include_static_file LIKE "%EXT:css_styled_content/static/%"';
-               $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());
-               }
-               $templates = array();
-               while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
-                       $templates[] = $row;
-               }
-               return $templates;
-       }
-
-       /**
-        * Take a list of templates and filter them if they need an update or not
-        *
-        * @param       array           uid and inclusion string for the templates, that include csc
-        * @return      array           uid and inclusion string for the templates, that include csc and need an update
-        * @todo Define visibility
-        */
-       public function findUpdateableTemplatesWithCsc($allTemplates) {
-               $compatVersion = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger($GLOBALS['TYPO3_CONF_VARS']['SYS']['compat_version']);
-               $currentVersion = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_branch);
-               $templatesCount = count($allTemplates);
-               $updateableTemplates = array();
-               for ($i = 0; $i < $templatesCount; $i++) {
-                       $templateNeedsUpdate = FALSE;
-                       $includedTemplates = explode(',', $allTemplates[$i]['include_static_file']);
-                       $includedTemplatesCount = count($includedTemplates);
-                       // loop through every entry in the "include static file"
-                       for ($j = 0; $j < $includedTemplatesCount; $j++) {
-                               if (strpos($includedTemplates[$j], 'css_styled_content') !== FALSE) {
-                                       if ($compatVersion <= \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger('3.8')) {
-                                               if ($includedTemplates[$j] != 'EXT:css_styled_content/static/v3.8/') {
-                                                       $includedTemplates[$j] = 'EXT:css_styled_content/static/v3.8/';
-                                                       $templateNeedsUpdate = TRUE;
-                                               }
-                                       } elseif ($compatVersion <= \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger('4.1')) {
-                                               if ($includedTemplates[$j] != 'EXT:css_styled_content/static/v3.9/') {
-                                                       $includedTemplates[$j] = 'EXT:css_styled_content/static/v3.9/';
-                                                       $templateNeedsUpdate = TRUE;
-                                               }
-                                       } elseif ($compatVersion <= \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger('4.2')) {
-                                               if ($includedTemplates[$j] != 'EXT:css_styled_content/static/v4.2/') {
-                                                       $includedTemplates[$j] = 'EXT:css_styled_content/static/v4.2/';
-                                                       $templateNeedsUpdate = TRUE;
-                                               }
-                                       } elseif ($compatVersion <= \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger('4.3')) {
-                                               if ($includedTemplates[$j] != 'EXT:css_styled_content/static/v4.3/') {
-                                                       $includedTemplates[$j] = 'EXT:css_styled_content/static/v4.3/';
-                                                       $templateNeedsUpdate = TRUE;
-                                               }
-                                       } elseif ($compatVersion <= \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger('4.4')) {
-                                               if ($includedTemplates[$j] != 'EXT:css_styled_content/static/v4.4/') {
-                                                       $includedTemplates[$j] = 'EXT:css_styled_content/static/v4.4/';
-                                                       $templateNeedsUpdate = TRUE;
-                                               }
-                                       } elseif ($compatVersion <= \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger('4.5')) {
-                                               if ($includedTemplates[$j] != 'EXT:css_styled_content/static/v4.5/') {
-                                                       $includedTemplates[$j] = 'EXT:css_styled_content/static/v4.5/';
-                                                       $templateNeedsUpdate = TRUE;
-                                               }
-                                       } elseif ($compatVersion === $currentVersion || $compatVersion > '4.6') {
-                                               if ($includedTemplates[$j] != 'EXT:css_styled_content/static/') {
-                                                       $includedTemplates[$j] = 'EXT:css_styled_content/static/';
-                                                       $templateNeedsUpdate = TRUE;
-                                               }
-                                       }
-                               }
-                       }
-                       $allTemplates[$i]['include_static_file'] = implode(',', $includedTemplates);
-                       if ($templateNeedsUpdate) {
-                               $updateableTemplates[] = $allTemplates[$i];
-                       }
-               }
-               return $updateableTemplates;
-       }
-
-       /**
-        * updates the template records to include the new css styled content templates, according to the current compat version
-        *
-        * @param       array           template 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
-        * @todo Define visibility
-        */
-       public function updateCscTemplates($templates, &$dbQueries, &$customMessages) {
-               foreach ($templates as $template) {
-                       $table = 'sys_template';
-                       $where = 'uid =' . $template['uid'];
-                       $field_values = array(
-                               'include_static_file' => $template['include_static_file']
-                       );
-                       $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());
-                       }
-               }
-       }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/CoreUpdates/ExtensionManagerTables.php b/typo3/sysext/install/Classes/CoreUpdates/ExtensionManagerTables.php
deleted file mode 100644 (file)
index 0965b94..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\CoreUpdates;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2012-2013 Georg Ringer <typo3@ringerge.org>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Contains the update class for filling the basic repository record of the extension manager
- *
- * @author Georg Ringer <typo3@ringerge.org>
- */
-class ExtensionManagerTables extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
-
-       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 boolean 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 boolean
-        */
-       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 boolean 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;
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/CoreUpdates/FlagsFromSpriteUpdate.php b/typo3/sysext/install/Classes/CoreUpdates/FlagsFromSpriteUpdate.php
deleted file mode 100644 (file)
index 4816bdf..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\CoreUpdates;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010-2013 Ernesto Baschny <ernst@cron-it.de>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Contains the update class for transitioning from ".gif" flags to sprites
- *
- * @author Ernesto Baschny <ernst@cron-it.de>
- */
-class FlagsFromSpriteUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
-
-       protected $title = 'Update Graphics, Using Sprites for sys_language Records';
-
-       /**
-        * Checks if an update is needed
-        *
-        * @param       string          &$description: The description for the update
-        * @return      boolean         whether an update is needed (TRUE) or not (FALSE)
-        */
-       public function checkForUpdate(&$description) {
-               $result = FALSE;
-               $description = 'Removes the ".gif" suffix from entries in sys_language, because flags now come from a sprite provided by t3skin and not individual .gif files.';
-               if ($this->versionNumber >= 4005000) {
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'sys_language', 'flag LIKE \'%.gif\'', '', '', '1');
-                       if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
-                               $result = TRUE;
-                       }
-                       $GLOBALS['TYPO3_DB']->sql_free_result($res);
-               }
-               return $result;
-       }
-
-       /**
-        * Performs the database update. Changes the flags from ".gif" to flag without suffix
-        *
-        * @param       array           &$dbQueries: queries done in this update
-        * @param       mixed           &$customMessages: custom messages
-        * @return      boolean         whether it worked (TRUE) or not (FALSE)
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               $result = FALSE;
-               if ($this->versionNumber >= 4005000) {
-                       $sql = 'UPDATE sys_language SET flag=REPLACE(flag, \'.gif\', \'\') WHERE flag LIKE \'%.gif\'';
-                       $res = $GLOBALS['TYPO3_DB']->sql_query($sql);
-                       $dbQueries[] = $sql;
-                       if ($GLOBALS['TYPO3_DB']->sql_error()) {
-                               $customMessages = 'SQL-ERROR: ' . htmlspecialchars($GLOBALS['TYPO3_DB']->sql_error());
-                       } else {
-                               $result = TRUE;
-                       }
-                       $sql = 'UPDATE sys_language SET flag=\'multiple\' WHERE flag=\'multi-language\'';
-                       $res = $GLOBALS['TYPO3_DB']->sql_query($sql);
-                       $dbQueries[] = $sql;
-                       if ($GLOBALS['TYPO3_DB']->sql_error()) {
-                               $customMessages = 'SQL-ERROR: ' . htmlspecialchars($GLOBALS['TYPO3_DB']->sql_error());
-                       } else {
-                               $result = TRUE;
-                       }
-               }
-               return $result;
-       }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/CoreUpdates/ImagecolsUpdate.php b/typo3/sysext/install/Classes/CoreUpdates/ImagecolsUpdate.php
deleted file mode 100644 (file)
index afbc750..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\CoreUpdates;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2008-2013 Steffen Kamper <info@sk-typo3.de>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Contains the update class for merging advanced and normal pagetype.
- *
- * @author Steffen Kamper <info@sk-typo3.de>
- * @version
- */
-class ImagecolsUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
-
-       protected $title = 'Update Existing Text with Image Content Elements';
-
-       /**
-        * Checks if an update is needed
-        *
-        * @param       string          &$description: The description for the update
-        * @return      boolean         whether an update is needed (TRUE) or not (FALSE)
-        */
-       public function checkForUpdate(&$description) {
-               $result = FALSE;
-               $description = 'Sets tt_content.imagecols = 1 to all entries having "0". This is needed to have a valid value for imagecols.';
-               if ($this->versionNumber >= 4003000) {
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'tt_content', 'CTYPE IN (\'textpic\', \'image\') AND imagecols=0', '', '', '1');
-                       if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
-                               $result = TRUE;
-                       }
-                       $GLOBALS['TYPO3_DB']->sql_free_result($res);
-               }
-               return $result;
-       }
-
-       /**
-        * Performs the database update. Changes the doktype from 2 (advanced) to 1 (standard)
-        *
-        * @param       array           &$dbQueries: queries done in this update
-        * @param       mixed           &$customMessages: custom messages
-        * @return      boolean         whether it worked (TRUE) or not (FALSE)
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               $result = FALSE;
-               if ($this->versionNumber >= 4003000) {
-                       $updateArray = array(
-                               'imagecols' => 1
-                       );
-                       $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tt_content', 'CTYPE IN (\'textpic\', \'image\') AND imagecols=0', $updateArray);
-                       $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());
-                       } else {
-                               $result = TRUE;
-                       }
-               }
-               return $result;
-       }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/CoreUpdates/ImagelinkUpdate.php b/typo3/sysext/install/Classes/CoreUpdates/ImagelinkUpdate.php
deleted file mode 100644 (file)
index f788dc7..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\CoreUpdates;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2011-2013 Christian Kuhn <lolli@schwarzbu.ch>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Contains the update class to split existing image_link field by comma and
- * switch to newlines.
- *
- * @author Christian Kuhn <lolli@schwarzbu.ch>
- */
-class ImagelinkUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
-
-       protected $title = 'Update Existing image links';
-
-       /**
-        * Checks if an update is needed
-        *
-        * @param       string          &$description: The description for the update
-        * @return      boolean         TRUE if an update is needed, FALSE otherwise
-        */
-       public function checkForUpdate(&$description) {
-               $description = 'Since TYPO3 4.5 links to images of "Image" and "Text with image" content elements are separated by newline and not by comma anymore. This update converts existing comma separated links to the new form.';
-               $result = FALSE;
-               if ($this->versionNumber >= 4005000) {
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'tt_content', 'image_link<>\'\' AND image_link LIKE \'%,%\' AND image_link NOT LIKE \'%\\n%\'', '', '', '1');
-                       if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
-                               $result = TRUE;
-                       }
-                       $GLOBALS['TYPO3_DB']->sql_free_result($res);
-               }
-               return $result;
-       }
-
-       /**
-        * Performs the database update.
-        *
-        * @param       array           &$dbQueries: queries done in this update
-        * @param       mixed           &$customMessages: custom messages
-        * @return      boolean         TRUE on success, FALSE on error
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               $result = TRUE;
-               if ($this->versionNumber >= 4005000) {
-                       $affectedRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid, image_link', 'tt_content', 'image_link<>\'\' AND image_link LIKE \'%,%\' AND image_link NOT LIKE \'%\\n%\'');
-                       foreach ($affectedRows as $row) {
-                               $newImageLink = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $row['image_link']);
-                               $newImageLink = implode(LF, $newImageLink);
-                               $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tt_content', 'uid=' . $row['uid'], array('image_link' => $newImageLink));
-                               $dbQueries[] = str_replace(LF, ' ', $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery);
-                               if ($GLOBALS['TYPO3_DB']->sql_error()) {
-                                       $customMessages = 'SQL-ERROR: ' . htmlspecialchars($GLOBALS['TYPO3_DB']->sql_error());
-                                       $result = $result & FALSE;
-                               }
-                       }
-               }
-               return $result;
-       }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/CoreUpdates/InstallSysExtsUpdate.php b/typo3/sysext/install/Classes/CoreUpdates/InstallSysExtsUpdate.php
deleted file mode 100644 (file)
index bee09a6..0000000
+++ /dev/null
@@ -1,347 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\CoreUpdates;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2008-2013 Benjamin Mack <benni@typo3.org>
- *  (c) 2008-2013 Steffen Kamper <info@sk-typo3.de>
- *  (c) 2012-2013 Kai Vogel <kai.vogel@speedprogs.de>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Contains the update class for adding new system extensions.
- *
- * @author Benjamin Mack <benni@typo3.org>
- * @author Steffen Kamper <info@sk-typo3.de>
- * @author  Kai Vogel <kai.vogel@speedprogs.de>
- */
-class InstallSysExtsUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
-
-       /**
-        * @var string
-        */
-       protected $title = 'Install System Extensions';
-
-       /**
-        * @var array
-        */
-       protected $systemExtensions = array(
-               'info',
-               'perm',
-               'func',
-               'filelist',
-               'about',
-               'cshmanual',
-               'feedit',
-               'opendocs',
-               'recycler',
-               't3editor',
-               'reports',
-               'scheduler',
-               'simulatestatic',
-       );
-
-       /**
-        * @var array
-        */
-       protected $extensionDetails = array(
-               'simulatestatic' => array(
-                       'title' => 'Simulate Static URLs',
-                       'description' => 'Adds the possibility to have Speaking URLs in the TYPO3 Frontend pages.',
-                       'versionString' => '2.0.0',
-               ),
-       );
-
-       /**
-        * @var string
-        */
-       protected $extEmConfPath = 'typo3/sysext/@extensionKey/ext_emconf.php';
-
-       /**
-        * @var string
-        */
-       protected $repositoryUrl = 'http://typo3.org/fileadmin/ter/@filename';
-
-       /**
-        * @var string
-        */
-       protected $informationUrl = 'http://typo3.org/index.php?type=95832&tx_terfe2_pi1%5Baction%5D=show&tx_terfe2_pi1%5Bformat%5D=json&tx_terfe2_pi1%5BextensionKey%5D=@extensionKey';
-
-       /**
-        * @var bool
-        */
-       protected $updateSuccessful = TRUE;
-
-       /**
-        * Checks if an update is needed
-        *
-        * @param string &$description: The description for the update
-        * @return boolean whether an update is needed (TRUE) or not (FALSE)
-        */
-       public function checkForUpdate(&$description) {
-               $description = '
-                       <br />
-                       Uninstalled system extensions have been found.
-                       It is now possible to install them automatically by this upgrade wizard.
-               ';
-
-               if ($this->isWizardDone()) {
-                       return FALSE;
-               }
-
-               foreach ($this->systemExtensions as $extensionKey) {
-                       if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extensionKey)) {
-                               return TRUE;
-                       }
-               }
-
-               return FALSE;
-       }
-
-       /**
-        * Second step: Get user input for installing system extensions
-        *
-        * @param string $inputPrefix input prefix, all names of form fields have to start with this. Append custom name in [ ... ]
-        * @return string HTML output
-        */
-       public function getUserInput($inputPrefix) {
-               $list = '
-                       <p>
-                               Install the following system extensions:
-                       </p>
-                       <fieldset>
-                               <ol class="t3-install-form-label-after">%s</ol>
-                       </fieldset>';
-               $item = '
-                       <li class="labelAfter">
-                               <input type="checkbox" id="%1$s" name="%2$s[sysext][%1$s]" value="1" checked="checked" />
-                               <label for="%1$s"><strong>%3$s [%1$s]</strong><br />%4$s</label>
-                       </li>';
-               $items = array();
-
-               foreach ($this->systemExtensions as $extensionKey) {
-                       if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extensionKey)) {
-                               continue;
-                       }
-                       $extension = $this->getExtensionDetails($extensionKey);
-                       $items[] = sprintf(
-                               $item,
-                               $extensionKey,
-                               $inputPrefix,
-                               htmlspecialchars($extension['title']),
-                               htmlspecialchars($extension['description'])
-                       );
-               }
-
-               return sprintf($list, implode('', $items));
-       }
-
-       /**
-        * Adds the outsourced extensions to the extList in TYPO3_CONF_VARS
-        *
-        * @param array &$dbQueries: queries done in this update
-        * @param mixed &$customMessages: custom messages
-        * @return boolean whether it worked (TRUE) or not (FALSE)
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-                       // Get extension keys that were submitted by the user to be installed and that are valid for this update wizard
-               if (is_array($this->userInput['sysext'])) {
-                       $extArray = array_intersect(
-                               $this->systemExtensions,
-                               array_keys($this->userInput['sysext'])
-                       );
-                       $this->installExtensions($extArray, $customMessages);
-               }
-
-                       // Show this wizard again only if new extension keys have been found
-               $this->markWizardAsDone();
-
-               return $this->updateSuccessful;
-       }
-
-       /**
-        * This method can be called to install extensions following all proper processes
-        * (e.g. installing in extList, respecting priority, etc.)
-        *
-        * @param array $extensionKeys List of keys of extensions to install
-        * @param mixed $customMessages
-        * @return void
-        */
-       protected function installExtensions($extensionKeys, &$customMessages) {
-               /** @var $extensionListUtility \TYPO3\CMS\Extensionmanager\Utility\ListUtility */
-               $extensionListUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
-                       'TYPO3\\CMS\\Extensionmanager\\Utility\\ListUtility'
-               );
-
-               /** @var $extensionFileHandlingUtility \TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility */
-               $extensionFileHandlingUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
-                       'TYPO3\\CMS\\Extensionmanager\\Utility\\FileHandlingUtility'
-               );
-               /** @var $objectManager \TYPO3\CMS\Extbase\Object\ObjectManager */
-               $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
-
-               /** @var $extensionInstallUtility \TYPO3\CMS\Extensionmanager\Utility\InstallUtility */
-               $extensionInstallUtility = $objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility');
-
-               /** @var $extensionTerUtility \TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtility */
-               $extensionTerUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
-                       'TYPO3\\CMS\\Extensionmanager\\Utility\\Connection\\TerUtility'
-               );
-               $availableExtensions = $extensionListUtility->getAvailableExtensions();
-               $availableAndInstalledExtensions = $extensionListUtility->getAvailableAndInstalledExtensions($availableExtensions);
-               foreach ($extensionKeys as $extensionKey) {
-                       if (!is_array($availableAndInstalledExtensions[$extensionKey])) {
-                               $extensionDetails = $this->getExtensionDetails($extensionKey);
-                               if (empty($extensionDetails)) {
-                                       $this->updateSuccessful = FALSE;
-                                       $customMessages .= 'No version information for extension ' . $extensionKey . '. Cannot install it.';
-                                       continue;
-                               }
-                               $t3xContent = $this->fetchExtension($extensionKey, $extensionDetails['versionString']);
-                               if (empty($t3xContent)) {
-                                       $this->updateSuccessful = FALSE;
-                                       $customMessages .= 'The extension ' . $extensionKey . ' could not be downloaded.';
-                                       continue;
-                               }
-                               $t3xExtracted = $extensionTerUtility->decodeExchangeData($t3xContent);
-                               if (empty($t3xExtracted) || !is_array($t3xExtracted) || empty($t3xExtracted['extKey'])) {
-                                       $this->updateSuccessful = FALSE;
-                                       $customMessages .= 'The extension ' . $extensionKey . ' could not be extracted.';
-                                       continue;
-                               }
-                               $extensionFileHandlingUtility->unpackExtensionFromExtensionDataArray($t3xExtracted);
-                       }
-                       $extensionInstallUtility->install($extensionKey);
-               }
-       }
-
-       /**
-        * Returns the details of a local or external extension
-        *
-        * @param string $extensionKey Key of the extension to check
-        * @return array Extension details
-        */
-       protected function getExtensionDetails($extensionKey) {
-                       // Local extension
-               $extEmConf = PATH_site . str_replace('@extensionKey', $extensionKey, $this->extEmConfPath);
-               if (file_exists($extEmConf)) {
-                       $EM_CONF = FALSE;
-                       require_once($extEmConf);
-                       return reset($EM_CONF);
-               }
-
-               if (array_key_exists($extensionKey, $this->extensionDetails)) {
-                       return $this->extensionDetails[$extensionKey];
-               }
-
-               return array();
-       }
-
-       /**
-        * Fetch extension from repository
-        *
-        * @param string $extensionKey The extension key to fetch
-        * @param string $version The version to fetch
-        * @return string T3X file content
-        */
-       protected function fetchExtension($extensionKey, $version) {
-               if (empty($extensionKey) || empty($version)) {
-                       return '';
-               }
-
-               $filename = $extensionKey[0] . '/' . $extensionKey[1] . '/' . $extensionKey . '_' . $version . '.t3x';
-               $url = str_replace('@filename', $filename, $this->repositoryUrl);
-               return $this->fetchUrl($url);
-       }
-
-       /**
-        * Open an URL and return the response
-        *
-        * This wrapper method is required to try several download methods if
-        * the configuration is not valid or initially written by the installer.
-        *
-        * @param string $url The URL to file
-        * @throws \Exception
-        * @return string File content
-        */
-       protected function fetchUrl($url) {
-               if (empty($url)) {
-                       return NULL;
-               }
-
-               $fileContent = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($url, 0, array(TYPO3_user_agent));
-
-                       // No content, force cURL if disabled in configuration but found in system
-               if ($fileContent === FALSE && function_exists('curl_init') && empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlUse'])) {
-                       $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlUse'] = TRUE;
-                       $fileContent = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($url, 0, array(TYPO3_user_agent));
-                       $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlUse'] = FALSE;
-               }
-
-                       // Still no content, try file_get_contents if allow_url_fopen is enabled
-               if ($fileContent === FALSE && function_exists('file_get_contents') && ini_get('allow_url_fopen')) {
-                       $fileContent = file_get_contents($url);
-               }
-
-                       // Can not fetch url, throw an exception
-               if ($fileContent === FALSE) {
-                       throw new \Exception(
-                               'Can not fetch URL "' . $url . '". Possibile reasons are network problems or misconfiguration.',
-                               1344685036
-                       );
-               }
-
-               return $fileContent;
-       }
-
-       /**
-        * Marks the wizard as being "seen" so that it not shown again until
-        * no new extension keys have been found.
-        *
-        * Writes the info in LocalConfiguration.php
-        *
-        * @return void
-        */
-       protected function markWizardAsDone() {
-               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValueByPath(
-                       'INSTALL/wizardDone/' . get_class($this),
-                       json_encode($this->systemExtensions)
-               );
-       }
-
-       /**
-        * Checks if all extensions have been "seen" before
-        *
-        * @return boolean TRUE if wizard has been done before, FALSE otherwise
-        */
-       protected function isWizardDone() {
-               $wizardClassName = get_class($this);
-               if (!empty($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone'][$wizardClassName])) {
-                       $seenExtensions = json_decode($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone'][$wizardClassName], TRUE);
-                       return count(array_diff($this->systemExtensions, $seenExtensions)) === 0;
-               }
-               return FALSE;
-       }
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/CoreUpdates/MediaFlexformUpdate.php b/typo3/sysext/install/Classes/CoreUpdates/MediaFlexformUpdate.php
deleted file mode 100644 (file)
index dd77292..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\CoreUpdates;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2012-2013 Steffen Ritter <steffen.ritter@typo3.org>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Migrates the old media FlexForm to the new
- */
-class MediaFlexformUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
-
-       protected $title = 'FlexForm Data from Media Element';
-
-       /**
-        * Checks whether updates need to be performed
-        *
-        * @param string &$description The description for the update
-        * @param integer &$showUpdate 0=dont show update; 1=show update and next button; 2=only show description
-        * @return boolean
-        */
-       public function checkForUpdate(&$description, &$showUpdate = 0) {
-               $mediaElements = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'], '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;
-       }
-
-       /**
-        * @param       array           &$dbQueries: queries done in this update
-        * @param       mixed           &$customMessages: custom messages
-        * @return      boolean         whether the updated was made or not
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,pi_flexform', $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'], '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' => intval($width));
-                       }
-                       $height = $sDEF['mmHeight']['vDEF'];
-                       if ($height) {
-                               $data['data']['sGeneral']['lDEF']['mmHeight'] = array('vDEF' => intval($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($GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'], 'uid = ' . $row['uid'], array('pi_flexform' => $newXML));
-               }
-               return TRUE;
-       }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/CoreUpdates/MergeAdvancedUpdate.php b/typo3/sysext/install/Classes/CoreUpdates/MergeAdvancedUpdate.php
deleted file mode 100644 (file)
index 603bf75..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\CoreUpdates;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2008-2013 Steffen Kamper <info@sk-typo3.de>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Contains the update class for merging advanced and normal pagetype.
- *
- * @author Steffen Kamper <info@sk-typo3.de>
- */
-class MergeAdvancedUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
-
-       protected $title = 'Update Pages with Pagetype "Advanced"';
-
-       /**
-        * Checks if an update is needed
-        *
-        * @param       string          &$description: The description for the update
-        * @return      boolean         whether an update is needed (TRUE) or not (FALSE)
-        */
-       public function checkForUpdate(&$description) {
-               $result = FALSE;
-               $description = 'Merges the "Advanced" pagetype (doktype 2) to "Standard" (doktype 1) because "Standard" now has the same features, and "Advanced" is not needed anymore.';
-               if ($this->versionNumber >= 4002000) {
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'doktype=2', '', '', '1');
-                       if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
-                               $result = TRUE;
-                       }
-                       $GLOBALS['TYPO3_DB']->sql_free_result($res);
-               }
-               return $result;
-       }
-
-       /**
-        * Performs the database update. Changes the doktype from 2 (advanced) to 1 (standard)
-        *
-        * @param       array           &$dbQueries: queries done in this update
-        * @param       mixed           &$customMessages: custom messages
-        * @return      boolean         whether it worked (TRUE) or not (FALSE)
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               $result = FALSE;
-               if ($this->versionNumber >= 4002000) {
-                       $updateArray = array(
-                               'doktype' => 1
-                       );
-                       $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery('pages', 'doktype=2', $updateArray);
-                       $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());
-                       } else {
-                               $result = TRUE;
-                       }
-               }
-               return $result;
-       }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/CoreUpdates/MigrateWorkspacesUpdate.php b/typo3/sysext/install/Classes/CoreUpdates/MigrateWorkspacesUpdate.php
deleted file mode 100644 (file)
index f6826fa..0000000
+++ /dev/null
@@ -1,374 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\CoreUpdates;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010-2013 Tolleiv Nietsch <info@tolleiv.de>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Migrates workspaces from TYPO3 versions below 4.5.
- *
- * @author Tolleiv Nietsch <info@tolleiv.de>
- */
-class MigrateWorkspacesUpdate extends \TYPO3\CMS\Install\CoreUpdates\InstallSysExtsUpdate {
-
-       protected $title = 'Versioning and Workspaces';
-
-       public $sqlQueries;
-
-       /**
-        * Checks if an update is needed
-        *
-        * @param       string          &$description: The description for the update, which will be updated with a description of the script's purpose
-        * @return      boolean         whether an update is needed (TRUE) or not (FALSE)
-        */
-       public function checkForUpdate(&$description) {
-               $result = FALSE;
-               $description = 'Migrates the old hardcoded draft workspace to be a real workspace record,
-               updates workspace owner fields to support either users or groups and
-               migrates the old-style workspaces with fixed workflow to a custom-stage workflow. If required
-               the extbase, fluid, version and workspaces extensions are installed.';
-               $reason = '';
-               // TYPO3 version 4.5 and above
-               if ($this->versionNumber >= 4005000) {
-                       // If neither version nor workspaces is installed, we're not doing a migration
-                       // Present the user with the choice of activating versioning and workspaces
-                       if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('version') && !\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('workspaces')) {
-                               $result = TRUE;
-                               // Override the default description
-                               $description = 'Activates the usage of workspaces in your installation. Workspaces let you edit elements
-                                       without the changes being visible on the live web site right away. Modified elements can then go
-                                       through a validation process and eventually be published.<br /><br />';
-                               $description .= 'This wizard will install system extensions "version" and "workspaces" (and may
-                                       install "fluid" and "extbase" too, as they are used by the "workspaces" extension).';
-                       } else {
-                               \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadExtensionTables(FALSE);
-                               if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('version') || !\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('workspaces')) {
-                                       $result = TRUE;
-                                       $reason .= ' Both extensions "version" and "workspaces" need to be
-                                               present to use the entire versioning and workflow featureset of TYPO3.';
-                               }
-                               $tables = array_keys($GLOBALS['TYPO3_DB']->admin_get_tables());
-                               // sys_workspace table might not exists if version extension was never installed
-                               if (!in_array('sys_workspace', $tables) || !in_array('sys_workspace_stage', $tables)) {
-                                       $result = TRUE;
-                                       $reason .= ' The database tables for the workspace functionality are missing.';
-                               } elseif ($this->isOldStyleAdminFieldUsed() || $this->isOldStyleWorkspace()) {
-                                       $wsCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'sys_workspace', '');
-                                       $result |= $wsCount > 0;
-                                       $reason .= ' The existing workspaces will be checked for compatibility with the new features.';
-                               }
-                               $draftWorkspaceTestResult = $this->isDraftWorkspaceUsed();
-                               if ($draftWorkspaceTestResult) {
-                                       $reason .= ' The old style draft workspace is used.
-                                               Related records will be moved into a full featured workspace.';
-                                       $result = TRUE;
-                               }
-                               $description .= '<br /><strong>Why do you need this wizard?</strong><br />' . $reason;
-                       }
-               }
-               return $result;
-       }
-
-       /**
-        * This method requests input from the user about the upgrade process, if needed
-        *
-        * @param string $inputPrefix
-        * @return void
-        */
-       public function getUserInput($inputPrefix) {
-               $content = '';
-               if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('version') && !\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('workspaces')) {
-                       // We need feedback only if versioning is not activated at all
-                       // In such a case we want to leave the user with the choice of not activating the stuff at all
-                       $content = '
-                               <fieldset>
-                                       <ol>
-                       ';
-                       $content .= '
-                               <li class="labelAfter">
-                                       <input type="checkbox" id="versioning" name="' . $inputPrefix . '[versioning]" value="1" checked="checked" />
-                                       <label for="versioning">Activate workspaces?</label>
-                               </li>
-                       ';
-                       $content .= '
-                                       </ol>
-                               </fieldset>
-                       ';
-               } else {
-                       // No feedback needed, just include the update flag as a hidden field
-                       $content = '<input type="hidden" id="versioning" name="' . $inputPrefix . '[versioning]" value="1" />';
-               }
-               return $content;
-       }
-
-       /**
-        * Performs the database update. Changes existing workspaces to use the new custom workspaces
-        *
-        * @param       array           &$databaseQueries: queries done in this update
-        * @param       mixed           &$customMessages: custom messages
-        * @return      boolean         whether it worked (TRUE) or not (FALSE)
-        */
-       public function performUpdate(array &$databaseQueries, &$customMessages) {
-               $result = TRUE;
-               // TYPO3 version below 4.5
-               if ($this->versionNumber < 4005000) {
-                       return FALSE;
-               }
-               // Wizard skipped by the user
-               if (empty($this->pObj->INSTALL['update']['migrateWorkspaces']['versioning'])) {
-                       return TRUE;
-               }
-               \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadExtensionTables(FALSE);
-               // install version and workspace extension (especially when updating from very old TYPO3 versions
-               $this->installExtensions(array('extbase', 'fluid', 'version', 'workspaces'));
-               // migrate all workspaces to support groups and be_users
-               if ($this->isOldStyleAdminFieldUsed()) {
-                       $this->migrateAdminFieldToNewStyle();
-               }
-               // create a new dedicated "Draft" workspace and move all records to that new workspace
-               if ($this->isDraftWorkspaceUsed()) {
-                       $draftWorkspaceId = $this->createWorkspace();
-                       if (is_integer($draftWorkspaceId)) {
-                               $this->migrateDraftWorkspaceRecordsToWorkspace($draftWorkspaceId);
-                       }
-               }
-               $workspaces = $this->getWorkspacesWithoutStages();
-               $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
-               $label = 'Review';
-               foreach ($workspaces as $workspace) {
-                       // Find all workspaces and add "review" stage record
-                       // Add review users and groups to the new IRRE record
-                       $reviewStageId = $this->createReviewStageForWorkspace($workspace['uid'], $label, $workspace['reviewers']);
-                       // Update all "review" state records in the database to point to the new state
-                       $this->migrateOldRecordsToStage($workspace['uid'], 1, $reviewStageId);
-                       // Update all "ready to publish" records in the database to point to the new ready to publish state
-                       $this->migrateOldRecordsToStage($workspace['uid'], 10, -99);
-               }
-               if (is_array($this->sqlQueries) && is_array($databaseQueries)) {
-                       $databaseQueries = array_merge($databaseQueries, $this->sqlQueries);
-               }
-               return $result;
-       }
-
-       /**
-        * Check if any table contains draft-workspace records
-        *
-        * @return boolean
-        */
-       protected function isDraftWorkspaceUsed() {
-               $foundDraftRecords = FALSE;
-               $tables = array_keys($GLOBALS['TCA']);
-               foreach ($tables as $table) {
-                       if (is_array($GLOBALS['TCA'][$table])) {
-                               $versioningVer = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($GLOBALS['TCA'][$table]['ctrl']['versioningWS'], 0, 2, 0);
-                               if ($versioningVer > 0) {
-                                       if ($this->hasElementsOnWorkspace($table, -1)) {
-                                               $foundDraftRecords = TRUE;
-                                               break;
-                                       }
-                               }
-                       }
-               }
-               return $foundDraftRecords;
-       }
-
-       /**
-        * Find workspaces which have no sys_workspace_state(s) but have records using states
-        * If "
-        *
-        * @return boolean
-        */
-       protected function isOldStyleWorkspace() {
-               $foundOldStyleStages = FALSE;
-               $workspaces = $this->getWorkspacesWithoutStages();
-               $workspacesWithReviewers = 0;
-               $workspaceUids = array();
-               foreach ($workspaces as $workspace) {
-                       $workspaceUids[] = $workspace['uid'];
-                       if ($workspace['reviewers']) {
-                               $workspacesWithReviewers++;
-                       }
-               }
-               if (!$workspacesWithReviewers && !empty($workspaceUids)) {
-                       $tables = array_keys($GLOBALS['TCA']);
-                       foreach ($tables as $table) {
-                               $versioningVer = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($GLOBALS['TCA'][$table]['ctrl']['versioningWS'], 0, 2, 0);
-                               if ($versioningVer > 0) {
-                                       $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', $table, 't3ver_wsid IN (' . implode(',', $workspaceUids) . ') AND t3ver_stage IN (-1,1,10) AND pid = -1');
-                                       if ($count > 0) {
-                                               $foundOldStyleStages = TRUE;
-                                               break;
-                                       }
-                               }
-                       }
-               }
-               return $foundOldStyleStages || $workspacesWithReviewers;
-       }
-
-       /**
-        * Create a new stage for the given workspace
-        *
-        * @param               integer Workspace ID
-        * @param               string          The label of the new stage
-        * @param               string          The users or groups which are authorized for that stage
-        * @return      integer The id of the new stage
-        */
-       protected function createReviewStageForWorkspace($workspaceId, $stageLabel, $stageMembers) {
-               $data = array(
-                       'parentid' => $workspaceId,
-                       'parenttable' => 'sys_workspace',
-                       'title' => $stageLabel,
-                       'responsible_persons' => $stageMembers
-               );
-               $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_workspace_stage', $data);
-               $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
-               return $GLOBALS['TYPO3_DB']->sql_insert_id();
-       }
-
-       /**
-        * Updates the stages of placeholder records within the given workspace from $oldId to $newId
-        *
-        * @param               integer Workspace ID
-        * @param               integer Old stage od
-        * @param               integer New stage od
-        * @return      void
-        */
-       protected function migrateOldRecordsToStage($workspaceId, $oldStageId, $newStageId) {
-               $tables = array_keys($GLOBALS['TCA']);
-               $where = 't3ver_wsid = ' . intval($workspaceId) . ' AND t3ver_stage = ' . intval($oldStageId) . ' AND pid = -1';
-               $values = array(
-                       't3ver_stage' => intval($newStageId)
-               );
-               foreach ($tables as $table) {
-                       $versioningVer = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($GLOBALS['TCA'][$table]['ctrl']['versioningWS'], 0, 2, 0);
-                       if ($versioningVer > 0) {
-                               $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, $where, $values);
-                               $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
-                       }
-               }
-       }
-
-       /**
-        * Check if there's any workspace which doesn't support the new admin-field format yet
-        *
-        * @return boolean
-        */
-       protected function isOldStyleAdminFieldUsed() {
-               $where = 'adminusers != "" AND adminusers NOT LIKE "%be_users%" AND adminusers NOT LIKE "%be_groups%" AND deleted=0';
-               $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'sys_workspace', $where);
-               $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
-               return $count > 0;
-       }
-
-       /**
-        * Create a real workspace named "Draft"
-        *
-        * @return integer
-        */
-       protected function createWorkspace() {
-               // @todo who are the reviewers and owners for this workspace?
-               // In previous versions this was defined in be_groups/be_users with the setting "Edit in Draft"
-               $data = array(
-                       'title' => 'Draft'
-               );
-               $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_workspace', $data);
-               $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
-               return $GLOBALS['TYPO3_DB']->sql_insert_id();
-       }
-
-       /**
-        * Migrates all elements from the old draft workspace to the new one.
-        *
-        * @param integer $wsId
-        * @return void
-        */
-       protected function migrateDraftWorkspaceRecordsToWorkspace($wsId) {
-               $tables = array_keys($GLOBALS['TCA']);
-               $where = 't3ver_wsid=-1';
-               $values = array(
-                       't3ver_wsid' => intval($wsId)
-               );
-               foreach ($tables as $table) {
-                       $versioningVer = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($GLOBALS['TCA'][$table]['ctrl']['versioningWS'], 0, 2, 0);
-                       if ($versioningVer > 0 && $this->hasElementsOnWorkspace($table, -1)) {
-                               $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, $where, $values);
-                               $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
-                       }
-               }
-       }
-
-       /**
-        * Migrate all workspace adminusers fields to support groups aswell,
-        * this means that the old comma separated list of uids (referring to be_users)
-        * is updated to be a list of uids with the tablename as prefix
-        *
-        * @return void
-        */
-       protected function migrateAdminFieldToNewStyle() {
-               $where = 'adminusers != "" AND adminusers NOT LIKE "%be_users%" AND adminusers NOT LIKE "%be_groups%" AND deleted=0';
-               $workspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid, adminusers', 'sys_workspace', $where);
-               $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
-               foreach ($workspaces as $workspace) {
-                       $updateArray = array(
-                               'adminusers' => 'be_users_' . implode(',be_users_', \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $workspace['adminusers'], TRUE))
-                       );
-                       $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_workspace', 'uid = ' . $workspace['uid'], $updateArray);
-                       $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
-               }
-       }
-
-       /**
-        * Determines whether a table has elements in a particular workspace.
-        *
-        * @param string $table Name of the table
-        * @param integer $workspaceId Id of the workspace
-        * @return boolean
-        */
-       protected function hasElementsOnWorkspace($table, $workspaceId) {
-               $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', $table, 't3ver_wsid=' . intval($workspaceId));
-               $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
-               return $count > 0;
-       }
-
-       /**
-        * Returns all sys_workspace records which are not referenced by any sys_workspace_stages record
-        *
-        * @return array
-        */
-       protected function getWorkspacesWithoutStages() {
-               $stages = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('parentid', 'sys_workspace_stage', 'parenttable=\'sys_workspace\'');
-               $wsWhitelist = array();
-               foreach ($stages as $stage) {
-                       $wsWhitelist[] = $stage['parentid'];
-               }
-               $where = 'deleted=0';
-               $where .= !empty($wsWhitelist) ? ' AND uid NOT IN (' . implode(',', $wsWhitelist) . ')' : '';
-               return $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_workspace', $where);
-       }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/CoreUpdates/NotInMenuUpdate.php b/typo3/sysext/install/Classes/CoreUpdates/NotInMenuUpdate.php
deleted file mode 100644 (file)
index a9b3637..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\CoreUpdates;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 1999-2013 Sebastian Kurfürst <sebastian@garbage-group.de>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Contains the update class for not in menu pages. Used by the update wizard in the install tool.
- *
- * @author Sebastian Kurfürst <sebastian@garbage-group.de>
- * @author Steffen Kamper <info@sk-typo3.de>
- */
-class NotInMenuUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
-
-       protected $title = 'Update Pages with Doktype "Not in menu"';
-
-       /**
-        * Checks if an update is needed
-        *
-        * @param       string          &$description: The description for the update
-        * @return      boolean         whether an update is needed (TRUE) or not (FALSE)
-        */
-       public function checkForUpdate(&$description) {
-               $result = FALSE;
-               $description = 'Removes the deprecated pages doktype "Not in menu". It sets the successing flag "Not in menu" for the corresponding pages instead.';
-               if ($this->versionNumber >= 4002000) {
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'doktype=5', '', '', '1');
-                       if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
-                               $result = TRUE;
-                       }
-                       $GLOBALS['TYPO3_DB']->sql_free_result($res);
-               }
-               return $result;
-       }
-
-       /**
-        * Performs the database update. Changes the doktype from 5 ("not in menu") to 1 (standard) and sets the "nav_hide" flag to 1
-        *
-        * @param       array           &$dbQueries: queries done in this update
-        * @param       mixed           &$customMessages: custom messages
-        * @return      boolean         whether it worked (TRUE) or not (FALSE)
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               $result = FALSE;
-               if ($this->versionNumber >= 4002000) {
-                       $updateArray = array(
-                               'doktype' => 1,
-                               'nav_hide' => 1
-                       );
-                       $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery('pages', 'doktype=5', $updateArray);
-                       $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());
-                       } else {
-                               $result = TRUE;
-                       }
-               }
-               return $result;
-       }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/CoreUpdates/RootTemplateUpdate.php b/typo3/sysext/install/Classes/CoreUpdates/RootTemplateUpdate.php
deleted file mode 100644 (file)
index a5eff35..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\CoreUpdates;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2012-2013 Oliver Hader <oliver.hader@typo3.org>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Migrates the old media FlexForm to the new
- */
-class RootTemplateUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate implements \TYPO3\CMS\Install\Updates\InstallerProcessInterface {
-       protected $title = 'Integrate TypoScript Root Template';
-
-       /**
-        * Checks whether updates need to be performed
-        *
-        * @param string &$description The description for the update
-        * @param integer &$showUpdate 0=dont show update; 1=show update and next button; 2=only show description
-        * @return boolean
-        */
-       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      boolean         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)) {
-                       $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;
-       }
-}
-
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/CoreUpdates/T3skinUpdate.php b/typo3/sysext/install/Classes/CoreUpdates/T3skinUpdate.php
deleted file mode 100644 (file)
index 0da16ef..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\CoreUpdates;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010-2013  Steffen Ritter (info@rs-websystems.de)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Contains the update class for not installed t3skin. Used by the update wizard in the install tool.
- *
- * @author     Steffen Ritter <info@rs-websystems.de>
- */
-class T3skinUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
-
-       /**
-        * @var string
-        */
-       protected $title = 'Install the new TYPO3 Skin "t3skin"';
-
-       /**
-        * Checks if t3skin is not installed.
-        *
-        * @param       string          &$description: The description for the update
-        * @return      boolean         whether an update is needed (TRUE) or not (FALSE)
-        */
-       public function checkForUpdate(&$description) {
-               $result = FALSE;
-               $description[] = '<strong>The backend skin "t3skin" is not loaded.</strong>
-               TYPO3 4.4 introduced many changes in backend skinning and old backend skins are now incompatible.
-               <strong>Without "t3skin" the backend may be unusable.</strong> Install extension "t3skin".';
-               if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('t3skin')) {
-                       $result = TRUE;
-               }
-               return $result;
-       }
-
-       /**
-        * second step: get user info
-        *
-        * @param       string          input prefix, all names of form fields have to start with this. Append custom name in [ ... ]
-        * @return      string          HTML output
-        */
-       public function getUserInput($inputPrefix) {
-               $content = '<strong>Install the system extension</strong><br />You are about to install the extension "t3skin".';
-               return $content;
-       }
-
-       /**
-        * performs the action of the UpdateManager
-        *
-        * @param       array           &$dbQueries: queries done in this update
-        * @param       mixed           &$customMessages: custom messages
-        * @return      bool            whether everything went smoothly or not
-        */
-       public function performUpdate(array &$dbQueries, &$customMessages) {
-               $result = FALSE;
-               if ($this->versionNumber >= 4004000 && !\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('t3skin')) {
-                       // check wether the table can be truncated or if sysext with tca has to be installed
-                       if ($this->checkForUpdate($customMessages)) {
-                               try {
-                                       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::loadExtension('t3skin');
-                                       $customMessages = 'The system extension "t3skin" was successfully loaded.';
-                                       $result = TRUE;
-                               } catch (\RuntimeException $e) {
-                                       $result = FALSE;
-                               }
-                       }
-               }
-               return $result;
-       }
-
-}
-
-
-?>
\ No newline at end of file
index 7167134..2e1f72b 100644 (file)
@@ -26,44 +26,55 @@ namespace TYPO3\CMS\Install\Updates;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+
 /**
  * Generic class that every update wizard class inherits from.
  * Used by the update wizard in the install tool.
  *
- * @author     Benjamin Mack <benni@typo3.org>
+ * @author Benjamin Mack <benni@typo3.org>
  */
 abstract class AbstractUpdate {
 
        /**
-        * the human-readable title of the upgrade wizard
+        * The human-readable title of the upgrade wizard
+        *
+        * @var string
         */
        protected $title;
 
        /**
-        * parent object
+        * The update wizard identifier
+        *
+        * @var string
+        */
+       protected $identifier;
+
+       /**
+        * Parent object
         *
         * @var \TYPO3\CMS\Install\Installer
         */
        public $pObj;
 
        /**
-        * user input, set from outside
+        * User input, set from outside
+        *
+        * @var string
         */
        public $userInput;
 
        /**
-        * current TYPO3 version number, set from outside
-        * version number coming from \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger()
+        * Current TYPO3 version number, set from outside
+        * Version number coming from \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger()
+        *
+        * @var integer
         */
        public $versionNumber;
 
        /**
-        * Helper functions, getters and setters
-        */
-       /**
-        * returns the title attribute
+        * Returns the title attribute
         *
-        * @return      the title of this update wizard
+        * @return string The title of this update wizard
         */
        public function getTitle() {
                if ($this->title) {
@@ -74,68 +85,68 @@ abstract class AbstractUpdate {
        }
 
        /**
-        * sets the title attribute
+        * Sets the title attribute
         *
-        * @param       $title  the title of this update wizard
-        * @return      void
+        * @param string $title The title of this update wizard
+        * @return void
         */
        public function setTitle($title) {
                $this->title = $title;
        }
 
        /**
-        * returns the identifier of this class
+        * Returns the identifier of this class
         *
-        * @return      the identifier of this update wizard
+        * @return string The identifier of this update wizard
         */
        public function getIdentifier() {
                return $this->identifier;
        }
 
        /**
-        * sets the identifier attribute
+        * Sets the identifier attribute
         *
-        * @param       $identifier     the identifier of this update wizard
-        * @return      void
+        * @param string $identifier The identifier of this update wizard
+        * @return void
         */
        public function setIdentifier($identifier) {
                $this->identifier = $identifier;
        }
 
        /**
-        * simple wrapper function that helps dealing with the compatibility
+        * Simple wrapper function that helps dealing with the compatibility
         * layer that some update wizards don't have a second parameter
         * thus, it evaluates everything already
         *
-        * @return      boolean if the wizard should be shown at all on the overview page
+        * @return boolean If the wizard should be shown at all on the overview page
         * @see checkForUpdate()
         */
        public function shouldRenderWizard() {
                $showUpdate = 0;
                $explanation = '';
-               $res = $this->checkForUpdate($explanation, $showUpdate);
-               return $showUpdate > 0 || $res == TRUE;
+               $result = $this->checkForUpdate($explanation, $showUpdate);
+               return $showUpdate > 0 || $result == TRUE;
        }
 
        /**
-        * simple wrapper function that helps to check whether (if)
+        * Simple wrapper function that helps to check whether (if)
         * this feature is cool if you want to tell the user that the update wizard
         * is working fine, just as output (useful for the character set / utf8 wizard)
         *
-        * @return      boolean if the wizard should render the Next() button on the overview page
+        * @return boolean If the wizard should render the Next() button on the overview page
         * @see checkForUpdate()
         */
        public function shouldRenderNextButton() {
                $showUpdate = 0;
                $explanation = '';
-               $res = $this->checkForUpdate($explanation, $showUpdate);
-               return $showUpdate != 2 || $res == TRUE;
+               $result = $this->checkForUpdate($explanation, $showUpdate);
+               return $showUpdate != 2 || $result == TRUE;
        }
 
        /**
         * Checks whether updates are required.
         *
-        * @param string &$description: The description for the update
+        * @param string &$description The description for the update
         * @return boolean Whether an update is required (TRUE) or not (FALSE)
         */
        abstract public function checkForUpdate(&$description);
@@ -143,8 +154,8 @@ abstract class AbstractUpdate {
        /**
         * Performs the accordant updates.
         *
-        * @param array &$dbQueries: queries done in this update
-        * @param mixed &$customMessages: custom messages
+        * @param array &$dbQueries Queries done in this update
+        * @param mixed &$customMessages Custom messages
         * @return boolean Whether everything went smoothly or not
         */
        abstract public function performUpdate(array &$dbQueries, &$customMessages);
@@ -156,7 +167,7 @@ abstract class AbstractUpdate {
         * @param array $extensionKeys List of keys of extensions to install
         * @return void
         */
-       protected function installExtensions($extensionKeys) {
+       protected function installExtensions(array $extensionKeys) {
                /** @var $installUtility \TYPO3\CMS\Extensionmanager\Utility\InstallUtility */
                $installUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
                        'TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility'
@@ -186,7 +197,10 @@ abstract class AbstractUpdate {
        protected function isWizardDone() {
                $wizardClassName = get_class($this);
                $done = FALSE;
-               if (isset($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone'][$wizardClassName]) && $GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone'][$wizardClassName]) {
+               if (
+                       isset($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone'][$wizardClassName])
+                       && $GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone'][$wizardClassName]
+               ) {
                        $done = TRUE;
                }
                return $done;
@@ -194,5 +208,4 @@ abstract class AbstractUpdate {
 
 }
 
-
 ?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/Updates/AddFlexFormsToAclUpdate.php b/typo3/sysext/install/Classes/Updates/AddFlexFormsToAclUpdate.php
new file mode 100644 (file)
index 0000000..78af957
--- /dev/null
@@ -0,0 +1,187 @@
+<?php
+namespace TYPO3\CMS\Install\Updates;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010-2013 Kai Vogel (kai.vogel(at)speedprogs.de)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Contains the update for group access lists, adds all excludeable FlexForm fields.
+ * Used by the update wizard in the install tool.
+ *
+ * @author Kai Vogel <kai.vogel(at)speedprogs.de>
+ */
+class AddFlexFormsToAclUpdate extends AbstractUpdate {
+
+       /**
+        * @var string
+        */
+       protected $title = 'Add Excludable FlexForm Fields to Group Access Lists';
+
+       /**
+        * Checks if FlexForm fields are missing in group access lists.
+        *
+        * @param string &$description The description for the update
+        * @return boolean Whether an update is required (TRUE) or not (FALSE)
+        */
+       public function checkForUpdate(&$description) {
+               $description = '
+                       <br />TYPO3 4.5 introduced the possibility to exclude FlexForm fields like normal fields in group access control lists (ACL).
+                       All excludeable fields will be hidden for non-admins if you do not add them to the ACL of each user group manually or with
+                       this update wizard.
+               ';
+               // Check access lists
+               if (!$this->getGroupAddFields()) {
+                       return FALSE;
+               }
+               return TRUE;
+       }
+
+       /**
+        * Get user confirmation
+        *
+        * @param string $inputPrefix The input prefix, all names of form fields have to start with this
+        * @return string HTML output
+        */
+       public function getUserInput($inputPrefix) {
+               $description = '
+                       <br />You are about to update group access control lists to include excludable FlexForm fields. Each backend group will be checked
+                       and only those that already have entries in the access control lists will be updated.
+               ';
+               return $description;
+       }
+
+       /**
+        * Performs the action of the UpdateManager
+        *
+        * @param array &$dbQueries Queries done in this update
+        * @param mixed &$customMessages Custom messages
+        * @return boolean Whether update was successful or not
+        */
+       public function performUpdate(array &$dbQueries, &$customMessages) {
+               // Get additional FlexForm fields for group access lists
+               $addFields = $this->getGroupAddFields();
+               if (empty($addFields)) {
+                       $customMessages = 'No missing FlexForm fields found!';
+                       return FALSE;
+               }
+               return $this->updateGroupAccessLists($addFields, $dbQueries, $customMessages);
+       }
+
+       /**
+        * Get all FlexForm fields which must be added to group access lists
+        *
+        * @return array Additional FlexForm fields for ACL
+        */
+       protected function getGroupAddFields() {
+               $addFields = array();
+               $contentTable = !empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable']) ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'] : 'tt_content';
+               // Initialize TCA if not loaded yet
+               if (empty($GLOBALS['TCA'])) {
+                       $this->pObj->includeTCA();
+               }
+               // Get all access lists from groups which are allowed to select or modify the content-table
+               $search = $GLOBALS['TYPO3_DB']->escapeStrForLike($contentTable, 'be_groups');
+               $where = 'deleted = 0 AND non_exclude_fields IS NOT NULL AND non_exclude_fields != ""';
+               $where .= ' AND (tables_select LIKE "%' . $search . '%" OR tables_modify LIKE "%' . $search . '%")';
+               $accessLists = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid, non_exclude_fields', 'be_groups', $where);
+               if (empty($accessLists)) {
+                       return array();
+               }
+               // Get all excludeable FlexForm fields from content-table
+               $flexExcludeFields = array();
+               $flexFormArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRegisteredFlexForms($contentTable);
+               if (!empty($flexFormArray) && is_array($flexFormArray)) {
+                       foreach ($flexFormArray as $tableField => $flexForms) {
+                               // Get all sheets
+                               foreach ($flexForms as $flexFormIdentifier => $flexFormConfig) {
+                                       // Get all excludeable fields in sheet
+                                       foreach ($flexFormConfig['ds']['sheets'] as $sheetName => $sheet) {
+                                               if (empty($sheet['ROOT']['el']) || !is_array($sheet['ROOT']['el'])) {
+                                                       continue;
+                                               }
+                                               foreach ($sheet['ROOT']['el'] as $fieldName => $field) {
+                                                       if (empty($field['TCEforms']['exclude'])) {
+                                                               continue;
+                                                       }
+                                                       $flexExcludeFields[] = $contentTable . ':' . $tableField . ';' . $flexFormIdentifier . ';' . $sheetName . ';' . $fieldName;
+                                               }
+                                       }
+                               }
+                       }
+               }
+               if (empty($flexExcludeFields)) {
+                       return array();
+               }
+               // Get FlexForm fields from access lists
+               foreach ($accessLists as $accessList) {
+                       $nonExcludeFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $accessList['non_exclude_fields']);
+                       if (empty($nonExcludeFields)) {
+                               continue;
+                       }
+                       // Add FlexForm fields only if the field was not already selected by a user
+                       $nonExcludeFields = array_diff($flexExcludeFields, $nonExcludeFields);
+                       if (!empty($nonExcludeFields) && $nonExcludeFields == $flexExcludeFields) {
+                               $addFields[$accessList['uid']] = $nonExcludeFields;
+                       }
+               }
+               return $addFields;
+       }
+
+       /**
+        * Update Backend user groups, add FlexForm fields to access list
+        *
+        * @param array $addFields All missing FlexForm fields by groups
+        * @param array &$dbQueries Queries done in this update
+        * @param mixed &$customMessages Custom messages
+        * @return boolean Whether update was successful or not
+        */
+       protected function updateGroupAccessLists(array $addFields, array &$dbQueries, &$customMessages) {
+               foreach ($addFields as $groupUID => $flexExcludeFields) {
+                       // First get current fields
+                       $result = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('non_exclude_fields', 'be_groups', 'uid=' . (int) $groupUID);
+                       if (!isset($result['non_exclude_fields'])) {
+                               continue;
+                       }
+                       $nonExcludeFields = $result['non_exclude_fields'];
+                       // Now add new ones
+                       $flexExcludeFields = implode(',', $flexExcludeFields);
+                       $nonExcludeFields = trim($nonExcludeFields . ',' . $flexExcludeFields, ', ');
+                       // Finally override with new fields
+                       $GLOBALS['TYPO3_DB']->exec_UPDATEquery('be_groups', 'uid=' . (int) $groupUID, array('non_exclude_fields' => $nonExcludeFields));
+                       // 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;
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/Updates/CharsetDefaultsUpdate.php b/typo3/sysext/install/Classes/Updates/CharsetDefaultsUpdate.php
new file mode 100644 (file)
index 0000000..e2b2feb
--- /dev/null
@@ -0,0 +1,84 @@
+<?php
+namespace TYPO3\CMS\Install\Updates;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010-2013 Michael Stucki <michael@typo3.org>, Benjamin Mack <benni@typo3.org>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Displays warnings and information about the database character set
+ */
+class CharsetDefaultsUpdate extends AbstractUpdate {
+
+       /**
+        * @var string
+        */
+       protected $title = 'Database Character Set';
+
+       /**
+        * Checks if the configuration is relying on old default values or not.
+        * If needed, this updater will fix the configuration appropriately.
+        *
+        * @param string &$description The description for the update
+        * @param string &$showUpdate 0=don't show update; 1=show update and next button; 2=only show description
+        * @return boolean Whether an update is needed (TRUE) or not (FALSE)
+        */
+       public function checkForUpdate(&$description, &$showUpdate = FALSE) {
+               if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['setDBinit'] === '-1') {
+                       $description = 'The configuration variables $TYPO3_CONF_VARS[\'SYS\'][\'setDBinit\']
+                               is relying on empty default values.<br />
+                               However, the default has changed in TYPO3 4.5.<br /><br />
+                               Please click "Next" to write the former default settings to your localconf.php,
+                               so that your setup will continue to work like before.';
+                       $showUpdate = 1;
+               }
+       }
+
+       /**
+        * Write the current configuration to localconf.php
+        * This is needed for any sites that were relying on the former default
+        * values which are going to change in TYPO3 4.5.
+        *
+        * @param array &$dbQueries Queries done in this update
+        * @param mixed &$customMessages Custom messages
+        * @return boolean Whether the updated was made or not
+        */
+       public function performUpdate(array &$dbQueries, &$customMessages) {
+               // Update "setDBinit" setting
+               $result1 = FALSE;
+               if (\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->getLocalConfigurationValueByPath('SYS/setDBinit') === '-1') {
+                       $result1 = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValueByPath('SYS/setDBinit', '');
+               }
+               if ($result1) {
+                       $customMessages[] = 'The configuration was successfully updated.';
+                       return TRUE;
+               } else {
+                       return FALSE;
+               }
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/Updates/CompatVersionUpdate.php b/typo3/sysext/install/Classes/Updates/CompatVersionUpdate.php
new file mode 100644 (file)
index 0000000..7e7882a
--- /dev/null
@@ -0,0 +1,245 @@
+<?php
+namespace TYPO3\CMS\Install\Updates;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 1999-2013 Sebastian Kurfürst <sebastian@garbage-group.de>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Contains the update class for the compatibility version.
+ * Used by the update wizard in the install tool.
+ *
+ * @author Sebastian Kurfürst <sebastian@garbage-group.de
+ */
+class CompatVersionUpdate extends AbstractUpdate {
+
+       /**
+        * @var string
+        */
+       protected $title = 'Version Compatibility';
+
+       /**
+        * Function which checks if update is needed. Called in the beginning of an update process.
+        *
+        * @param string &$description Pointer to description for the update
+        * @return boolean TRUE if update is needs to be performed, FALSE otherwise.
+        */
+       public function checkForUpdate(&$description) {
+               if (!$this->compatVersionIsCurrent()) {
+                       $description = '
+                               <p>
+                                       Your current TYPO3 installation is configured to
+                                       <strong>behave like version
+                                       ' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['compat_version']) . '
+                                       </strong> of TYPO3. If you just upgraded from this version,
+                                       you most likely want to <strong>use new features</strong> as
+                                       well.
+                               </p>
+                               <p>
+                                       In the next step, you will see the things that need to be
+                                       adjusted to make your installation compatible with the new
+                                       features.
+                               </p>
+                       ';
+                       return TRUE;
+               }
+               return FALSE;
+       }
+
+       /**
+        * 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 [ ... ]
+        * @return string HTML output
+        */
+       public function getUserInput($inputPrefix) {
+               if ($this->compatVersionIsCurrent()) {
+                       $content = '
+                               <fieldset>
+                                       <ol>
+                                               <li>
+                                                       <strong>You updated from an older version of TYPO3</strong>:
+                                               </li>
+                                               <li>
+                                                       <label for="version">Select the version where you have upgraded from:</label>
+                                                       <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'
+                       );
+                       foreach ($versions as $singleVersion => $caption) {
+                               $content .= '
+                                                               <option value="' . $singleVersion . '">' . $caption . '</option>
+                               ';
+                       }
+                       $content .= '
+                                                       </select>
+                                               </li>
+                                       </ol>
+                               </fieldset>
+                       ';
+               } else {
+                       $content = '
+                               <p>
+                                       TYPO3 output is currently compatible to version ' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['compat_version']) . '.
+                                       To use all the new features in the current TYPO3 version,
+                                       make sure you follow the guidelines below to upgrade without
+                                       problems.
+                               </p>
+                               <p>
+                                       <strong>
+                                               Follow the steps below carefully and confirm every step!
+                                       </strong>
+                                       <br />
+                                       You will see this list again after you performed the update.
+                               </p>
+                       ';
+                       $content .= $this->showChangesNeeded($inputPrefix);
+                       $content .= '
+                               <fieldset>
+                                       <ol>
+                                               <li class="labelAfter">
+                                                       <input type="checkbox" name="' . $inputPrefix . '[compatVersion][all]" id="compatVersionAll" value="1" />
+                                                       <label for="compatVersionAll">Check all (ignore selection above)</label>
+                                               </li>
+                                               <li>
+                                                       WARNING: this might break the output of your website.
+                                               </li>
+                                       </ol>
+                               </fieldset>
+                       ';
+               }
+               return $content;
+       }
+
+       /**
+        * Checks if user input is valid
+        *
+        * @param string Pointer to output custom messages
+        * @return boolean 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;
+                                               }
+                                       }
+                               }
+                               return $performUpdate;
+                       }
+               }
+       }
+
+       /**
+        * 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
+        * @return boolean TRUE if update succeeded, FALSE otherwise
+        */
+       public function performUpdate(array &$dbQueries, &$customMessages) {
+               $customMessages = '';
+               // If we just set it to an older version
+               if ($this->userInput['version']) {
+                       $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);
+               $customMessages .= '<br />The compatibility version has been set to ' . $version . '.';
+               return TRUE;
+       }
+
+       /**
+        * Checks if compatibility version is set to current version
+        *
+        * @return boolean 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;
+               }
+       }
+
+       /**
+        * Show changes needed
+        *
+        * @param string 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'])) {
+                       $updateWizardBoxes = '';
+                       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']) : '';
+                                       $updateWizardBoxes .= '
+                                               <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 (strlen($updateWizardBoxes)) {
+                       return $updateWizardBoxes;
+               }
+               return '';
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/Updates/CompressionLevelUpdate.php b/typo3/sysext/install/Classes/Updates/CompressionLevelUpdate.php
new file mode 100644 (file)
index 0000000..8dfa263
--- /dev/null
@@ -0,0 +1,93 @@
+<?php
+namespace TYPO3\CMS\Install\Updates;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010-2013  Steffen Ritter (info@rs-websystems.de)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * Contains the update class checking against configured compressionlevel. Used by the update wizard in the install tool.
+ *
+ * @author Steffen Ritter <info@rs-websystems.de>
+ */
+class CompressionLevelUpdate extends AbstractUpdate {
+
+       /**
+        * @var string
+        */
+       protected $title = 'Check Compression Level';
+
+       /**
+        * Checks if there there is an compression level configured which may break the BE.
+        *
+        * @param string &$description The description for the update
+        * @return boolean Whether an update is needed (TRUE) or not (FALSE)
+        */
+       public function checkForUpdate(&$description) {
+               $description = '<p><strong>TYPO3_CONF_VARS[BE][compressionLevel] is enabled.</strong><br />
+               In TYPO3 4.4, compressionLevel was expanded to include automatic gzip compression of JavaScript and CSS stylessheet files.
+               <strong>To prevent the TYPO3 backend from being unusable, you must include the relevant lines from _.htaccess.</strong></p>';
+               if (!$this->isWizardDone() && intval($GLOBALS['TYPO3_CONF_VARS']['BE']['compressionLevel']) > 0) {
+                       return TRUE;
+               }
+               return FALSE;
+       }
+
+       /**
+        * second step: get user info
+        *
+        * @param string Input prefix, all names of form fields have to start with this. Append custom name in [ ... ]
+        * @return string HTML output
+        */
+       public function getUserInput($inputPrefix) {
+               $content = '<p><strong>This configuration cannot be fixed automatically and requires a manual update.</strong> Please include the following lines from _.htaccess on top of your .htacess file.
+                                       <br /><br />
+                                       <pre>
+&lt;FilesMatch "\\.js\\.gzip$"&gt;
+ AddType "text/javascript" .gzip
+&lt;/FilesMatch&gt;
+&lt;FilesMatch "\\.css\\.gzip$"&gt;
+  AddType "text/css" .gzip
+&lt;/FilesMatch&gt;
+AddEncoding gzip .gzip
+                                       </pre></p>';
+               return $content;
+       }
+
+       /**
+        * performs the action of the UpdateManager
+        *
+        * @param array &$dbQueries Queries done in this update
+        * @param mixed &$customMessages Custom messages
+        * @return boolean Whether everything went smoothly or not
+        */
+       public function performUpdate(array &$dbQueries, &$customMessages) {
+               $customMessages = 'Cannot automatically fix this problem! Please check manually.';
+               $this->markWizardAsDone();
+               return FALSE;
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/Updates/CscSplitUpdate.php b/typo3/sysext/install/Classes/Updates/CscSplitUpdate.php
new file mode 100644 (file)
index 0000000..82e8ba8
--- /dev/null
@@ -0,0 +1,187 @@
+<?php
+namespace TYPO3\CMS\Install\Updates;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 1999-2013 Susanne Moog <typo3@susanne-moog.de>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Contains the update class for the split of css styled content templates. Used by the update wizard in the install tool.
+ *
+ * @author Susanne Moog <typo3@susanne-moog.de>
+ */
+class CscSplitUpdate extends AbstractUpdate {
+
+       /**
+        * @var string
+        */
+       protected $title = 'Split TypoScript Templates from CSS Styled Content';
+
+       /**
+        * Function which checks if update is needed. Called in the beginning of an update process.
+        *
+        * @param string &$description Pointer to description for the update
+        * @return boolean TRUE if update is needs to be performed, FALSE otherwise.
+        */
+       public function checkForUpdate(&$description) {
+               $templates = $this->getTemplatesWithCsc($dbQueries, $customMessages);
+               $templates = $this->findUpdateableTemplatesWithCsc($templates);
+               if (count($templates)) {
+                       $description = '<p>Run this wizard if you use CSS styled content in your templates, as the inclusion of the static templates changed. </p>' . '<p>You are currently using CSS styled content in <strong>' . count($templates) . '&nbsp;templates</strong>  (including deleted and hidden),' . ' so if you did not run this wizard before, <strong>do it now</strong>.</p>' . '<p>The wizard will automatically choose the right template according to your compatibility version. So if you want to ' . 'change the rendering back to an older version, you will have to use the changeCompatibilityVersion wizard above ' . 'first, and then return back to this one.</p>';
+                       return TRUE;
+               }
+               return FALSE;
+       }
+
+       /**
+        * Performs the update itself
+        *
+        * @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 boolean TRUE if update succeeded, FALSE otherwise
+        */
+       public function performUpdate(array &$dbQueries, &$customMessages) {
+               $templates = $this->getTemplatesWithCsc($dbQueries, $customMessages);
+               $templates = $this->findUpdateableTemplatesWithCsc($templates);
+               $this->updateCscTemplates($templates, $dbQueries, $customMessages);
+               if ($customMessages) {
+                       return FALSE;
+               } else {
+                       return TRUE;
+               }
+       }
+
+       /**
+        * Gets the templates that include the static css styled content template
+        *
+        * @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 templates, that include csc
+        */
+       protected function getTemplatesWithCsc(&$dbQueries, &$customMessages) {
+               $fields = 'uid, include_static_file';
+               $table = 'sys_template';
+               $where = 'include_static_file LIKE "%EXT:css_styled_content/static/%"';
+               $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());
+               }
+               $templates = array();
+               while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
+                       $templates[] = $row;
+               }
+               return $templates;
+       }
+
+       /**
+        * Take a list of templates and filter them if they need an update or not
+        *
+        * @param array $allTemplates uid and inclusion string for the templates, that include csc
+        * @return array uid and inclusion string for the templates, that include csc and need an update
+        */
+       protected function findUpdateableTemplatesWithCsc($allTemplates) {
+               $compatVersion = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger($GLOBALS['TYPO3_CONF_VARS']['SYS']['compat_version']);
+               $currentVersion = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_branch);
+               $templatesCount = count($allTemplates);
+               $updateableTemplates = array();
+               for ($i = 0; $i < $templatesCount; $i++) {
+                       $templateNeedsUpdate = FALSE;
+                       $includedTemplates = explode(',', $allTemplates[$i]['include_static_file']);
+                       $includedTemplatesCount = count($includedTemplates);
+                       // loop through every entry in the "include static file"
+                       for ($j = 0; $j < $includedTemplatesCount; $j++) {
+                               if (strpos($includedTemplates[$j], 'css_styled_content') !== FALSE) {
+                                       if ($compatVersion <= \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger('3.8')) {
+                                               if ($includedTemplates[$j] != 'EXT:css_styled_content/static/v3.8/') {
+                                                       $includedTemplates[$j] = 'EXT:css_styled_content/static/v3.8/';
+                                                       $templateNeedsUpdate = TRUE;
+                                               }
+                                       } elseif ($compatVersion <= \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger('4.1')) {
+                                               if ($includedTemplates[$j] != 'EXT:css_styled_content/static/v3.9/') {
+                                                       $includedTemplates[$j] = 'EXT:css_styled_content/static/v3.9/';
+                                                       $templateNeedsUpdate = TRUE;
+                                               }
+                                       } elseif ($compatVersion <= \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger('4.2')) {
+                                               if ($includedTemplates[$j] != 'EXT:css_styled_content/static/v4.2/') {
+                                                       $includedTemplates[$j] = 'EXT:css_styled_content/static/v4.2/';
+                                                       $templateNeedsUpdate = TRUE;
+                                               }
+                                       } elseif ($compatVersion <= \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger('4.3')) {
+                                               if ($includedTemplates[$j] != 'EXT:css_styled_content/static/v4.3/') {
+                                                       $includedTemplates[$j] = 'EXT:css_styled_content/static/v4.3/';
+                                                       $templateNeedsUpdate = TRUE;
+                                               }
+                                       } elseif ($compatVersion <= \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger('4.4')) {
+                                               if ($includedTemplates[$j] != 'EXT:css_styled_content/static/v4.4/') {
+                                                       $includedTemplates[$j] = 'EXT:css_styled_content/static/v4.4/';
+                                                       $templateNeedsUpdate = TRUE;
+                                               }
+                                       } elseif ($compatVersion <= \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger('4.5')) {
+                                               if ($includedTemplates[$j] != 'EXT:css_styled_content/static/v4.5/') {
+                                                       $includedTemplates[$j] = 'EXT:css_styled_content/static/v4.5/';
+                                                       $templateNeedsUpdate = TRUE;
+                                               }
+                                       } elseif ($compatVersion === $currentVersion || $compatVersion > '4.6') {
+                                               if ($includedTemplates[$j] != 'EXT:css_styled_content/static/') {
+                                                       $includedTemplates[$j] = 'EXT:css_styled_content/static/';
+                                                       $templateNeedsUpdate = TRUE;
+                                               }
+                                       }
+                               }
+                       }
+                       $allTemplates[$i]['include_static_file'] = implode(',', $includedTemplates);
+                       if ($templateNeedsUpdate) {
+                               $updateableTemplates[] = $allTemplates[$i];
+                       }
+               }
+               return $updateableTemplates;
+       }
+
+       /**
+        * updates the template records to include the new css styled content templates, according to the current compat version
+        *
+        * @param array $templates Template 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 updateCscTemplates($templates, &$dbQueries, &$customMessages) {
+               foreach ($templates as $template) {
+                       $table = 'sys_template';
+                       $where = 'uid =' . $template['uid'];
+                       $field_values = array(
+                               'include_static_file' => $template['include_static_file']
+                       );
+                       $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());
+                       }
+               }
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/Updates/ExtensionManagerTables.php b/typo3/sysext/install/Classes/Updates/ExtensionManagerTables.php
new file mode 100644 (file)
index 0000000..591a58a
--- /dev/null
@@ -0,0 +1,168 @@
+<?php
+namespace TYPO3\CMS\Install\Updates;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012-2013 Georg Ringer <typo3@ringerge.org>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * 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 boolean 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 boolean
+        */
+       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 boolean 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;
+       }
+
+}
+
+?>
\ No newline at end of file
index ab193cb..20616a7 100644 (file)
@@ -23,6 +23,7 @@ namespace TYPO3\CMS\Install\Updates;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+
 /**
  * Upgrade wizard which checks all existing filemounts
  * and upgrades this them in case we have:
@@ -30,10 +31,9 @@ namespace TYPO3\CMS\Install\Updates;
  * 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>
- * @license     http://www.gnu.org/copyleft/gpl.html
+ * @author Tolleiv Nietsch <typo3@tolleiv.de>
  */
-class FilemountUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
+class FilemountUpdateWizard extends AbstractUpdate {
 
        /**
         * @var string
@@ -79,21 +79,25 @@ class FilemountUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
        /**
         * Checks if an update is needed.
         *
-        * @param       string          &$description: The description for the update
-        * @return      boolean         TRUE if an update is needed, FALSE otherwise
+        * @param string &$description The description for the update
+        * @return boolean 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) ' . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('sys_filemounts'));
+               $filemountCount = $this->db->exec_SELECTcountRows(
+                       '*',
+                       'sys_filemounts',
+                       'base IN (0,1) ' . \TYPO3\CMS\Backend\Utility\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      boolean         TRUE on success, FALSE on error
+        * @param array &$dbQueries Queries done in this update
+        * @param mixed &$customMessages Custom messages
+        * @return boolean TRUE on success, FALSE on error
         */
        public function performUpdate(array &$dbQueries, &$customMessages) {
                $this->init();
@@ -109,21 +113,36 @@ class FilemountUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
        /**
         * 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' . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('sys_filemounts'));
+               $absoluteFilemounts = $this->db->exec_SELECTgetRows(
+                       '*',
+                       'sys_filemounts',
+                       'base = 0' . \TYPO3\CMS\Backend\Utility\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']));
+                               $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=' . intval($filemount['uid']), array('base' => $storageId, 'path' => $storagePath));
+                       $this->db->exec_UPDATEquery(
+                               'sys_filemounts',
+                               'uid=' . intval($filemount['uid']),
+                               array('base' => $storageId, 'path' => $storagePath)
+                       );
                        $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
                }
        }
@@ -131,16 +150,25 @@ class FilemountUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
        /**
         * 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' . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('sys_filemounts'));
+               $relativeFilemounts = $this->db->exec_SELECTgetRows(
+                       '*',
+                       'sys_filemounts',
+                       'base = 1' . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('sys_filemounts')
+               );
                foreach ($relativeFilemounts as $filemount) {
-                       $this->db->exec_UPDATEquery('sys_filemounts', 'uid=' . intval($filemount['uid']), array('base' => $this->storage->getUid(), 'path' => '/' . ltrim($filemount['path'], '/')));
+                       $this->db->exec_UPDATEquery(
+                               'sys_filemounts',
+                               'uid=' . intval($filemount['uid']),
+                               array('base' => $this->storage->getUid(), 'path' => '/' . ltrim($filemount['path'], '/'))
+                       );
                        $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
                }
        }
 
 }
 
-
 ?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/Updates/FlagsFromSpriteUpdate.php b/typo3/sysext/install/Classes/Updates/FlagsFromSpriteUpdate.php
new file mode 100644 (file)
index 0000000..347ec77
--- /dev/null
@@ -0,0 +1,93 @@
+<?php
+namespace TYPO3\CMS\Install\Updates;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010-2013 Ernesto Baschny <ernst@cron-it.de>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Contains the update class for transitioning from ".gif" flags to sprites
+ *
+ * @author Ernesto Baschny <ernst@cron-it.de>
+ */
+class FlagsFromSpriteUpdate extends AbstractUpdate {
+
+       /**
+        * @var string
+        */
+       protected $title = 'Update Graphics, Using Sprites for sys_language Records';
+
+       /**
+        * Checks if an update is needed
+        *
+        * @param string &$description The description for the update
+        * @return boolean Whether an update is needed (TRUE) or not (FALSE)
+        */
+       public function checkForUpdate(&$description) {
+               $result = FALSE;
+               $description = 'Removes the ".gif" suffix from entries in sys_language, because flags now come from a sprite provided by t3skin and not individual .gif files.';
+               if ($this->versionNumber >= 4005000) {
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'sys_language', 'flag LIKE \'%.gif\'', '', '', '1');
+                       if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
+                               $result = TRUE;
+                       }
+                       $GLOBALS['TYPO3_DB']->sql_free_result($res);
+               }
+               return $result;
+       }
+
+       /**
+        * Performs the database update. Changes the flags from ".gif" to flag without suffix
+        *
+        * @param array &$dbQueries Queries done in this update
+        * @param mixed &$customMessages Custom messages
+        * @return boolean Whether it worked (TRUE) or not (FALSE)
+        */
+       public function performUpdate(array &$dbQueries, &$customMessages) {
+               $result = FALSE;
+               if ($this->versionNumber >= 4005000) {
+                       $sql = 'UPDATE sys_language SET flag=REPLACE(flag, \'.gif\', \'\') WHERE flag LIKE \'%.gif\'';
+                       $res = $GLOBALS['TYPO3_DB']->sql_query($sql);
+                       $dbQueries[] = $sql;
+                       if ($GLOBALS['TYPO3_DB']->sql_error()) {
+                               $customMessages = 'SQL-ERROR: ' . htmlspecialchars($GLOBALS['TYPO3_DB']->sql_error());
+                       } else {
+                               $result = TRUE;
+                       }
+                       $sql = 'UPDATE sys_language SET flag=\'multiple\' WHERE flag=\'multi-language\'';
+                       $res = $GLOBALS['TYPO3_DB']->sql_query($sql);
+                       $dbQueries[] = $sql;
+                       if ($GLOBALS['TYPO3_DB']->sql_error()) {
+                               $customMessages = 'SQL-ERROR: ' . htmlspecialchars($GLOBALS['TYPO3_DB']->sql_error());
+                       } else {
+                               $result = TRUE;
+                       }
+               }
+               return $result;
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/Updates/ImagecolsUpdate.php b/typo3/sysext/install/Classes/Updates/ImagecolsUpdate.php
new file mode 100644 (file)
index 0000000..88b8794
--- /dev/null
@@ -0,0 +1,87 @@
+<?php
+namespace TYPO3\CMS\Install\Updates;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008-2013 Steffen Kamper <info@sk-typo3.de>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Contains the update class for merging advanced and normal pagetype.
+ *
+ * @author Steffen Kamper <info@sk-typo3.de>
+ */
+class ImagecolsUpdate extends AbstractUpdate {
+
+       /**
+        * @var string
+        */
+       protected $title = 'Update Existing Text with Image Content Elements';
+
+       /**
+        * Checks if an update is needed
+        *
+        * @param string &$description The description for the update
+        * @return boolean Whether an update is needed (TRUE) or not (FALSE)
+        */
+       public function checkForUpdate(&$description) {
+               $result = FALSE;
+               $description = 'Sets tt_content.imagecols = 1 to all entries having "0". This is needed to have a valid value for imagecols.';
+               if ($this->versionNumber >= 4003000) {
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'tt_content', 'CTYPE IN (\'textpic\', \'image\') AND imagecols=0', '', '', '1');
+                       if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
+                               $result = TRUE;
+                       }
+                       $GLOBALS['TYPO3_DB']->sql_free_result($res);
+               }
+               return $result;
+       }
+
+       /**
+        * Performs the database update. Changes the doktype from 2 (advanced) to 1 (standard)
+        *
+        * @param array &$dbQueries Queries done in this update
+        * @param mixed &$customMessages Custom messages
+        * @return boolean Whether it worked (TRUE) or not (FALSE)
+        */
+       public function performUpdate(array &$dbQueries, &$customMessages) {
+               $result = FALSE;
+               if ($this->versionNumber >= 4003000) {
+                       $updateArray = array(
+                               'imagecols' => 1
+                       );
+                       $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tt_content', 'CTYPE IN (\'textpic\', \'image\') AND imagecols=0', $updateArray);
+                       $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());
+                       } else {
+                               $result = TRUE;
+                       }
+               }
+               return $result;
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/Updates/ImagelinkUpdate.php b/typo3/sysext/install/Classes/Updates/ImagelinkUpdate.php
new file mode 100644 (file)
index 0000000..ba20ecf
--- /dev/null
@@ -0,0 +1,100 @@
+<?php
+namespace TYPO3\CMS\Install\Updates;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2011-2013 Christian Kuhn <lolli@schwarzbu.ch>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Contains the update class to split existing image_link field by comma and
+ * switch to newlines.
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ */
+class ImagelinkUpdate extends AbstractUpdate {
+
+       /**
+        * @var string
+        */
+       protected $title = 'Update Existing image links';
+
+       /**
+        * Checks if an update is needed
+        *
+        * @param string &$description The description for the update
+        * @return boolean TRUE if an update is needed, FALSE otherwise
+        */
+       public function checkForUpdate(&$description) {
+               $description = 'Since TYPO3 4.5 links to images of "Image" and "Text with image" content elements are separated by newline and not by comma anymore. This update converts existing comma separated links to the new form.';
+               $result = FALSE;
+               if ($this->versionNumber >= 4005000) {
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
+                               'uid',
+                               'tt_content',
+                               'image_link<>\'\' AND image_link LIKE \'%,%\' AND image_link NOT LIKE \'%\\n%\'',
+                               '',
+                               '',
+                               '1'
+                       );
+                       if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
+                               $result = TRUE;
+                       }
+                       $GLOBALS['TYPO3_DB']->sql_free_result($res);
+               }
+               return $result;
+       }
+
+       /**
+        * Performs the database update.
+        *
+        * @param array &$dbQueries Queries done in this update
+        * @param mixed &$customMessages Custom messages
+        * @return boolean TRUE on success, FALSE on error
+        */
+       public function performUpdate(array &$dbQueries, &$customMessages) {
+               $result = TRUE;
+               if ($this->versionNumber >= 4005000) {
+                       $affectedRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
+                               'uid, image_link',
+                               'tt_content',
+                               'image_link<>\'\' AND image_link LIKE \'%,%\' AND image_link NOT LIKE \'%\\n%\''
+                       );
+                       foreach ($affectedRows as $row) {
+                               $newImageLink = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $row['image_link']);
+                               $newImageLink = implode(LF, $newImageLink);
+                               $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tt_content', 'uid=' . $row['uid'], array('image_link' => $newImageLink));
+                               $dbQueries[] = str_replace(LF, ' ', $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery);
+                               if ($GLOBALS['TYPO3_DB']->sql_error()) {
+                                       $customMessages = 'SQL-ERROR: ' . htmlspecialchars($GLOBALS['TYPO3_DB']->sql_error());
+                                       $result = $result & FALSE;
+                               }
+                       }
+               }
+               return $result;
+       }
+
+}
+
+?>
\ No newline at end of file
index d95723e..7eb580e 100644 (file)
@@ -23,14 +23,14 @@ namespace TYPO3\CMS\Install\Updates;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+
 /**
  * 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>
- * @license http://www.gnu.org/copyleft/gpl.html
  */
-class InitUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
+class InitUpdateWizard extends AbstractUpdate {
 
        /**
         * @var string
@@ -52,8 +52,8 @@ class InitUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
        /**
         * Checks if an update is needed
         *
-        * @param       string          &$description: The description for the update
-        * @return      boolean         TRUE if an update is needed, FALSE otherwise
+        * @param string &$description The description for the update
+        * @return boolean 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.';
@@ -63,9 +63,9 @@ class InitUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
        /**
         * Performs the database update.
         *
-        * @param       array           &$dbQueries: queries done in this update
-        * @param       mixed           &$customMessages: custom messages
-        * @return      boolean         TRUE on success, FALSE on error
+        * @param array &$dbQueries Queries done in this update
+        * @param mixed &$customMessages Custom messages
+        * @return boolean TRUE on success, FALSE on error
         */
        public function performUpdate(array &$dbQueries, &$customMessages) {
                $updates = $this->getRequiredUpdates();
@@ -100,5 +100,4 @@ class InitUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
 
 }
 
-
 ?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/Updates/InstallSysExtsUpdate.php b/typo3/sysext/install/Classes/Updates/InstallSysExtsUpdate.php
new file mode 100644 (file)
index 0000000..82e0f4a
--- /dev/null
@@ -0,0 +1,348 @@
+<?php
+namespace TYPO3\CMS\Install\Updates;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008-2013 Benjamin Mack <benni@typo3.org>
+ *  (c) 2008-2013 Steffen Kamper <info@sk-typo3.de>
+ *  (c) 2012-2013 Kai Vogel <kai.vogel@speedprogs.de>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Contains the update class for adding new system extensions.
+ *
+ * @author Benjamin Mack <benni@typo3.org>
+ * @author Steffen Kamper <info@sk-typo3.de>
+ * @author Kai Vogel <kai.vogel@speedprogs.de>
+ */
+class InstallSysExtsUpdate extends AbstractUpdate {
+
+       /**
+        * @var string
+        */
+       protected $title = 'Install System Extensions';
+
+       /**
+        * @var array
+        */
+       protected $systemExtensions = array(
+               'info',
+               'perm',
+               'func',
+               'filelist',
+               'about',
+               'cshmanual',
+               'feedit',
+               'opendocs',
+               'recycler',
+               't3editor',
+               'reports',
+               'scheduler',
+               'simulatestatic',
+       );
+
+       /**
+        * @var array
+        */
+       protected $extensionDetails = array(
+               'simulatestatic' => array(
+                       'title' => 'Simulate Static URLs',
+                       'description' => 'Adds the possibility to have Speaking URLs in the TYPO3 Frontend pages.',
+                       'versionString' => '2.0.0',
+               ),
+       );
+
+       /**
+        * @var string
+        */
+       protected $extEmConfPath = 'typo3/sysext/@extensionKey/ext_emconf.php';
+
+       /**
+        * @var string
+        */
+       protected $repositoryUrl = 'http://typo3.org/fileadmin/ter/@filename';
+
+       /**
+        * @var string
+        */
+       protected $informationUrl = 'http://typo3.org/index.php?type=95832&tx_terfe2_pi1%5Baction%5D=show&tx_terfe2_pi1%5Bformat%5D=json&tx_terfe2_pi1%5BextensionKey%5D=@extensionKey';
+
+       /**
+        * @var boolean
+        */
+       protected $updateSuccessful = TRUE;
+
+       /**
+        * Checks if an update is needed
+        *
+        * @param string &$description The description for the update
+        * @return boolean whether an update is needed (TRUE) or not (FALSE)
+        */
+       public function checkForUpdate(&$description) {
+               $description = '
+                       <br />
+                       Uninstalled system extensions have been found.
+                       It is now possible to install them automatically by this upgrade wizard.
+               ';
+
+               if ($this->isWizardDone()) {
+                       return FALSE;
+               }
+
+               foreach ($this->systemExtensions as $extensionKey) {
+                       if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extensionKey)) {
+                               return TRUE;
+                       }
+               }
+
+               return FALSE;
+       }
+
+       /**
+        * Second step: Get user input for installing system extensions
+        *
+        * @param string $inputPrefix input prefix, all names of form fields have to start with this. Append custom name in [ ... ]
+        * @return string HTML output
+        */
+       public function getUserInput($inputPrefix) {
+               $list = '
+                       <p>
+                               Install the following system extensions:
+                       </p>
+                       <fieldset>
+                               <ol class="t3-install-form-label-after">%s</ol>
+                       </fieldset>';
+               $item = '
+                       <li class="labelAfter">
+                               <input type="checkbox" id="%1$s" name="%2$s[sysext][%1$s]" value="1" checked="checked" />
+                               <label for="%1$s"><strong>%3$s [%1$s]</strong><br />%4$s</label>
+                       </li>';
+               $items = array();
+
+               foreach ($this->systemExtensions as $extensionKey) {
+                       if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extensionKey)) {
+                               continue;
+                       }
+                       $extension = $this->getExtensionDetails($extensionKey);
+                       $items[] = sprintf(
+                               $item,
+                               $extensionKey,
+                               $inputPrefix,
+                               htmlspecialchars($extension['title']),
+                               htmlspecialchars($extension['description'])
+                       );
+               }
+
+               return sprintf($list, implode('', $items));
+       }
+
+       /**
+        * Adds the outsourced extensions to the extList in TYPO3_CONF_VARS
+        *
+        * @param array &$dbQueries Queries done in this update
+        * @param mixed &$customMessages Custom messages
+        * @return boolean whether it worked (TRUE) or not (FALSE)
+        */
+       public function performUpdate(array &$dbQueries, &$customMessages) {
+               // Get extension keys that were submitted by the user to be installed and that are valid for this update wizard
+               if (is_array($this->userInput['sysext'])) {
+                       $extArray = array_intersect(
+                               $this->systemExtensions,
+                               array_keys($this->userInput['sysext'])
+                       );
+                       $this->installExtensions($extArray, $customMessages);
+               }
+
+               // Show this wizard again only if new extension keys have been found
+               $this->markWizardAsDone();
+
+               return $this->updateSuccessful;
+       }
+
+       /**
+        * This method can be called to install extensions following all proper processes
+        * (e.g. installing in extList, respecting priority, etc.)
+        *
+        * @param array $extensionKeys List of keys of extensions to install
+        * @param mixed $customMessages
+        * @return void
+        */
+       protected function installExtensions($extensionKeys, &$customMessages) {
+               /** @var $extensionListUtility \TYPO3\CMS\Extensionmanager\Utility\ListUtility */
+               $extensionListUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
+                       'TYPO3\\CMS\\Extensionmanager\\Utility\\ListUtility'
+               );
+
+               /** @var $extensionFileHandlingUtility \TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility */
+               $extensionFileHandlingUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
+                       'TYPO3\\CMS\\Extensionmanager\\Utility\\FileHandlingUtility'
+               );
+               /** @var $objectManager \TYPO3\CMS\Extbase\Object\ObjectManager */
+               $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
+
+               /** @var $extensionInstallUtility \TYPO3\CMS\Extensionmanager\Utility\InstallUtility */
+               $extensionInstallUtility = $objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility');
+
+               /** @var $extensionTerUtility \TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtility */
+               $extensionTerUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
+                       'TYPO3\\CMS\\Extensionmanager\\Utility\\Connection\\TerUtility'
+               );
+               $availableExtensions = $extensionListUtility->getAvailableExtensions();
+               $availableAndInstalledExtensions = $extensionListUtility->getAvailableAndInstalledExtensions($availableExtensions);
+               foreach ($extensionKeys as $extensionKey) {
+                       if (!is_array($availableAndInstalledExtensions[$extensionKey])) {
+                               $extensionDetails = $this->getExtensionDetails($extensionKey);
+                               if (empty($extensionDetails)) {
+                                       $this->updateSuccessful = FALSE;
+                                       $customMessages .= 'No version information for extension ' . $extensionKey . '. Cannot install it.';
+                                       continue;
+                               }
+                               $t3xContent = $this->fetchExtension($extensionKey, $extensionDetails['versionString']);
+                               if (empty($t3xContent)) {
+                                       $this->updateSuccessful = FALSE;
+                                       $customMessages .= 'The extension ' . $extensionKey . ' could not be downloaded.';
+                                       continue;
+                               }
+                               $t3xExtracted = $extensionTerUtility->decodeExchangeData($t3xContent);
+                               if (empty($t3xExtracted) || !is_array($t3xExtracted) || empty($t3xExtracted['extKey'])) {
+                                       $this->updateSuccessful = FALSE;
+                                       $customMessages .= 'The extension ' . $extensionKey . ' could not be extracted.';
+                                       continue;
+                               }
+                               $extensionFileHandlingUtility->unpackExtensionFromExtensionDataArray($t3xExtracted);
+                       }
+                       $extensionInstallUtility->install($extensionKey);
+               }
+       }
+
+       /**
+        * Returns the details of a local or external extension
+        *
+        * @param string $extensionKey Key of the extension to check
+        * @return array Extension details
+        */
+       protected function getExtensionDetails($extensionKey) {
+               // Local extension
+               $extEmConf = PATH_site . str_replace('@extensionKey', $extensionKey, $this->extEmConfPath);
+               if (file_exists($extEmConf)) {
+                       $EM_CONF = FALSE;
+                       require_once($extEmConf);
+                       return reset($EM_CONF);
+               }
+
+               if (array_key_exists($extensionKey, $this->extensionDetails)) {
+                       return $this->extensionDetails[$extensionKey];
+               }
+
+               return array();
+       }
+
+       /**
+        * Fetch extension from repository
+        *
+        * @param string $extensionKey The extension key to fetch
+        * @param string $version The version to fetch
+        * @return string T3X file content
+        */
+       protected function fetchExtension($extensionKey, $version) {
+               if (empty($extensionKey) || empty($version)) {
+                       return '';
+               }
+
+               $filename = $extensionKey[0] . '/' . $extensionKey[1] . '/' . $extensionKey . '_' . $version . '.t3x';
+               $url = str_replace('@filename', $filename, $this->repositoryUrl);
+               return $this->fetchUrl($url);
+       }
+
+       /**
+        * Open an URL and return the response
+        *
+        * This wrapper method is required to try several download methods if
+        * the configuration is not valid or initially written by the installer.
+        *
+        * @param string $url The URL to file
+        * @throws \Exception
+        * @return string File content
+        */
+       protected function fetchUrl($url) {
+               if (empty($url)) {
+                       return NULL;
+               }
+
+               $fileContent = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($url, 0, array(TYPO3_user_agent));
+
+               // No content, force cURL if disabled in configuration but found in system
+               if ($fileContent === FALSE && function_exists('curl_init') && empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlUse'])) {
+                       $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlUse'] = TRUE;
+                       $fileContent = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($url, 0, array(TYPO3_user_agent));
+                       $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlUse'] = FALSE;
+               }
+
+               // Still no content, try file_get_contents if allow_url_fopen is enabled
+               if ($fileContent === FALSE && function_exists('file_get_contents') && ini_get('allow_url_fopen')) {
+                       $fileContent = file_get_contents($url);
+               }
+
+               // Can not fetch url, throw an exception
+               if ($fileContent === FALSE) {
+                       throw new \Exception(
+                               'Can not fetch URL "' . $url . '". Possibile reasons are network problems or misconfiguration.',
+                               1344685036
+                       );
+               }
+
+               return $fileContent;
+       }
+
+       /**
+        * Marks the wizard as being "seen" so that it not shown again until
+        * no new extension keys have been found.
+        *
+        * Writes the info in LocalConfiguration.php
+        *
+        * @return void
+        */
+       protected function markWizardAsDone() {
+               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValueByPath(
+                       'INSTALL/wizardDone/' . get_class($this),
+                       json_encode($this->systemExtensions)
+               );
+       }
+
+       /**
+        * Checks if all extensions have been "seen" before
+        *
+        * @return boolean TRUE if wizard has been done before, FALSE otherwise
+        */
+       protected function isWizardDone() {
+               $wizardClassName = get_class($this);
+               if (!empty($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone'][$wizardClassName])) {
+                       $seenExtensions = json_decode($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone'][$wizardClassName], TRUE);
+                       return count(array_diff($this->systemExtensions, $seenExtensions)) === 0;
+               }
+               return FALSE;
+       }
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/Updates/MediaFlexformUpdate.php b/typo3/sysext/install/Classes/Updates/MediaFlexformUpdate.php
new file mode 100644 (file)
index 0000000..6315e38
--- /dev/null
@@ -0,0 +1,116 @@
+<?php
+namespace TYPO3\CMS\Install\Updates;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012-2013 Steffen Ritter <steffen.ritter@typo3.org>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * 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 integer &$showUpdate 0=dont show update; 1=show update and next button; 2=only show description
+        * @return boolean
+        */
+       public function checkForUpdate(&$description, &$showUpdate = 0) {
+               $mediaElements = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'], '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 boolean Whether the updated was made or not
+        */
+       public function performUpdate(array &$dbQueries, &$customMessages) {
+               $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
+                       'uid,pi_flexform',
+                       $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'],
+                       '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' => intval($width));
+                       }
+                       $height = $sDEF['mmHeight']['vDEF'];
+                       if ($height) {
+                               $data['data']['sGeneral']['lDEF']['mmHeight'] = array('vDEF' => intval($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(
+                               $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'],
+                               'uid = ' . $row['uid'],
+                               array('pi_flexform' => $newXML)
+                       );
+               }
+               return TRUE;
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/Updates/MergeAdvancedUpdate.php b/typo3/sysext/install/Classes/Updates/MergeAdvancedUpdate.php
new file mode 100644 (file)
index 0000000..26ae805
--- /dev/null
@@ -0,0 +1,87 @@
+<?php
+namespace TYPO3\CMS\Install\Updates;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008-2013 Steffen Kamper <info@sk-typo3.de>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Contains the update class for merging advanced and normal pagetype.
+ *
+ * @author Steffen Kamper <info@sk-typo3.de>
+ */
+class MergeAdvancedUpdate extends AbstractUpdate {
+
+       /**
+        * @var string
+        */
+       protected $title = 'Update Pages with Pagetype "Advanced"';
+
+       /**
+        * Checks if an update is needed
+        *
+        * @param string &$description The description for the update
+        * @return boolean whether an update is needed (TRUE) or not (FALSE)
+        */
+       public function checkForUpdate(&$description) {
+               $result = FALSE;
+               $description = 'Merges the "Advanced" pagetype (doktype 2) to "Standard" (doktype 1) because "Standard" now has the same features, and "Advanced" is not needed anymore.';
+               if ($this->versionNumber >= 4002000) {
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'doktype=2', '', '', '1');
+                       if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
+                               $result = TRUE;
+                       }
+                       $GLOBALS['TYPO3_DB']->sql_free_result($res);
+               }
+               return $result;
+       }
+
+       /**
+        * Performs the database update. Changes the doktype from 2 (advanced) to 1 (standard)
+        *
+        * @param array &$dbQueries Queries done in this update
+        * @param mixed &$customMessages Custom messages
+        * @return boolean Whether it worked (TRUE) or not (FALSE)
+        */
+       public function performUpdate(array &$dbQueries, &$customMessages) {
+               $result = FALSE;
+               if ($this->versionNumber >= 4002000) {
+                       $updateArray = array(
+                               'doktype' => 1
+                       );
+                       $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery('pages', 'doktype=2', $updateArray);
+                       $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());
+                       } else {
+                               $result = TRUE;
+                       }
+               }
+               return $result;
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/Updates/MigrateWorkspacesUpdate.php b/typo3/sysext/install/Classes/Updates/MigrateWorkspacesUpdate.php
new file mode 100644 (file)
index 0000000..96307ec
--- /dev/null
@@ -0,0 +1,388 @@
+<?php
+namespace TYPO3\CMS\Install\Updates;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010-2013 Tolleiv Nietsch <info@tolleiv.de>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Migrates workspaces from TYPO3 versions below 4.5.
+ *
+ * @author Tolleiv Nietsch <info@tolleiv.de>
+ */
+class MigrateWorkspacesUpdate extends InstallSysExtsUpdate {
+
+       /**
+        * @var string
+        */
+       protected $title = 'Versioning and Workspaces';
+
+       /**
+        * @var array
+        */
+       public $sqlQueries;
+
+       /**
+        * Checks if an update is needed
+        *
+        * @param string &$description The description for the update, which will be updated with a description of the script's purpose
+        * @return boolean Whether an update is needed (TRUE) or not (FALSE)
+        */
+       public function checkForUpdate(&$description) {
+               $result = FALSE;
+               $description = 'Migrates the old hardcoded draft workspace to be a real workspace record,
+               updates workspace owner fields to support either users or groups and
+               migrates the old-style workspaces with fixed workflow to a custom-stage workflow. If required
+               the extbase, fluid, version and workspaces extensions are installed.';
+               $reason = '';
+               // TYPO3 version 4.5 and above
+               if ($this->versionNumber >= 4005000) {
+                       // If neither version nor workspaces is installed, we're not doing a migration
+                       // Present the user with the choice of activating versioning and workspaces
+                       if (
+                               !\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('version')
+                               && !\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('workspaces')
+                       ) {
+                               $result = TRUE;
+                               // Override the default description
+                               $description = 'Activates the usage of workspaces in your installation. Workspaces let you edit elements
+                                       without the changes being visible on the live web site right away. Modified elements can then go
+                                       through a validation process and eventually be published.<br /><br />';
+                               $description .= 'This wizard will install system extensions "version" and "workspaces" (and may
+                                       install "fluid" and "extbase" too, as they are used by the "workspaces" extension).';
+                       } else {
+                               \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadExtensionTables(FALSE);
+                               if (
+                                       !\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('version')
+                                       || !\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('workspaces')
+                               ) {
+                                       $result = TRUE;
+                                       $reason .= ' Both extensions "version" and "workspaces" need to be
+                                               present to use the entire versioning and workflow featureset of TYPO3.';
+                               }
+                               $tables = array_keys($GLOBALS['TYPO3_DB']->admin_get_tables());
+                               // sys_workspace table might not exists if version extension was never installed
+                               if (!in_array('sys_workspace', $tables) || !in_array('sys_workspace_stage', $tables)) {
+                                       $result = TRUE;
+                                       $reason .= ' The database tables for the workspace functionality are missing.';
+                               } elseif ($this->isOldStyleAdminFieldUsed() || $this->isOldStyleWorkspace()) {
+                                       $wsCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'sys_workspace', '');
+                                       $result |= $wsCount > 0;
+                                       $reason .= ' The existing workspaces will be checked for compatibility with the new features.';
+                               }
+                               $draftWorkspaceTestResult = $this->isDraftWorkspaceUsed();
+                               if ($draftWorkspaceTestResult) {
+                                       $reason .= ' The old style draft workspace is used.
+                                               Related records will be moved into a full featured workspace.';
+                                       $result = TRUE;
+                               }
+                               $description .= '<br /><strong>Why do you need this wizard?</strong><br />' . $reason;
+                       }
+               }
+               return $result;
+       }
+
+       /**
+        * This method requests input from the user about the upgrade process, if needed
+        *
+        * @param string $inputPrefix
+        * @return void
+        */
+       public function getUserInput($inputPrefix) {
+               $content = '';
+               if (
+                       !\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('version')
+                       && !\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('workspaces')
+               ) {
+                       // We need feedback only if versioning is not activated at all
+                       // In such a case we want to leave the user with the choice of not activating the stuff at all
+                       $content = '
+                               <fieldset>
+                                       <ol>
+                       ';
+                       $content .= '
+                               <li class="labelAfter">
+                                       <input type="checkbox" id="versioning" name="' . $inputPrefix . '[versioning]" value="1" checked="checked" />
+                                       <label for="versioning">Activate workspaces?</label>
+                               </li>
+                       ';
+                       $content .= '
+                                       </ol>
+                               </fieldset>
+                       ';
+               } else {
+                       // No feedback needed, just include the update flag as a hidden field
+                       $content = '<input type="hidden" id="versioning" name="' . $inputPrefix . '[versioning]" value="1" />';
+               }
+               return $content;
+       }
+
+       /**
+        * Performs the database update. Changes existing workspaces to use the new custom workspaces
+        *
+        * @param array &$databaseQueries Queries done in this update
+        * @param mixed &$customMessages Custom messages
+        * @return boolean Whether it worked (TRUE) or not (FALSE)
+        */
+       public function performUpdate(array &$databaseQueries, &$customMessages) {
+               $result = TRUE;
+               // TYPO3 version below 4.5
+               if ($this->versionNumber < 4005000) {
+                       return FALSE;
+               }
+               // Wizard skipped by the user
+               if (empty($this->pObj->INSTALL['update']['migrateWorkspaces']['versioning'])) {
+                       return TRUE;
+               }
+               \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadExtensionTables(FALSE);
+               // install version and workspace extension (especially when updating from very old TYPO3 versions
+               $this->installExtensions(array('extbase', 'fluid', 'version', 'workspaces'));
+               // migrate all workspaces to support groups and be_users
+               if ($this->isOldStyleAdminFieldUsed()) {
+                       $this->migrateAdminFieldToNewStyle();
+               }
+               // create a new dedicated "Draft" workspace and move all records to that new workspace
+               if ($this->isDraftWorkspaceUsed()) {
+                       $draftWorkspaceId = $this->createWorkspace();
+                       if (is_integer($draftWorkspaceId)) {
+                               $this->migrateDraftWorkspaceRecordsToWorkspace($draftWorkspaceId);
+                       }
+               }
+               $workspaces = $this->getWorkspacesWithoutStages();
+               $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
+               $label = 'Review';
+               foreach ($workspaces as $workspace) {
+                       // Find all workspaces and add "review" stage record
+                       // Add review users and groups to the new IRRE record
+                       $reviewStageId = $this->createReviewStageForWorkspace($workspace['uid'], $label, $workspace['reviewers']);
+                       // Update all "review" state records in the database to point to the new state
+                       $this->migrateOldRecordsToStage($workspace['uid'], 1, $reviewStageId);
+                       // Update all "ready to publish" records in the database to point to the new ready to publish state
+                       $this->migrateOldRecordsToStage($workspace['uid'], 10, -99);
+               }
+               if (is_array($this->sqlQueries) && is_array($databaseQueries)) {
+                       $databaseQueries = array_merge($databaseQueries, $this->sqlQueries);
+               }
+               return $result;
+       }
+
+       /**
+        * Check if any table contains draft-workspace records
+        *
+        * @return boolean
+        */
+       protected function isDraftWorkspaceUsed() {
+               $foundDraftRecords = FALSE;
+               $tables = array_keys($GLOBALS['TCA']);
+               foreach ($tables as $table) {
+                       if (is_array($GLOBALS['TCA'][$table])) {
+                               $versioningVer = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($GLOBALS['TCA'][$table]['ctrl']['versioningWS'], 0, 2, 0);
+                               if ($versioningVer > 0) {
+                                       if ($this->hasElementsOnWorkspace($table, -1)) {
+                                               $foundDraftRecords = TRUE;
+                                               break;
+                                       }
+                               }
+                       }
+               }
+               return $foundDraftRecords;
+       }
+
+       /**
+        * Find workspaces which have no sys_workspace_state(s) but have records using states
+        *
+        * @return boolean
+        */
+       protected function isOldStyleWorkspace() {
+               $foundOldStyleStages = FALSE;
+               $workspaces = $this->getWorkspacesWithoutStages();
+               $workspacesWithReviewers = 0;
+               $workspaceUids = array();
+               foreach ($workspaces as $workspace) {
+                       $workspaceUids[] = $workspace['uid'];
+                       if ($workspace['reviewers']) {
+                               $workspacesWithReviewers++;
+                       }
+               }
+               if (!$workspacesWithReviewers && !empty($workspaceUids)) {
+                       $tables = array_keys($GLOBALS['TCA']);
+                       foreach ($tables as $table) {
+                               $versioningVer = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($GLOBALS['TCA'][$table]['ctrl']['versioningWS'], 0, 2, 0);
+                               if ($versioningVer > 0) {
+                                       $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', $table, 't3ver_wsid IN (' . implode(',', $workspaceUids) . ') AND t3ver_stage IN (-1,1,10) AND pid = -1');
+                                       if ($count > 0) {
+                                               $foundOldStyleStages = TRUE;
+                                               break;
+                                       }
+                               }
+                       }
+               }
+               return $foundOldStyleStages || $workspacesWithReviewers;
+       }
+
+       /**
+        * Create a new stage for the given workspace
+        *
+        * @param integer Workspace ID
+        * @param string The label of the new stage
+        * @param string The users or groups which are authorized for that stage
+        * @return integer The id of the new stage
+        */
+       protected function createReviewStageForWorkspace($workspaceId, $stageLabel, $stageMembers) {
+               $data = array(
+                       'parentid' => $workspaceId,
+                       'parenttable' => 'sys_workspace',
+                       'title' => $stageLabel,
+                       'responsible_persons' => $stageMembers
+               );
+               $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_workspace_stage', $data);
+               $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
+               return $GLOBALS['TYPO3_DB']->sql_insert_id();
+       }
+
+       /**
+        * Updates the stages of placeholder records within the given workspace from $oldId to $newId
+        *
+        * @param integer Workspace ID
+        * @param integer Old stage od
+        * @param integer New stage od
+        * @return void
+        */
+       protected function migrateOldRecordsToStage($workspaceId, $oldStageId, $newStageId) {
+               $tables = array_keys($GLOBALS['TCA']);
+               $where = 't3ver_wsid = ' . intval($workspaceId) . ' AND t3ver_stage = ' . intval($oldStageId) . ' AND pid = -1';
+               $values = array(
+                       't3ver_stage' => intval($newStageId)
+               );
+               foreach ($tables as $table) {
+                       $versioningVer = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($GLOBALS['TCA'][$table]['ctrl']['versioningWS'], 0, 2, 0);
+                       if ($versioningVer > 0) {
+                               $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, $where, $values);
+                               $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
+                       }
+               }
+       }
+
+       /**
+        * Check if there's any workspace which doesn't support the new admin-field format yet
+        *
+        * @return boolean
+        */
+       protected function isOldStyleAdminFieldUsed() {
+               $where = 'adminusers != "" AND adminusers NOT LIKE "%be_users%" AND adminusers NOT LIKE "%be_groups%" AND deleted=0';
+               $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'sys_workspace', $where);
+               $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
+               return $count > 0;
+       }
+
+       /**
+        * Create a real workspace named "Draft"
+        *
+        * @return integer
+        */
+       protected function createWorkspace() {
+               // @todo who are the reviewers and owners for this workspace?
+               // In previous versions this was defined in be_groups/be_users with the setting "Edit in Draft"
+               $data = array(
+                       'title' => 'Draft'
+               );
+               $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_workspace', $data);
+               $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
+               return $GLOBALS['TYPO3_DB']->sql_insert_id();
+       }
+
+       /**
+        * Migrates all elements from the old draft workspace to the new one.
+        *
+        * @param integer $wsId
+        * @return void
+        */
+       protected function migrateDraftWorkspaceRecordsToWorkspace($wsId) {
+               $tables = array_keys($GLOBALS['TCA']);
+               $where = 't3ver_wsid=-1';
+               $values = array(
+                       't3ver_wsid' => intval($wsId)
+               );
+               foreach ($tables as $table) {
+                       $versioningVer = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($GLOBALS['TCA'][$table]['ctrl']['versioningWS'], 0, 2, 0);
+                       if ($versioningVer > 0 && $this->hasElementsOnWorkspace($table, -1)) {
+                               $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, $where, $values);
+                               $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
+                       }
+               }
+       }
+
+       /**
+        * Migrate all workspace adminusers fields to support groups aswell,
+        * this means that the old comma separated list of uids (referring to be_users)
+        * is updated to be a list of uids with the tablename as prefix
+        *
+        * @return void
+        */
+       protected function migrateAdminFieldToNewStyle() {
+               $where = 'adminusers != "" AND adminusers NOT LIKE "%be_users%" AND adminusers NOT LIKE "%be_groups%" AND deleted=0';
+               $workspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid, adminusers', 'sys_workspace', $where);
+               $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
+               foreach ($workspaces as $workspace) {
+                       $updateArray = array(
+                               'adminusers' => 'be_users_' . implode(',be_users_', \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $workspace['adminusers'], TRUE))
+                       );
+                       $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_workspace', 'uid = ' . $workspace['uid'], $updateArray);
+                       $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
+               }
+       }
+
+       /**
+        * Determines whether a table has elements in a particular workspace.
+        *
+        * @param string $table Name of the table
+        * @param integer $workspaceId Id of the workspace
+        * @return boolean
+        */
+       protected function hasElementsOnWorkspace($table, $workspaceId) {
+               $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', $table, 't3ver_wsid=' . intval($workspaceId));
+               $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
+               return $count > 0;
+       }
+
+       /**
+        * Returns all sys_workspace records which are not referenced by any sys_workspace_stages record
+        *
+        * @return array
+        */
+       protected function getWorkspacesWithoutStages() {
+               $stages = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('parentid', 'sys_workspace_stage', 'parenttable=\'sys_workspace\'');
+               $wsWhitelist = array();
+               foreach ($stages as $stage) {
+                       $wsWhitelist[] = $stage['parentid'];
+               }
+               $where = 'deleted=0';
+               $where .= !empty($wsWhitelist) ? ' AND uid NOT IN (' . implode(',', $wsWhitelist) . ')' : '';
+               return $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_workspace', $where);
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/Updates/NotInMenuUpdate.php b/typo3/sysext/install/Classes/Updates/NotInMenuUpdate.php
new file mode 100644 (file)
index 0000000..4a43408
--- /dev/null
@@ -0,0 +1,90 @@
+<?php
+namespace TYPO3\CMS\Install\Updates;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 1999-2013 Sebastian Kurfürst <sebastian@garbage-group.de>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Contains the update class for not in menu pages.
+ * Used by the update wizard in the install tool.
+ *
+ * @author Sebastian Kurfürst <sebastian@garbage-group.de>
+ * @author Steffen Kamper <info@sk-typo3.de>
+ */
+class NotInMenuUpdate extends AbstractUpdate {
+
+       /**
+        * @var string
+        */
+       protected $title = 'Update Pages with Doktype "Not in menu"';
+
+       /**
+        * Checks if an update is needed
+        *
+        * @param string &$description The description for the update
+        * @return boolean Whether an update is needed (TRUE) or not (FALSE)
+        */
+       public function checkForUpdate(&$description) {
+               $result = FALSE;
+               $description = 'Removes the deprecated pages doktype "Not in menu". It sets the successing flag "Not in menu" for the corresponding pages instead.';
+               if ($this->versionNumber >= 4002000) {
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'doktype=5', '', '', '1');
+                       if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
+                               $result = TRUE;
+                       }
+                       $GLOBALS['TYPO3_DB']->sql_free_result($res);
+               }
+               return $result;
+       }
+
+       /**
+        * Performs the database update. Changes the doktype from 5 ("not in menu") to 1 (standard) and sets the "nav_hide" flag to 1
+        *
+        * @param array &$dbQueries Queries done in this update
+        * @param mixed &$customMessages Custom messages
+        * @return boolean Whether it worked (TRUE) or not (FALSE)
+        */
+       public function performUpdate(array &$dbQueries, &$customMessages) {
+               $result = FALSE;
+               if ($this->versionNumber >= 4002000) {
+                       $updateArray = array(
+                               'doktype' => 1,
+                               'nav_hide' => 1
+                       );
+                       $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery('pages', 'doktype=5', $updateArray);
+                       $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());
+                       } else {
+                               $result = TRUE;
+                       }
+               }
+               return $result;
+       }
+
+}
+
+?>
\ No newline at end of file
index 01e145c..831f25d 100644 (file)
@@ -23,6 +23,7 @@ namespace TYPO3\CMS\Install\Updates;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+
 /**
  * Performs certain DB updates in order to ensure that the DB fields
  * are set properly. Currently this is used for ensuring that there
@@ -30,9 +31,8 @@ namespace TYPO3\CMS\Install\Updates;
  * parent records (e.g. a tt_content record) are not on PID=0
  *
  * @author Benni Mack <benni@typo3.org>
- * @license http://www.gnu.org/copyleft/gpl.html
  */
-class ReferenceIntegrityUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
+class ReferenceIntegrityUpdateWizard extends AbstractUpdate {
 
        /**
         * @var string
@@ -42,8 +42,8 @@ class ReferenceIntegrityUpdateWizard extends \TYPO3\CMS\Install\Updates\Abstract
        /**
         * Checks if an update is needed
         *
-        * @param       string          &$description: The description for the update
-        * @return      boolean         TRUE if an update is needed, FALSE otherwise
+        * @param string &$description The description for the update
+        * @return boolean 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.';
@@ -53,9 +53,9 @@ class ReferenceIntegrityUpdateWizard extends \TYPO3\CMS\Install\Updates\Abstract
        /**
         * Performs the database update.
         *
-        * @param       array           &$dbQueries: queries done in this update
-        * @param       mixed           &$customMessages: custom messages
-        * @return      boolean         TRUE on success, FALSE on error
+        * @param array &$dbQueries Queries done in this update
+        * @param mixed &$customMessages Custom messages
+        * @return boolean TRUE on success, FALSE on error
         */
        public function performUpdate(array &$dbQueries, &$customMessages) {
                $updates = $this->getRequiredUpdates();
@@ -90,7 +90,7 @@ class ReferenceIntegrityUpdateWizard extends \TYPO3\CMS\Install\Updates\Abstract
        }
 
        /**
-        * fetches a list of all sys_file_references that have PID=0
+        * Fetches a list of all sys_file_references that have PID=0
         *
         * @return mixed
         */
@@ -103,7 +103,7 @@ class ReferenceIntegrityUpdateWizard extends \TYPO3\CMS\Install\Updates\Abstract
        }
 
        /**
-        * fetches all sys_file_reference records that are on PID=0 BUT their counter parts (the target record)
+        * Fetches all sys_file_reference records that are on PID=0 BUT their counter parts (the target record)
         * is NOT on pid=0
         *
         * @return array
@@ -138,5 +138,4 @@ class ReferenceIntegrityUpdateWizard extends \TYPO3\CMS\Install\Updates\Abstract
        }
 }
 
-
 ?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/Updates/RootTemplateUpdate.php b/typo3/sysext/install/Classes/Updates/RootTemplateUpdate.php
new file mode 100644 (file)
index 0000000..63ff89b
--- /dev/null
@@ -0,0 +1,165 @@
+<?php
+namespace TYPO3\CMS\Install\Updates;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012-2013 Oliver Hader <oliver.hader@typo3.org>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * 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 integer &$showUpdate 0=dont show update; 1=show update and next button; 2=only show description
+        * @return boolean
+        */
+       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 boolean 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)) {
+                       $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;
+       }
+}
+
+?>
\ No newline at end of file
index 2c5787b..54b524a 100644 (file)
@@ -31,7 +31,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
  *
  * The content string and the reference index (sys_refindex) are updated accordingly.
  */
-class RteFileLinksUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
+class RteFileLinksUpdateWizard extends AbstractUpdate {
 
        /**
         * Title of the update wizard
index a906fe0..a7a6f7f 100644 (file)
@@ -23,6 +23,7 @@ namespace TYPO3\CMS\Install\Updates;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+
 /**
  * Upgrade wizard that moves all RTE magic images (usually in uploads/)
  * that have the prefix RTEmagicC_* to the default storage (usually fileadmin/_migrated/RTE/)
@@ -30,24 +31,23 @@ namespace TYPO3\CMS\Install\Updates;
  * the softreference index
  *
  * @author Benjamin Mack <benni@typo3.org>
- * @license http://www.gnu.org/copyleft/gpl.html
  */
-class RteMagicImagesUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
+class RteMagicImagesUpdateWizard extends AbstractUpdate {
 
        /**
-        * title of the update wizard
+        * Title of the update wizard
         * @var string
         */
        protected $title = 'Migrate all RTE magic images from uploads/RTEmagicC_* to fileadmin/_migrated/RTE/';
 
        /**
-        * the default storage
+        * The default storage
         * @var \TYPO3\CMS\Core\Resource\ResourceStorage
         */
        protected $storage;
 
        /**
-        * the old location of the file name, e.g. "uploads/RTEmagicC_"
+        * The old location of the file name, e.g. "uploads/RTEmagicC_"
         * @var string
         */
        protected $oldPrefix = NULL;
@@ -57,12 +57,15 @@ class RteMagicImagesUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpda
         */
        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_*
+               // Set it to uploads/RTEmagicC_*
                if (!empty($GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir'])) {
                        $this->oldPrefix = $GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir'] . 'RTEmagicC_';
                }
@@ -99,7 +102,7 @@ class RteMagicImagesUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpda
                );
                $description .= $message->render();
 
-               // wizard is only available if oldPrefix set
+               // Wizard is only available if oldPrefix set
                if ($this->oldPrefix) {
                        $oldRecords = $this->findMagicImagesInOldLocation();
                        if (count($oldRecords) > 0) {
@@ -108,7 +111,7 @@ class RteMagicImagesUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpda
                        }
                }
 
-               // disable the update wizard if there are no old RTE magic images
+               // Disable the update wizard if there are no old RTE magic images
                return FALSE;
        }
 
@@ -130,7 +133,7 @@ class RteMagicImagesUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpda
                $targetDirectory = '/_migrated/RTE/';
                $fullTargetDirectory = PATH_site . $fileadminDirectory . $targetDirectory;
 
-               // create the directory, if necessary
+               // Create the directory, if necessary
                if (!is_dir($fullTargetDirectory)) {
                        \TYPO3\CMS\Core\Utility\GeneralUtility::mkdir_deep($fullTargetDirectory);
                }
@@ -139,15 +142,15 @@ class RteMagicImagesUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpda
                $oldRecords = $this->findMagicImagesInOldLocation();
                foreach ($oldRecords as $refRecord) {
 
-                       // is usually uploads/RTE_magicC_123423324.png.png
+                       // Is usually uploads/RTE_magicC_123423324.png.png
                        $sourceFileName     = $refRecord['ref_string'];
-                       // absolute path/filename
+                       // Absolute path/filename
                        $fullSourceFileName = PATH_site . $refRecord['ref_string'];
                        $targetFileName     = $targetDirectory . \TYPO3\CMS\Core\Utility\PathUtility::basename($refRecord['ref_string']);
-                       // full directory
+                       // Full directory
                        $fullTargetFileName = $fullTargetDirectory . \TYPO3\CMS\Core\Utility\PathUtility::basename($refRecord['ref_string']);
 
-                       // if the source file does not exist, we should just continue, but leave a message in the docs;
+                       // 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());
@@ -165,12 +168,16 @@ class RteMagicImagesUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpda
 
                        rename($fullSourceFileName, $fullTargetFileName);
 
-                       // get the File object
+                       // Get the File object
                        $file = $this->storage->getFile($targetFileName);
                        if ($file instanceof \TYPO3\CMS\Core\Resource\File) {
-                               // and now update the referencing field
+                               // And now update the referencing field
                                $targetFieldName = $refRecord['field'];
-                               $targetRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('uid, ' . $targetFieldName, $refRecord['tablename'], 'uid=' . intval($refRecord['recuid']));
+                               $targetRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
+                                       'uid, ' . $targetFieldName,
+                                       $refRecord['tablename'],
+                                       'uid=' . intval($refRecord['recuid'])
+                               );
                                if ($targetRecord) {
                                        // Replace the old filename with the new one, and add data-* attributes used by the RTE
                                        $searchString = 'src="' . $sourceFileName . '"';
@@ -228,5 +235,4 @@ class RteMagicImagesUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpda
 
 }
 
-
-?>
+?>
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/Updates/T3skinUpdate.php b/typo3/sysext/install/Classes/Updates/T3skinUpdate.php
new file mode 100644 (file)
index 0000000..47e4449
--- /dev/null
@@ -0,0 +1,96 @@
+<?php
+namespace TYPO3\CMS\Install\Updates;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010-2013  Steffen Ritter (info@rs-websystems.de)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Contains the update class for not installed t3skin. Used by the update wizard in the install tool.
+ *
+ * @author Steffen Ritter <info@rs-websystems.de>
+ */
+class T3skinUpdate extends AbstractUpdate {
+
+       /**
+        * @var string
+        */
+       protected $title = 'Install the new TYPO3 Skin "t3skin"';
+
+       /**
+        * Checks if t3skin is not installed.
+        *
+        * @param string &$description The description for the update
+        * @return boolean Whether an update is needed (TRUE) or not (FALSE)
+        */
+       public function checkForUpdate(&$description) {
+               $result = FALSE;
+               $description[] = '<strong>The backend skin "t3skin" is not loaded.</strong>
+               TYPO3 4.4 introduced many changes in backend skinning and old backend skins are now incompatible.
+               <strong>Without "t3skin" the backend may be unusable.</strong> Install extension "t3skin".';
+               if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('t3skin')) {
+                       $result = TRUE;
+               }
+               return $result;
+       }
+
+       /**
+        * second step: get user info
+        *
+        * @param string Input prefix, all names of form fields have to start with this. Append custom name in [ ... ]
+        * @return string HTML output
+        */
+       public function getUserInput($inputPrefix) {
+               $content = '<strong>Install the system extension</strong><br />You are about to install the extension "t3skin".';
+               return $content;
+       }
+
+       /**
+        * performs the action of the UpdateManager
+        *
+        * @param array &$dbQueries Queries done in this update
+        * @param mixed &$customMessages Custom messages
+        * @return boolean Whether everything went smoothly or not
+        */
+       public function performUpdate(array &$dbQueries, &$customMessages) {
+               $result = FALSE;
+               if ($this->versionNumber >= 4004000 && !\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('t3skin')) {
+                       // check wether the table can be truncated or if sysext with tca has to be installed
+                       if ($this->checkForUpdate($customMessages)) {
+                               try {
+                                       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::loadExtension('t3skin');
+                                       $customMessages = 'The system extension "t3skin" was successfully loaded.';
+                                       $result = TRUE;
+                               } catch (\RuntimeException $e) {
+                                       $result = FALSE;
+                               }
+                       }
+               }
+               return $result;
+       }
+
+}
+
+?>
\ No newline at end of file
index 6350f7c..38990af 100644 (file)
@@ -23,19 +23,16 @@ namespace TYPO3\CMS\Install\Updates;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * 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>
- * @license http://www.gnu.org/copyleft/gpl.html
- */
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-
-/**
- * Updates TCEform references from direct file relations to FAL.
  */
-class TceformsUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
+class TceformsUpdateWizard extends AbstractUpdate {
 
        /**
         * @var string
@@ -52,6 +49,9 @@ class TceformsUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
         */
        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');
@@ -71,21 +71,21 @@ class TceformsUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
        /**
         * Checks if an update is needed
         *
-        * @param       string          &$description: The description for the update
-        * @return      boolean         TRUE if an update is needed, FALSE otherwise
+        * @param string &$description The description for the update
+        * @return boolean 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 filed 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.';
-               // make this wizard always available
+               // Make this wizard always available
                return TRUE;
        }
 
        /**
         * Performs the database update.
         *
-        * @param       array           &$dbQueries: queries done in this update
-        * @param       mixed           &$customMessages: custom messages
-        * @return      boolean         TRUE on success, FALSE on error
+        * @param array &$dbQueries Queries done in this update
+        * @param mixed &$customMessages Custom messages
+        * @return boolean TRUE on success, FALSE on error
         */
        public function performUpdate(array &$dbQueries, &$customMessages) {
                $this->init();
@@ -170,6 +170,13 @@ class TceformsUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
                return $result;
        }
 
+       /**
+        * Get records from table
+        *
+        * @param string $table
+        * @param array $relationFields
+        * @return array
+        */
        protected function getRecordsFromTable($table, $relationFields) {
                $fields = implode(',', array_merge($relationFields, array('uid', 'pid')));
                $records = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($fields, $table, '');
@@ -280,5 +287,4 @@ class TceformsUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
 
 }
 
-
-?>
+?>
\ No newline at end of file
index 4c49986..a37ed1d 100644 (file)
@@ -23,16 +23,17 @@ namespace TYPO3\CMS\Install\Updates;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+
 /**
  * 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>
- * @license http://www.gnu.org/copyleft/gpl.html
  */
-class TtContentUploadsUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
+class TtContentUploadsUpdateWizard extends AbstractUpdate {
 
        const FOLDER_ContentUploads = '_migrated/content_uploads';
+
        /**
         * @var string
         */
@@ -89,15 +90,19 @@ class TtContentUploadsUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUp
        /**
         * Checks if an update is needed
         *
-        * @param       string          &$description: The description for the update
-        * @return      boolean         TRUE if an update is needed, FALSE otherwise
+        * @param string &$description The description for the update
+        * @return boolean 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)
-               $notMigratedRowsCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'tt_content', 'media <> \'\' AND CAST(CAST(media AS DECIMAL) AS CHAR) <> media OR (CType = \'uploads\' AND select_key != \'\')');
+               $notMigratedRowsCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows(
+                       'uid',
+                       'tt_content',
+                       'media <> \'\' AND CAST(CAST(media AS DECIMAL) AS CHAR) <> media OR (CType = \'uploads\' AND select_key != \'\')'
+               );
                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;
@@ -108,9 +113,9 @@ class TtContentUploadsUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUp
        /**
         * Performs the database update.
         *
-        * @param       array           &$dbQueries: queries done in this update
-        * @param       mixed           &$customMessages: custom messages
-        * @return      boolean         TRUE on success, FALSE on error
+        * @param array &$dbQueries Queries done in this update
+        * @param mixed &$customMessages Custom messages
+        * @return boolean TRUE on success, FALSE on error
         */
        public function performUpdate(array &$dbQueries, &$customMessages) {
                $this->init();
@@ -211,11 +216,13 @@ class TtContentUploadsUpdateWizard extends \TYPO3\CMS\Install\Updates\AbstractUp
         */
        protected function getRecordsFromTable() {
                $fields = implode(',', array('uid', 'pid', 'select_key', 'media', 'imagecaption', 'titleText'));
-               $records = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($fields, 'tt_content', 'media <> \'\' AND CAST(CAST(media AS DECIMAL) AS CHAR) <> media OR (CType = \'uploads\' AND select_key != \'\')');
+               $records = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
+                       $fields,
+                       'tt_content', 'media <> \'\' AND CAST(CAST(media AS DECIMAL) AS CHAR) <> media OR (CType = \'uploads\' AND select_key != \'\')'
+               );
                return $records;
        }
 
 }
 
-
 ?>
\ No newline at end of file
index ec39175..991b19d 100644 (file)
@@ -3,47 +3,47 @@ if (!defined('TYPO3_MODE')) {
        die('Access denied.');
 }
 // TYPO3 6.0 - Create page and TypoScript root template (automatically executed in 123-mode)
-$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['rootTemplate'] = 'TYPO3\\CMS\\Install\\CoreUpdates\\RootTemplateUpdate';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['rootTemplate'] = 'TYPO3\\CMS\\Install\\Updates\\RootTemplateUpdate';
 // TYPO3 4.5 - Check the database to be utf-8 compliant
-$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['charsetDefaults'] = 'TYPO3\\CMS\\Install\\CoreUpdates\\CharsetDefaultsUpdate';
-$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['changeCompatibilityVersion'] = 'TYPO3\\CMS\\Install\\CoreUpdates\\CompatVersionUpdate';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['charsetDefaults'] = 'TYPO3\\CMS\\Install\\Updates\\CharsetDefaultsUpdate';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['changeCompatibilityVersion'] = 'TYPO3\\CMS\\Install\\Updates\\CompatVersionUpdate';
 // manage split includes of css_styled_contents since TYPO3 4.3
-$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['splitCscToMultipleTemplates'] = 'TYPO3\\CMS\\Install\\CoreUpdates\\CscSplitUpdate';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['splitCscToMultipleTemplates'] = 'TYPO3\\CMS\\Install\\Updates\\CscSplitUpdate';
 // remove pagetype "not in menu" since TYPO3 4.2
 // as there is an option in every pagetype
-$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['removeNotInMenuDoktypeConversion'] = 'TYPO3\\CMS\\Install\\CoreUpdates\\NotInMenuUpdate';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['removeNotInMenuDoktypeConversion'] = 'TYPO3\\CMS\\Install\\Updates\\NotInMenuUpdate';
 // remove pagetype "advanced" since TYPO3 4.2
 // this is merged with doctype "standard" with tab view to edit
-$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['mergeAdvancedDoktypeConversion'] = 'TYPO3\\CMS\\Install\\CoreUpdates\\MergeAdvancedUpdate';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['mergeAdvancedDoktypeConversion'] = 'TYPO3\\CMS\\Install\\Updates\\MergeAdvancedUpdate';
 // TYPO3 6.0 - Add new tables for ExtensionManager
-$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['extensionManagerTables'] = 'TYPO3\\CMS\\Install\\CoreUpdates\\ExtensionManagerTables';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['extensionManagerTables'] = 'TYPO3\\CMS\\Install\\Updates\\ExtensionManagerTables';
 // add new / outsourced system extensions since TYPO3 4.3
-$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['installSystemExtensions'] = 'TYPO3\\CMS\\Install\\CoreUpdates\\InstallSysExtsUpdate';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['installSystemExtensions'] = 'TYPO3\\CMS\\Install\\Updates\\InstallSysExtsUpdate';
 // change tt_content.imagecols=0 to 1 for proper display in TCEforms since TYPO3 4.3
-$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['changeImagecolsValue'] = 'TYPO3\\CMS\\Install\\CoreUpdates\\ImagecolsUpdate';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['changeImagecolsValue'] = 'TYPO3\\CMS\\Install\\Updates\\ImagecolsUpdate';
 // warn for t3skin installed in Version 4.4
-$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['checkForT3SkinInstalled'] = 'TYPO3\\CMS\\Install\\CoreUpdates\\T3skinUpdate';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['checkForT3SkinInstalled'] = 'TYPO3\\CMS\\Install\\Updates\\T3skinUpdate';
 // Version 4.4: warn for set CompressionLevel and warn user to update his .htaccess
-$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['checkForCompressionLevel'] = 'TYPO3\\CMS\\Install\\CoreUpdates\\CompressionLevelUpdate';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['checkForCompressionLevel'] = 'TYPO3\\CMS\\Install\\Updates\\CompressionLevelUpdate';
 // Version 4.5: migrate workspaces to use custom stages and install the required extensions
-$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['migrateWorkspaces'] = 'TYPO3\\CMS\\Install\\CoreUpdates\\MigrateWorkspacesUpdate';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['migrateWorkspaces'] = 'TYPO3\\CMS\\Install\\Updates\\MigrateWorkspacesUpdate';
 // Version 4.5: Removes the ".gif" suffix from entries in sys_language
-$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['flagsFromSprites'] = 'TYPO3\\CMS\\Install\\CoreUpdates\\FlagsFromSpriteUpdate';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['flagsFromSprites'] = 'TYPO3\\CMS\\Install\\Updates\\FlagsFromSpriteUpdate';
 // Version 4.5: Adds excludeable FlexForm fields to Backend group access lists (ACL)
-$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['addFlexformsToAcl'] = 'TYPO3\\CMS\\Install\\CoreUpdates\\AddFlexFormsToAclUpdate';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['addFlexformsToAcl'] = 'TYPO3\\CMS\\Install\\Updates\\AddFlexFormsToAclUpdate';
 // Version 4.5: Split tt_content image_link to newline by comma
-$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['imagelink'] = 'TYPO3\\CMS\\Install\\CoreUpdates\\ImagelinkUpdate';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['imagelink'] = 'TYPO3\\CMS\\Install\\Updates\\ImagelinkUpdate';
 // 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.
-$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['sysext_file_init'] = 'TYPO3\\CMS\\Install\\Updates\\InitUpdateWizard';
-$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['sysext_file_images'] = 'TYPO3\\CMS\\Install\\Updates\\TceformsUpdateWizard';
-$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['sysext_file_uploads'] = 'TYPO3\\CMS\\Install\\Updates\\TtContentUploadsUpdateWizard';
-$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_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']['referenceIntegrity'] = 'TYPO3\\CMS\\Install\\Updates\\ReferenceIntegrityUpdateWizard';
 
-$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['sysext_file_filemounts'] = 'TYPO3\\CMS\\Install\\Updates\\FilemountUpdateWizard';
-$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['sysext_file_rtemagicimages'] = 'TYPO3\\CMS\\Install\\Updates\\RteMagicImagesUpdateWizard';
-$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['sysext_file_rtefilelinks'] = 'TYPO3\\CMS\\Install\\Updates\\RteFileLinksUpdateWizard';
+$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']['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';
 
 // Version 4.7: Migrate the flexforms of MediaElement
-$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['mediaElementFlexform'] = 'TYPO3\\CMS\\Install\\CoreUpdates\\MediaFlexformUpdate';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['mediaElementFlexform'] = 'TYPO3\\CMS\\Install\\Updates\\MediaFlexformUpdate';
 ?>
\ No newline at end of file