Commit 9d209d12 authored by Thomas Löffler's avatar Thomas Löffler

Integrates task for getting current version data

parent d79d8298
......@@ -52,6 +52,7 @@
},
"autoload": {
"psr-4": {
"T3o\\Ter\\": "html/typo3conf/ext/ter/Classes",
"T3o\\TerFe2\\": "html/typo3conf/ext/ter_fe2/Classes"
},
"classmap": [
......
<?php
namespace T3o\Ter\Task;
/**
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Update json file with information of core versions
*/
class UpdateCurrentVersionListTask extends \TYPO3\CMS\Extbase\Scheduler\Task
{
/**
* Public method, usually called by scheduler
*
* @return boolean TRUE on success
*/
public function execute()
{
$resultCoreData = $this->fetchCurrentCoreData();
$resultDocsData = $this->fetchCurrentDocumentationData();
return $resultCoreData && $resultDocsData;
}
/**
* @return boolean
*/
protected function fetchCurrentCoreData()
{
$result = false;
$targetFile = PATH_site . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'] . 'currentcoredata.json';
$sourceData = GeneralUtility::getUrl('http://get.typo3.org/json');
if (json_decode($sourceData, true) !== null) {
$result = GeneralUtility::writeFile($targetFile, $sourceData);
}
return $result;
}
/**
* @return boolean
*/
protected function fetchCurrentDocumentationData()
{
$result = false;
$targetFile = PATH_site . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'] . 'currentdocumentationdata.json';
$sourceData = GeneralUtility::getUrl('https://docs.typo3.org/typo3cms/extensions/manuals.json');
if (json_decode($sourceData, true) !== null) {
$result = GeneralUtility::writeFile($targetFile, $sourceData);
}
return $result;
}
}
......@@ -13,7 +13,7 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['tx_ter_updateEx
'additionalFields' => 'tx_ter_updateExtensionIndexTask_additionalFieldProvider',
];
// Register core version update task
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['tx_ter_updateCurrentVersionListTask'] = [
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\T3o\Ter\Task\UpdateCurrentVersionListTask::class] = [
'extension' => $_EXTKEY,
'title' => 'LLL:EXT:' . $_EXTKEY . '/locallang.xml:tx_ter_updateCurrentVersionListTask.name',
'description' => 'LLL:EXT:' . $_EXTKEY . '/locallang.xml:tx_ter_updateCurrentVersionListTask.description',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment