[TASK] Provide upgradeWizard to enable adminPanel 19/56519/4
authorSusanne Moog <susanne.moog@typo3.org>
Tue, 3 Apr 2018 13:27:15 +0000 (15:27 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Wed, 4 Apr 2018 12:44:07 +0000 (14:44 +0200)
The adminpanel has been extracted to an own extension
which should be installed on upgrading to get the same
behaviour as pre-extraction.

Resolves: #84583
Releases: master
Change-Id: Ic536dc75af205ff3e7c7d261f2371fc56169cf9b
Reviewed-on: https://review.typo3.org/56519
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/install/Classes/Updates/AdminPanelInstall.php [new file with mode: 0644]
typo3/sysext/install/ext_localconf.php

diff --git a/typo3/sysext/install/Classes/Updates/AdminPanelInstall.php b/typo3/sysext/install/Classes/Updates/AdminPanelInstall.php
new file mode 100644 (file)
index 0000000..8239285
--- /dev/null
@@ -0,0 +1,81 @@
+<?php
+declare(strict_types=1);
+
+namespace TYPO3\CMS\Install\Updates;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Extbase\Object\ObjectManager;
+use TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException;
+use TYPO3\CMS\Extensionmanager\Utility\InstallUtility;
+
+/**
+ * Installs EXT:adminpanel
+ */
+class AdminPanelInstall extends AbstractUpdate
+{
+    /**
+     * @var string
+     */
+    protected $title = 'Install extension "adminpanel"';
+
+    /**
+     * @var string
+     */
+    protected $extensionKey = 'adminpanel';
+
+    /**
+     * Checks if an update is needed
+     *
+     * @param string $description The description for the update
+     * @return bool Whether an update is needed (true) or not (false)
+     */
+    public function checkForUpdate(&$description): bool
+    {
+        $description = 'The TYPO3 admin panel was extracted to an own extension. This update installs the extension.';
+
+        if (ExtensionManagementUtility::isLoaded('adminpanel')) {
+            $this->markWizardAsDone();
+        }
+
+        $updateNeeded = false;
+        if (!$this->isWizardDone()) {
+            $updateNeeded = true;
+        }
+        return $updateNeeded;
+    }
+
+    /**
+     * Performs the update
+     *
+     * @param array $databaseQueries Queries done in this update
+     * @param string $customMessage Custom message
+     * @return bool
+     */
+    public function performUpdate(array &$databaseQueries, &$customMessage): bool
+    {
+        $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
+        $extensionInstallUtility = $objectManager->get(InstallUtility::class);
+        try {
+            $extensionInstallUtility->install('adminpanel');
+            $updateSuccessful = true;
+            $this->markWizardAsDone();
+        } catch (ExtensionManagerException $e) {
+            $updateSuccessful = false;
+        }
+        return $updateSuccessful;
+    }
+}
index 41e79ab..59fc523 100644 (file)
@@ -62,6 +62,8 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['backendLayou
     = \TYPO3\CMS\Install\Updates\BackendLayoutIconUpdateWizard::class;
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['redirects']
     = \TYPO3\CMS\Install\Updates\RedirectsExtensionUpdate::class;
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['adminPanelInstall']
+    = \TYPO3\CMS\Install\Updates\AdminPanelInstall::class;
 
 $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
 $icons = [