[FEATURE] Integrate preliminary PackageManager API
[Packages/TYPO3.CMS.git] / typo3 / sysext / about / Classes / Domain / Repository / ExtensionRepository.php
1 <?php
2 namespace TYPO3\CMS\About\Domain\Repository;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2012-2013 Felix Kopp <felix@phorax.com>
8 *
9 * All rights reserved
10 *
11 * This script is part of the TYPO3 project. The TYPO3 project is
12 * free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * The GNU General Public License can be found at
18 * http://www.gnu.org/copyleft/gpl.html.
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Repository for Tx_About_Domain_Model_Extension
29 *
30 * @author Felix Kopp <felix-source@phorax.com>
31 */
32 class ExtensionRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
33
34 /**
35 * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
36 */
37 protected $objectManager;
38
39 /**
40 * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
41 */
42 public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager) {
43 $this->objectManager = $objectManager;
44 }
45
46 /**
47 * Finds all loaded extensions
48 *
49 * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\About\Domain\Model\Extension>
50 */
51 public function findAllLoaded() {
52 $loadedExtensions = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage');
53 $loadedExtensionsArray = $GLOBALS['TYPO3_LOADED_EXT'];
54 foreach ($loadedExtensionsArray as $extensionKey => $extension) {
55 if ((is_array($extension) || $extension instanceof \ArrayAccess) && $extension['type'] != 'S') {
56 $emconfPath = PATH_site . $extension['siteRelPath'] . 'ext_emconf.php';
57 if (file_exists($emconfPath)) {
58 include $emconfPath;
59 $extension = $this->objectManager->get('TYPO3\\CMS\\About\\Domain\\Model\\Extension');
60 $extension->setKey($extensionKey);
61 $extension->setTitle($EM_CONF['']['title']);
62 $extension->setAuthor($EM_CONF['']['author']);
63 $extension->setAuthorEmail($EM_CONF['']['author_email']);
64 $loadedExtensions->attach($extension);
65 }
66 }
67 }
68 return $loadedExtensions;
69 }
70
71 }