[TASK] Only import extensions from 2015+ into EM 06/57306/5
authorBenni Mack <benni@typo3.org>
Fri, 22 Jun 2018 19:06:47 +0000 (21:06 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Wed, 27 Jun 2018 08:41:57 +0000 (10:41 +0200)
As proposed here https://decisions.typo3.org/t/reduce-size-of-extension-manager-db-table/329/
the EM only imports entries into the database from
TER that are uploaded from 2015-11-10 on, reducing
the database table size by 2/3.

As long as extensions.xml from TER does not
restrict this (e.g. by version) this reduces
import time when updating the extension list
and search handling within the Extension Manager.

Resolves: #85393
Releases: master
Change-Id: I1d45cde0fc895d0edb978729dc4b42df70e97d5c
Reviewed-on: https://review.typo3.org/57306
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Torben Hansen <derhansen@gmail.com>
Tested-by: Torben Hansen <derhansen@gmail.com>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Josef Glatz <josef.glatz@typo3.org>
Tested-by: Josef Glatz <josef.glatz@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/core/Documentation/Changelog/master/Important-85393-ExtensionManagerOnlyImportsExtensionsCompatibleWithTYPO3V7LTSOrHigher.rst [new file with mode: 0644]
typo3/sysext/extensionmanager/Classes/Utility/Importer/ExtensionListUtility.php

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Important-85393-ExtensionManagerOnlyImportsExtensionsCompatibleWithTYPO3V7LTSOrHigher.rst b/typo3/sysext/core/Documentation/Changelog/master/Important-85393-ExtensionManagerOnlyImportsExtensionsCompatibleWithTYPO3V7LTSOrHigher.rst
new file mode 100644 (file)
index 0000000..343515b
--- /dev/null
@@ -0,0 +1,23 @@
+.. include:: ../../Includes.txt
+
+====================================================================================================
+Important: #85393 - Extension Manager only imports extensions compatible with TYPO3 v7 LTS or higher
+====================================================================================================
+
+See :issue:`85393`
+
+Description
+===========
+
+The extension manager now includes a restriction when updating the list of current extensions
+within TER that have been uploaded later than November 10th, 2015 - the release of
+TYPO3 v7 LTS (7.6.0).
+
+This ensures that the database is drastically reduced, resulting in smaller footprint for the
+database and faster updating / searching / browsing the list of available extensions within the
+Extension Manager.
+
+Installing extensions older than this date is still possible by manually downloading an extension
+and importing it via a ZIP file or by uploading it into `typo3conf/ext/[extension_name]`.
+
+.. index:: ext:extensionmanager
\ No newline at end of file
index e8b23c1..7d0e042 100644 (file)
@@ -125,6 +125,14 @@ class ExtensionListUtility implements \SplObserver
     protected $objectManager;
 
     /**
+     * Only import extensions newer than this date (timestamp),
+     * see constructor
+     *
+     * @var int
+     */
+    protected $minimumDateToImport;
+
+    /**
      * Class constructor.
      *
      * Method retrieves and initializes extension XML parser instance.
@@ -161,6 +169,15 @@ class ExtensionListUtility implements \SplObserver
             $this->maxRowsPerChunk,
             floor($maxBindParameters / $countOfBindParamsPerRow)
         );
+        // Only import extensions that are compatible with 7.6 or higher.
+        // TER only allows to publish extensions with compatibility if the TYPO3 version has been released
+        // And 7.6 was released on 10th of November 2015.
+        // This effectively reduces the number of extensions imported into this TYPO3 installation
+        // by more than 70%. As long as the extensions.xml from TER includes these files, we need to "hack" this
+        // within TYPO3 Core.
+        // For TYPO3 v10.0, this date could be set to 2017-04-04 (8 LTS release).
+        // Also see https://decisions.typo3.org/t/reduce-size-of-extension-manager-db-table/329/
+        $this->minimumDateToImport = strtotime('2015-11-10T00:00:00+00:00');
     }
 
     /**
@@ -246,7 +263,9 @@ class ExtensionListUtility implements \SplObserver
     public function update(\SplSubject $subject)
     {
         if (is_subclass_of($subject, AbstractExtensionXmlParser::class)) {
-            $this->loadIntoDatabase($subject);
+            if ((int)$subject->getLastuploaddate() > $this->minimumDateToImport) {
+                $this->loadIntoDatabase($subject);
+            }
         }
     }
 }