[BUGFIX] Do not show System Extensions Wizard when done
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Classes / CoreUpdates / InstallSysExtsUpdate.php
index c952a3f..bee09a6 100644 (file)
@@ -4,9 +4,9 @@ namespace TYPO3\CMS\Install\CoreUpdates;
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2008-2011 Benjamin Mack <benni@typo3.org>
- *  (c) 2008-2011 Steffen Kamper <info@sk-typo3.de>
- *  (c) 2012 Kai Vogel <kai.vogel@speedprogs.de>
+ *  (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
@@ -58,6 +58,18 @@ class InstallSysExtsUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
                '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',
+               ),
        );
 
        /**
@@ -98,7 +110,7 @@ class InstallSysExtsUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
                }
 
                foreach ($this->systemExtensions as $extensionKey) {
-                       if (!\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded($extensionKey)) {
+                       if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extensionKey)) {
                                return TRUE;
                        }
                }
@@ -128,7 +140,7 @@ class InstallSysExtsUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
                $items = array();
 
                foreach ($this->systemExtensions as $extensionKey) {
-                       if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded($extensionKey)) {
+                       if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extensionKey)) {
                                continue;
                        }
                        $extension = $this->getExtensionDetails($extensionKey);
@@ -153,10 +165,10 @@ class InstallSysExtsUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
         */
        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->pObj->INSTALL['update']['installSystemExtensions']['sysext'])) {
+               if (is_array($this->userInput['sysext'])) {
                        $extArray = array_intersect(
                                $this->systemExtensions,
-                               array_keys($this->pObj->INSTALL['update']['installSystemExtensions']['sysext'])
+                               array_keys($this->userInput['sysext'])
                        );
                        $this->installExtensions($extArray, $customMessages);
                }
@@ -200,6 +212,11 @@ class InstallSysExtsUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
                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;
@@ -233,11 +250,8 @@ class InstallSysExtsUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
                        return reset($EM_CONF);
                }
 
-                       // Repository extension
-               $url = str_replace('@extensionKey', $extensionKey, $this->informationUrl);
-               $jsonResponse = $this->fetchUrl($url);
-               if (!empty($jsonResponse) && is_string($jsonResponse)) {
-                       return json_decode($jsonResponse, TRUE);
+               if (array_key_exists($extensionKey, $this->extensionDetails)) {
+                       return $this->extensionDetails[$extensionKey];
                }
 
                return array();
@@ -309,7 +323,7 @@ class InstallSysExtsUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
         * @return void
         */
        protected function markWizardAsDone() {
-               \TYPO3\CMS\Core\Configuration\ConfigurationManager::setLocalConfigurationValueByPath(
+               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValueByPath(
                        'INSTALL/wizardDone/' . get_class($this),
                        json_encode($this->systemExtensions)
                );
@@ -324,7 +338,7 @@ class InstallSysExtsUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
                $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 (bool) array_diff($this->systemExtensions, $seenExtensions);
+                       return count(array_diff($this->systemExtensions, $seenExtensions)) === 0;
                }
                return FALSE;
        }