Commit 261218e5 authored by Thomas Löffler's avatar Thomas Löffler

Removes old task classes and obsolete task

parent 9d209d12
Pipeline #1553 passed with stages
in 3 minutes
......@@ -5,13 +5,6 @@ if (!defined('TYPO3_MODE')) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPItoST43($_EXTKEY, 'pi1/class.tx_ter_pi1.php', '_pi1', 'list_type', 0);
// Register extension list update task
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['tx_ter_updateExtensionIndexTask'] = [
'extension' => $_EXTKEY,
'title' => 'LLL:EXT:' . $_EXTKEY . '/locallang.xml:tx_ter_updateExtensionIndexTask.name',
'description' => 'LLL:EXT:' . $_EXTKEY . '/locallang.xml:tx_ter_updateExtensionIndexTask.description',
'additionalFields' => 'tx_ter_updateExtensionIndexTask_additionalFieldProvider',
];
// Register core version update task
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\T3o\Ter\Task\UpdateCurrentVersionListTask::class] = [
'extension' => $_EXTKEY,
......
<?php
/**
* 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
*
* @author Jigal van Hemert <jigal.van.hemert@typo3.org>
* @package TYPO3
* @subpackage tx_ter
*/
class tx_ter_updateCurrentVersionListTask extends tx_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;
}
}
<?php
/**
* 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\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
require_once ExtensionManagementUtility::extPath('ter') . 'class.tx_ter_helper.php';
/**
* Create xml file to force update of ter_fe tables
*
* @author Kai Vogel <kai.vogel@speedprogs.de>
* @package TYPO3
* @subpackage tx_ter
*/
class tx_ter_updateExtensionIndexTask extends TYPO3\CMS\Scheduler\Task\AbstractTask
{
/**
* @var string
*/
public $clearCachePages;
/**
* Public method, usually called by scheduler
*
* @return boolean TRUE on success
*/
public function execute()
{
// Check extension configuration
if (empty($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['ter'])) {
throw new Exception('No extension configuration found in $TYPO3_CONF_VARS', 1303220916);
return false;
}
// Check extension repository path
$extensionConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['ter']);
if (empty($extensionConfig['repositoryDir'])) {
throw new Exception('No repository path found in extension configuration', 1303220917);
return false;
}
// Write new extensions xml file
$repositoryDir = rtrim($extensionConfig['repositoryDir'], '/') . '/';
$dummyObject = new stdClass();
$dummyObject->repositoryDir = $repositoryDir;
$terHelper = GeneralUtility::makeInstance('tx_ter_helper', $dummyObject);
$terHelper->writeExtensionIndexFile();
// Clear page cache to force reload of the extension list
$pageIds = GeneralUtility::intExplode(',', $this->clearCachePages, true);
if (!empty($pageIds)) {
$terHelper->loadBackendUser(1, '_ter_', true);
$terHelper->loadLang();
$tce = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
$tce->admin = 1;
$tce->start([], []);
foreach ($pageIds as $pageId) {
$tce->clear_cacheCmd($pageId);
}
}
return true;
}
}
\ No newline at end of file
<?php
/**
* 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!
*/
/**
* Additional BE fields for ter extension publish task
*
* Creates an input field to define UIDs of pages to clear their
* cache after successfully running the scheduler task
*
* @author Kai Vogel <kai.vogel@speedprogs.de>
* @package TYPO3
* @subpackage tx_ter
*/
class tx_ter_updateExtensionIndexTask_additionalFieldProvider implements \TYPO3\CMS\Scheduler\AdditionalFieldProviderInterface
{
/**
* @var string
*/
protected $fieldName = 'scheduler_updateExtensionIndexTask_clearCachePages';
/**
* @var string
*/
protected $fieldId = 'task_updateExtensionIndexTask_clearCachePages';
/**
* Add an input field to define UIDs of pages to clear their
* cache after successfully running the scheduler task
*
* @param array Reference to the array containing the info used in the add/edit form
* @param object When editing, reference to the current task object. Null when adding.
* @param tx_scheduler_Module Reference to the calling object (Scheduler's BE module)
* @return array Array containg all the information pertaining to the additional fields
*/
public function getAdditionalFields(array &$taskInfo, $task, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $parentObject)
{
// Initialize selected fields
if (empty($taskInfo[$this->fieldName])) {
$taskInfo[$this->fieldName] = '';
if ($parentObject->CMD === 'edit') {
$taskInfo[$this->fieldName] = $task->clearCachePages;
}
}
$fieldName = 'tx_scheduler[' . $this->fieldName . ']';
$fieldValue = htmlspecialchars($taskInfo[$this->fieldName]);
$fieldHtml = '<input type="text" name="' . $fieldName . '" id="' . $this->fieldId . '" value="' . $fieldValue . '" size="30" />';
$additionalFields[$fieldId] = [
'code' => $fieldHtml,
'label' => 'LLL:EXT:ter/locallang.xml:tx_ter_updateExtensionIndexTask.clearCachePages',
'cshKey' => '_MOD_tools_txschedulerM1',
'cshLabel' => $fieldId,
];
return $additionalFields;
}
/**
* Checks if the given value is valid
*
* @param array Reference to the array containing the data submitted by the user
* @param tx_scheduler_Module Reference to the calling object (Scheduler's BE module)
* @return boolean TRUE if validation was ok (or selected class is not relevant), FALSE otherwise
*/
public function validateAdditionalFields(array &$submittedData, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $parentObject)
{
$value = str_replace([',', ' '], '', $submittedData[$this->fieldName]);
return (empty($value) || ctype_digit($value));
}
/**
* Saves given integer value in task object
*
* @param array Contains data submitted by the user
* @param tx_scheduler_Task Reference to the current task object
* @return void
*/
public function saveAdditionalFields(array $submittedData, \TYPO3\CMS\Scheduler\Task\AbstractTask $task)
{
$task->clearCachePages = $submittedData[$this->fieldName];
}
}
if (defined(
'TYPO3_MODE'
) && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/scheduler/tasks/class.tx_scheduler_recyclergarbagecollection_additionalfieldprovider.php'])
) {
include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/scheduler/tasks/class.tx_scheduler_recyclergarbagecollection_additionalfieldprovider.php']);
}
\ No newline at end of file
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