[BUGFIX] Add reload parameter for EM List Utility 18/44318/3
authorBenjamin Mack <benni@typo3.org>
Tue, 27 Oct 2015 13:58:43 +0000 (14:58 +0100)
committerBenni Mack <benni@typo3.org>
Wed, 28 Oct 2015 07:29:58 +0000 (08:29 +0100)
If the extension manager list utility "getAvailableExtensions()" is called
and then a new package is added at the same request, it is not possible
to regenerate the list of availableExtensions as this is cached in a run-time
member variable inside the list utility.

A new method "reloadAvailableExtensions" is added in order to
rebuild the list of available extensions.

Resolves: #71071
Releases: master
Change-Id: Idab208c27f8905e3770fa1845a805cf3f5c3e8ac
Reviewed-on: https://review.typo3.org/44318
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/extensionmanager/Classes/Utility/ListUtility.php

index 59c5789..2354358 100644 (file)
@@ -107,7 +107,8 @@ class ListUtility implements \TYPO3\CMS\Core\SingletonInterface
      */
     public function getAvailableExtensions()
     {
-        if ($this->availableExtensions === NULL) {
+        if ($this->availableExtensions === null) {
+            $this->availableExtensions = [];
             $this->emitPackagesMayHaveChangedSignal();
             foreach ($this->packageManager->getAvailablePackages() as $package) {
                 $installationType = $this->getInstallTypeForPackage($package);
@@ -124,6 +125,14 @@ class ListUtility implements \TYPO3\CMS\Core\SingletonInterface
     }
 
     /**
+     * Reset and reload the available extensions
+     */
+    public function reloadAvailableExtensions() {
+        $this->availableExtensions = null;
+        $this->getAvailableExtensions();
+    }
+
+    /**
      * @param string $extensionKey
      * @return \TYPO3\CMS\Core\Package\PackageInterface
      * @throws \TYPO3\CMS\Core\Package\Exception\UnknownPackageException if the specified package is unknown