Feature #23848 ยป 16137_01.diff
typo3/sysext/em/ext_autoload.php (revision 0) | ||
---|---|---|
<?php
|
||
$emClassesPath = PATH_site . 'typo3/sysext/em/classes/';
|
||
return array(
|
||
'sc_mod_tools_em_index' => $emClassesPath . '../mod1/class.em_index.php',
|
||
'em_connection_exception' => $emClassesPath . 'exception/class.em_connection_exception.php',
|
||
'em_tasks_updateextensionlist' => $emClassesPath . 'tasks/class.em_tasks_updateextensionlist.php',
|
||
);
|
||
?>
|
typo3/sysext/em/language/locallang.xml (revision 0) | ||
---|---|---|
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||
<T3locallang>
|
||
<meta type="array">
|
||
<type>module</type>
|
||
<description>Labels for Extension Manager</description>
|
||
</meta>
|
||
<data type="array">
|
||
<languageKey index="default" type="array">
|
||
<label index="tasks_updateExtensionlistTask.name">Update extension list</label>
|
||
<label index="tasks_updateExtensionlistTask.description">Update extension list on a regular basis. Once a day is a good interval.</label>
|
||
</languageKey>
|
||
</data>
|
||
</T3locallang>
|
typo3/sysext/em/ext_localconf.php (revision 0) | ||
---|---|---|
<?php
|
||
if (!defined ('TYPO3_MODE')) {
|
||
die ('Access denied.');
|
||
}
|
||
// Register extension list update task
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['em_tasks_UpdateExtensionList'] = array(
|
||
'extension' => $_EXTKEY,
|
||
'title' => 'LLL:EXT:' . $_EXTKEY . '/language/locallang.xml:tasks_updateExtensionlistTask.name',
|
||
'description' => 'LLL:EXT:' . $_EXTKEY . '/language/locallang.xml:tasks_updateExtensionlistTask.description',
|
||
'additionalFields' => '',
|
||
);
|
||
?>
|
typo3/sysext/em/classes/tasks/class.em_tasks_updateextensionlist.php (revision 0) | ||
---|---|---|
<?php
|
||
/***************************************************************
|
||
* Copyright notice
|
||
*
|
||
* (c) 2010 Christian Kuhn <lolli@schwarzbu.ch>
|
||
* All rights reserved
|
||
*
|
||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||
* free software; you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation; either version 2 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* The GNU General Public License can be found at
|
||
* http://www.gnu.org/copyleft/gpl.html.
|
||
*
|
||
* This script is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
*
|
||
* This copyright notice MUST APPEAR in all copies of the script!
|
||
***************************************************************/
|
||
/**
|
||
* Update extension list task
|
||
*
|
||
* @author Christian Kuhn <lolli@schwarzbu.ch>
|
||
* @package TYPO3
|
||
* @subpackage em
|
||
*/
|
||
class em_tasks_UpdateExtensionList extends tx_scheduler_Task {
|
||
/**
|
||
* Public method, usually called by scheduler.
|
||
*
|
||
* @return boolean True on success
|
||
*/
|
||
public function execute() {
|
||
// Throws exceptions if something goes wrong
|
||
$this->updateExtensionlist();
|
||
return(TRUE);
|
||
}
|
||
/**
|
||
* Update extension list
|
||
*
|
||
* @throws em_connection_Exception if fetch from mirror fails
|
||
* @return void
|
||
*/
|
||
protected function updateExtensionlist() {
|
||
require_once(PATH_typo3 . 'template.php');
|
||
$extensionManager = t3lib_div::makeInstance('SC_mod_tools_em_index');
|
||
$extensionManager->init();
|
||
if (empty($extensionManager->MOD_SETTINGS['mirrorListURL'])) {
|
||
$extensionManager->MOD_SETTINGS['mirrorListURL'] = $GLOBALS['TYPO3_CONF_VARS']['EXT']['em_mirrorListURL'];
|
||
}
|
||
if (is_file(PATH_site . 'typo3temp/extensions.xml.gz')) {
|
||
$localMd5 = md5_file(PATH_site . 'typo3temp/extensions.xml.gz');
|
||
}
|
||
$mirror = $extensionManager->getMirrorURL();
|
||
$remoteMd5 = t3lib_div::getURL($mirror . 'extensions.md5', 0, array(TYPO3_user_agent));
|
||
if (!$remoteMd5) {
|
||
throw new em_connection_Exception(
|
||
'Unable to fetch extension list md5 file from remote mirror.',
|
||
1288121556
|
||
);
|
||
}
|
||
$localExtensionCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('extkey', 'cache_extensions');
|
||
if ($localMd5 !== $remoteMd5 || $localExtensionCount === '0') {
|
||
$remoteXml = t3lib_div::getURL($mirror . 'extensions.xml.gz', 0, array(TYPO3_user_agent));
|
||
if (!$remoteXml) {
|
||
throw new em_connection_Exception(
|
||
'Unable to fetch extension list XML file from remote mirror.',
|
||
1288121557
|
||
);
|
||
}
|
||
t3lib_div::writeFile(PATH_site . 'typo3temp/extensions.xml.gz', $remoteXml);
|
||
$extensionManager->xmlhandler->parseExtensionsXML(PATH_site . 'typo3temp/extensions.xml.gz');
|
||
}
|
||
}
|
||
}
|
||
if (defined('TYPO3_MODE') && $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/em/classes/tasks/class.em_tasks_updateextensionlist.php']) {
|
||
include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/em/classes/tasks/class.em_tasks_updateextensionlist.php']);
|
||
}
|
||
?>
|
typo3/sysext/em/classes/exception/class.em_connection_exception.php (revision 0) | ||
---|---|---|
<?php
|
||
/***************************************************************
|
||
* Copyright notice
|
||
*
|
||
* (c) 2010 Marcus Krause <marcus#exp2010@t3sec.info>
|
||
* Steffen Kamper <info@sk-typo3.de>
|
||
* All rights reserved
|
||
*
|
||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||
* free software; you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation; either version 2 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* The GNU General Public License can be found at
|
||
* http://www.gnu.org/copyleft/gpl.html.
|
||
*
|
||
* This script is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
*
|
||
* This copyright notice MUST APPEAR in all copies of the script!
|
||
***************************************************************/
|
||
/**
|
||
* Module: Extension manager - connection exception
|
||
*
|
||
* $Id: class.em_connection_exception.php 1876 2010-02-18 23:23:13Z mkrause $
|
||
*/
|
||
/**
|
||
* Exception for internet connection handling.
|
||
*
|
||
* This exception is supposed to be thrown when
|
||
* there are problems with the internet connections
|
||
* initialized by the web server.
|
||
*
|
||
* @author Marcus Krause <marcus#exp2010@t3sec.info>
|
||
* @author Steffen Kamper <info@sk-typo3.de>
|
||
*
|
||
* @since 2010-02-18
|
||
* @package TYPO3
|
||
* @subpackage EM
|
||
*/
|
||
class em_connection_Exception extends Exception {
|
||
}
|
||
?>
|
typo3/sysext/em/classes/exception/class.em_connection_exception.php (revision 0) | ||
---|---|---|
<?php
|
||
/***************************************************************
|
||
* Copyright notice
|
||
*
|
||
* (c) 2010 Marcus Krause <marcus#exp2010@t3sec.info>
|
||
* Steffen Kamper <info@sk-typo3.de>
|
||
* All rights reserved
|
||
*
|
||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||
* free software; you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation; either version 2 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* The GNU General Public License can be found at
|
||
* http://www.gnu.org/copyleft/gpl.html.
|
||
*
|
||
* This script is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
*
|
||
* This copyright notice MUST APPEAR in all copies of the script!
|
||
***************************************************************/
|
||
/**
|
||
* Module: Extension manager - connection exception
|
||
*
|
||
* $Id: class.em_connection_exception.php 1876 2010-02-18 23:23:13Z mkrause $
|
||
*/
|
||
/**
|
||
* Exception for internet connection handling.
|
||
*
|
||
* This exception is supposed to be thrown when
|
||
* there are problems with the internet connections
|
||
* initialized by the web server.
|
||
*
|
||
* @author Marcus Krause <marcus#exp2010@t3sec.info>
|
||
* @author Steffen Kamper <info@sk-typo3.de>
|
||
*
|
||
* @since 2010-02-18
|
||
* @package TYPO3
|
||
* @subpackage EM
|
||
*/
|
||
class em_connection_Exception extends Exception {
|
||
}
|
||
?>
|
t3lib/core_autoload.php (working copy) | ||
---|---|---|
$tslibClasses = require(PATH_typo3 . 'sysext/cms/ext_autoload.php');
|
||
return array_merge($t3libClasses, $tslibClasses);
|
||
$emClasses = array();
|
||
$emClasses = require(PATH_typo3 . 'sysext/em/ext_autoload.php');
|
||
return array_merge($t3libClasses, $tslibClasses, $emClasses);
|
||
?>
|