[FOLLOWUP][BUGFIX] keep options array for TableGarbageCollectionTask
[Packages/TYPO3.CMS.git] / typo3 / sysext / scheduler / ext_localconf.php
1 <?php
2 defined('TYPO3_MODE') or die();
3
4 // Register the Scheduler as a possible key for CLI calls
5 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['cliKeys']['scheduler'] = array(
6 'EXT:scheduler/cli/scheduler_cli_dispatch.php',
7 '_CLI_scheduler'
8 );
9 // Get the extensions's configuration
10 $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['scheduler']);
11 // If sample tasks should be shown,
12 // register information for the test and sleep tasks
13 if (!empty($extConf['showSampleTasks'])) {
14 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Example\TestTask::class] = array(
15 'extension' => 'scheduler',
16 'title' => 'LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:testTask.name',
17 'description' => 'LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:testTask.description',
18 'additionalFields' => \TYPO3\CMS\Scheduler\Example\TestTaskAdditionalFieldProvider::class
19 );
20 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Example\SleepTask::class] = array(
21 'extension' => 'scheduler',
22 'title' => 'LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:sleepTask.name',
23 'description' => 'LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:sleepTask.description',
24 'additionalFields' => \TYPO3\CMS\Scheduler\Example\SleepTaskAdditionalFieldProvider::class
25 );
26 }
27
28 // Add caching framework garbage collection task
29 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\CachingFrameworkGarbageCollectionTask::class] = array(
30 'extension' => 'scheduler',
31 'title' => 'LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:cachingFrameworkGarbageCollection.name',
32 'description' => 'LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:cachingFrameworkGarbageCollection.description',
33 'additionalFields' => \TYPO3\CMS\Scheduler\Task\CachingFrameworkGarbageCollectionAdditionalFieldProvider::class
34 );
35
36 // Add task to index file in a storage
37 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\FileStorageIndexingTask::class] = array(
38 'extension' => 'scheduler',
39 'title' => 'LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:fileStorageIndexing.name',
40 'description' => 'LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:fileStorageIndexing.description',
41 'additionalFields' => \TYPO3\CMS\Scheduler\Task\FileStorageIndexingAdditionalFieldProvider::class
42 );
43
44 // Add task for extracting metadata from files in a storage
45 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\FileStorageExtractionTask::class] = array(
46 'extension' => 'scheduler',
47 'title' => 'LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:fileStorageExtraction.name',
48 'description' => 'LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:fileStorageExtraction.description',
49 'additionalFields' => \TYPO3\CMS\Scheduler\Task\FileStorageExtractionAdditionalFieldProvider::class
50
51 );
52
53 // Add recycler directory cleanup task. Windows is not supported
54 // because "filectime" does not change after moving a file
55 if (TYPO3_OS !== 'WIN') {
56 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\RecyclerGarbageCollectionTask::class] = array(
57 'extension' => 'scheduler',
58 'title' => 'LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:recyclerGarbageCollection.name',
59 'description' => 'LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:recyclerGarbageCollection.description',
60 'additionalFields' => \TYPO3\CMS\Scheduler\Task\RecyclerGarbageCollectionAdditionalFieldProvider::class
61 );
62 }
63
64 // Save any previous option array for table garbage collection task
65 // to temporary variable so it can be pre-populated by other
66 // extensions and LocalConfiguration/AdditionalConfiguration
67 $garbageCollectionTaskOptions = array();
68 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options'])) {
69 $garbageCollectionTaskOptions = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options'];
70 }
71 // Initialize tables sub-array if not set already
72 if (!is_array($garbageCollectionTaskOptions['tables'])) {
73 $garbageCollectionTaskOptions['tables'] = array();
74 }
75 // Add table garbage collection task
76 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class] = array(
77 'extension' => 'scheduler',
78 'title' => 'LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:tableGarbageCollection.name',
79 'description' => 'LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:tableGarbageCollection.description',
80 'additionalFields' => \TYPO3\CMS\Scheduler\Task\TableGarbageCollectionAdditionalFieldProvider::class,
81 'options' => $garbageCollectionTaskOptions
82 );
83 unset($garbageCollectionTaskOptions);
84
85 // Register sys_log and sys_history table in table garbage collection task
86 if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options']['tables']['sys_log'])) {
87 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options']['tables']['sys_log'] = array(
88 'dateField' => 'tstamp',
89 'expirePeriod' => 180
90 );
91 }
92
93 if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options']['tables']['sys_history'])) {
94 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options']['tables']['sys_history'] = array(
95 'dateField' => 'tstamp',
96 'expirePeriod' => 30
97 );
98 }