TYPO3 API  SVNRelease
class.tx_em_tasks_updateextensionlist.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003  *  Copyright notice
00004  *
00005  *  (c) 2010 Christian Kuhn <lolli@schwarzbu.ch>
00006  *  All rights reserved
00007  *
00008  *  This script is part of the TYPO3 project. The TYPO3 project is
00009  *  free software; you can redistribute it and/or modify
00010  *  it under the terms of the GNU General Public License as published by
00011  *  the Free Software Foundation; either version 2 of the License, or
00012  *  (at your option) any later version.
00013  *
00014  *  The GNU General Public License can be found at
00015  *  http://www.gnu.org/copyleft/gpl.html.
00016  *
00017  *  This script is distributed in the hope that it will be useful,
00018  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  *  GNU General Public License for more details.
00021  *
00022  *  This copyright notice MUST APPEAR in all copies of the script!
00023  ***************************************************************/
00024 
00025 /**
00026  * Update extension list task
00027  *
00028  * @author Christian Kuhn <lolli@schwarzbu.ch>
00029  * @package TYPO3
00030  * @subpackage em
00031  */
00032 class tx_em_Tasks_UpdateExtensionList extends tx_scheduler_Task {
00033     /**
00034      * Public method, usually called by scheduler.
00035      *
00036      * @return boolean True on success
00037      */
00038     public function execute() {
00039             // Throws exceptions if something goes wrong
00040         $this->updateExtensionlist();
00041 
00042         return (TRUE);
00043     }
00044 
00045     /**
00046      * Update extension list
00047      *
00048      * @throws tx_em_ConnectionException if fetch from mirror fails
00049      * @return void
00050      */
00051     protected function updateExtensionlist() {
00052 
00053             // get repositories
00054         $repositories = tx_em_Database::getRepositories();
00055         if (!is_array($repositories)) {
00056             return;
00057         }
00058 
00059             // update all repositories
00060         foreach ($repositories as $repository) {
00061             /* @var $objRepository tx_em_Repository */
00062             $objRepository = t3lib_div::makeInstance('tx_em_Repository', $repository['uid']);
00063             /* @var $objRepositoryUtility tx_em_Repository_Utility */
00064             $objRepositoryUtility = t3lib_div::makeInstance('tx_em_Repository_Utility', $objRepository);
00065             $count = $objRepositoryUtility->updateExtList(FALSE);
00066             unset($objRepository, $objRepositoryUtility);
00067         }
00068     }
00069 }
00070 
00071 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/sysext/em/classes/tasks/class.tx_em_tasks_updateextensionlist.php'])) {
00072     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/sysext/em/classes/tasks/class.tx_em_tasks_updateextensionlist.php']);
00073 }
00074 
00075 ?>