[BUGFIX] Removed extension stays in PackageStates file 21/26921/4
authorWouter Wolters <typo3@wouterwolters.nl>
Sat, 18 Jan 2014 14:57:05 +0000 (15:57 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 3 May 2014 17:13:48 +0000 (19:13 +0200)
Deleting an extension in the Extension Manager doesn't delete
the entry in PackageStates file.

Use the package manager to delete the extension. This will take care of
linked extensions (just remove the link) too.
The package manager will take care to remove the entry from the
PackageStates file.

If an extension is not listed in the PackageStates file (e.g. because
we uploaded it via FTP and forgot to clear the system caches),
directly remove the folder.

Resolves: #53459
Releases: 6.2
Change-Id: I10d5ef33ccf6438fece512478408c57d5d7486de
Reviewed-on: https://review.typo3.org/26921
Reviewed-by: Jan Runte
Tested-by: Jan Runte
Reviewed-by: Helmut Hummel
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/extensionmanager/Classes/Controller/ActionController.php
typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php

index 396fa62..d01c363 100644 (file)
@@ -95,9 +95,6 @@ class ActionController extends AbstractController {
                $success = TRUE;
                $message = '';
                try {
-                       if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extension)) {
-                               $this->installUtility->uninstall($extension);
-                       }
                        $this->installUtility->removeExtension($extension);
                } catch (\TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException $e) {
                        $message = $e->getMessage();
index 6c5316f..9a95c7a 100644 (file)
@@ -363,7 +363,13 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface {
        public function removeExtension($extension) {
                $absolutePath = $this->fileHandlingUtility->getAbsoluteExtensionPath($extension);
                if ($this->fileHandlingUtility->isValidExtensionPath($absolutePath)) {
-                       $this->fileHandlingUtility->removeDirectory($absolutePath);
+                       if ($this->packageManager->isPackageAvailable($extension)) {
+                               // Package manager deletes the extension and removes the entry from PackageStates.php
+                               $this->packageManager->deletePackage($extension);
+                       } else {
+                               // The extension is not listed in PackageStates.php, we can safely remove it
+                               $this->fileHandlingUtility->removeDirectory($absolutePath);
+                       }
                } else {
                        throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException('No valid extension path given.', 1342875724);
                }