[TASK][EM] Truncate table if updating extension list 99/19199/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Fri, 22 Mar 2013 18:19:15 +0000 (19:19 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 22 Mar 2013 19:57:50 +0000 (20:57 +0100)
If updating the TER extension list, em deletes all rows of the table
with entries of the specific repository. Since EM handles the main
repository only, truncate can be used here, which is quicker.

Change-Id: Id0dc4fb57d68346f372c44d8cbee247072d09548
Resolves: #46569
Releases: 6.1
Reviewed-on: https://review.typo3.org/19199
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/extensionmanager/Classes/Utility/Repository/Helper.php

index 88e9a68..1e8551e 100644 (file)
@@ -288,8 +288,10 @@ class Helper implements \TYPO3\CMS\Core\SingletonInterface {
                        if ($updateNecessity & self::PROBLEM_NO_VERSIONS_IN_DATABASE) {
                                $updateNecessity &= ~self::PROBLEM_NO_VERSIONS_IN_DATABASE;
                        } else {
-                               // using straight sql here as extbases "remove" runs into memory problems
-                               $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_extensionmanager_domain_model_extension', 'repository=' . $this->repository->getUid());
+                               // Use straight query as extbase "remove" is too slow here
+                               // This truncates the whole table. It would be more correct to remove only rows of a specific
+                               // repository, but multiple repository handling is not implemented, and truncate is quicker.
+                               $this->getDatabaseConnection()->exec_TRUNCATEquery('tx_extensionmanager_domain_model_extension');
                        }
                        // no further problems - start of import process
                        if ($updateNecessity === 0) {
@@ -303,6 +305,15 @@ class Helper implements \TYPO3\CMS\Core\SingletonInterface {
                return $updated;
        }
 
+       /**
+        * Get database connection
+        *
+        * @return \TYPO3\CMS\Core\Database\DatabaseConnection
+        */
+       protected function getDatabaseConnection() {
+               return $GLOBALS['TYPO3_DB'];
+       }
+
 }