[BUGFIX] FailsafePackageManager: do not prevent package sorting 16/58416/2
authorBenjamin Franzke <bfr@qbus.de>
Thu, 27 Sep 2018 18:10:27 +0000 (20:10 +0200)
committerSusanne Moog <susanne.moog@typo3.org>
Fri, 28 Sep 2018 10:33:14 +0000 (12:33 +0200)
FailsafePackageManager prevents saving PackageStates.php in
failsafe mode by overwriting sortAndSavePackageStates(). That works
to prevent saving, but also prevents sorting when initially loading
packages when PackageStates.php is missing.

Currently this does not really produce problems, as the install
tool creates a new PackageStates.php later on and saves (and
implicitly sorts them) using forceSortAndPackageStates().

To fix the intermediate state we now only prevent saving,
but not the sorting of packages.

Releases: master
Resolves: #86408
Change-Id: I02ccb20653700e696d89b0a6ff39253f4f1ebc73
Reviewed-on: https://review.typo3.org/58416
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/core/Classes/Package/FailsafePackageManager.php
typo3/sysext/core/Classes/Package/PackageManager.php

index b66bf08..2dc93c0 100644 (file)
@@ -42,13 +42,13 @@ class FailsafePackageManager extends PackageManager
     }
 
     /**
-     * Sort and save states
+     * Save states
      */
-    protected function sortAndSavePackageStates()
+    protected function savePackageStates()
     {
         // Do not save if in rescue mode
         if (!$this->inFailsafeMode) {
-            parent::sortAndSavePackageStates();
+            parent::savePackageStates();
         }
     }
 
@@ -58,6 +58,7 @@ class FailsafePackageManager extends PackageManager
      */
     public function forceSortAndSavePackageStates()
     {
-        parent::sortAndSavePackageStates();
+        parent::sortActivePackagesByDependencies();
+        parent::savePackageStates();
     }
 }
index b882b80..73bc906 100644 (file)
@@ -769,10 +769,8 @@ class PackageManager implements SingletonInterface
      *
      * @throws Exception\PackageStatesFileNotWritableException
      */
-    protected function sortAndSavePackageStates()
+    protected function savePackageStates()
     {
-        $this->sortActivePackagesByDependencies();
-
         $this->packageStatesConfiguration['version'] = 5;
 
         $fileDescription = "# PackageStates.php\n\n";
@@ -802,6 +800,18 @@ class PackageManager implements SingletonInterface
     }
 
     /**
+     * Saves the current content of $this->packageStatesConfiguration to the
+     * PackageStates.php file.
+     *
+     * @throws Exception\PackageStatesFileNotWritableException
+     */
+    protected function sortAndSavePackageStates()
+    {
+        $this->sortActivePackagesByDependencies();
+        $this->savePackageStates();
+    }
+
+    /**
      * Check the conformance of the given package key
      *
      * @param string $packageKey The package key to validate