[CLEANUP] Streamline EXT:about
[Packages/TYPO3.CMS.git] / typo3 / sysext / about / Classes / Domain / Repository / ExtensionRepository.php
index 8d7ee75..78f074f 100644 (file)
@@ -14,7 +14,7 @@ namespace TYPO3\CMS\About\Domain\Repository;
  * The TYPO3 project - inspiring people to share!
  */
 use TYPO3\CMS\About\Domain\Model\Extension;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Package\PackageManager;
 use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
 use TYPO3\CMS\Extbase\Persistence\Repository;
 
@@ -24,26 +24,21 @@ use TYPO3\CMS\Extbase\Persistence\Repository;
 class ExtensionRepository extends Repository
 {
     /**
-     * Finds all loaded extensions
+     * Finds all loaded third-party extensions (no system extensions)
      *
      * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\About\Domain\Model\Extension>
      */
     public function findAllLoaded()
     {
         $loadedExtensions = $this->objectManager->get(ObjectStorage::class);
-        $loadedExtensionsArray = $GLOBALS['TYPO3_LOADED_EXT'];
-        foreach ($loadedExtensionsArray as $extensionKey => $extension) {
-            if ((is_array($extension) || $extension instanceof \ArrayAccess) && $extension['type'] !== 'S') {
-                $emconfPath = GeneralUtility::getFileAbsFileName('EXT:' . $extensionKey . '/ext_emconf.php');
-                if (file_exists($emconfPath)) {
-                    include $emconfPath;
-                    $extension = $this->objectManager->get(Extension::class);
-                    $extension->setKey($extensionKey);
-                    $extension->setTitle($EM_CONF['']['title']);
-                    $extension->setAuthor($EM_CONF['']['author']);
-                    $extension->setAuthorEmail($EM_CONF['']['author_email']);
-                    $loadedExtensions->attach($extension);
-                }
+        $packageManager = $this->objectManager->get(PackageManager::class);
+        foreach ($packageManager->getActivePackages() as $package) {
+            if ($package->getValueFromComposerManifest('type') === 'typo3-cms-extension') {
+                $extension = $this->objectManager->get(Extension::class);
+                $extension->setKey($package->getPackageKey());
+                $extension->setTitle($package->getPackageMetaData()->getDescription());
+                $extension->setAuthors($package->getValueFromComposerManifest('authors'));
+                $loadedExtensions->attach($extension);
             }
         }
         return $loadedExtensions;