05f16dd03cf85db87db04ada4c767d9585067871
[Packages/TYPO3.CMS.git] / typo3 / sysext / extensionmanager / Classes / Task / UpdateExtensionListTask.php
1 <?php
2 namespace TYPO3\CMS\Extensionmanager\Task;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2010-2013 Christian Kuhn <lolli@schwarzbu.ch>
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 *
19 * This script is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * This copyright notice MUST APPEAR in all copies of the script!
25 ***************************************************************/
26
27 /**
28 * Update extension list from TER task
29 *
30 * @author Christian Kuhn <lolli@schwarzbu.ch>
31 */
32 class UpdateExtensionListTask extends \TYPO3\CMS\Scheduler\Task\AbstractTask {
33
34 /**
35 * Public method, called by scheduler.
36 *
37 * @return boolean TRUE on success
38 */
39 public function execute() {
40 // Throws exceptions if something went wrong
41 $this->updateExtensionList();
42
43 return TRUE;
44 }
45
46 /**
47 * Update extension list
48 *
49 * @TODO: Adapt to multiple repositories if the Helper can handle this
50 * @return void
51 */
52 protected function updateExtensionList() {
53 /** @var $objectManager \TYPO3\CMS\Extbase\Object\ObjectManager */
54 $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
55
56 /** @var $repositoryHelper \TYPO3\CMS\Extensionmanager\Utility\Repository\Helper */
57 $repositoryHelper = $objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\Repository\\Helper');
58 $repositoryHelper->updateExtList();
59
60 /** @var $persistenceManager \TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager */
61 $persistenceManager = $objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager');
62 $persistenceManager->persistAll();
63 }
64 }