[BUGFIX] keep options array for TableGarbageCollectionTask 30/40830/3
authorDaniel Neugebauer <dneuge@glutrot.de>
Wed, 1 Jul 2015 17:48:21 +0000 (19:48 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Mon, 6 Jul 2015 20:58:18 +0000 (22:58 +0200)
scheduler now keeps an options sub-array if it has been populated
before ext_localconf.php runs.

User can define additional options for TableGarbageCollectionTask as
per extension documentation, i.e. tables can be added from user
configuration files such as AdditionalConfiguration.php.

Resolves: #67874
Releases: master, 6.2
Change-Id: I9eee7e1315e4a5049cee9db694c1f5a8375c8475
Reviewed-on: http://review.typo3.org/40830
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/scheduler/ext_localconf.php

index adc34e3..ee3fee8 100644 (file)
@@ -61,22 +61,26 @@ if (TYPO3_OS !== 'WIN') {
        );
 }
 
+// Save any previous option array for table garbage collection task
+// to temporary variable so it can be pre-populated by other
+// extensions and LocalConfiguration/AdditionalConfiguration
+$garbageCollectionTaskOptions = array();
+if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options'])) {
+       $garbageCollectionTaskOptions = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options'];
+}
+// Initialize tables sub-array if not set already
+if (!is_array($garbageCollectionTaskOptions['tables'])) {
+       $garbageCollectionTaskOptions['tables'] = array();
+}
 // Add table garbage collection task
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class] = array(
        'extension' => 'scheduler',
        'title' => 'LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:tableGarbageCollection.name',
        'description' => 'LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:tableGarbageCollection.description',
-       'additionalFields' => \TYPO3\CMS\Scheduler\Task\TableGarbageCollectionAdditionalFieldProvider::class
+       'additionalFields' => \TYPO3\CMS\Scheduler\Task\TableGarbageCollectionAdditionalFieldProvider::class,
+       'options' => $garbageCollectionTaskOptions
 );
-
-// Initialize option array of table garbage collection task if not already done by some other extension or localconf.php
-if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options'])) {
-       $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options'] = array();
-}
-
-if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options']['tables'])) {
-       $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options']['tables'] = array();
-}
+unset($garbageCollectionTaskOptions);
 
 // Register sys_log and sys_history table in table garbage collection task
 if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options']['tables']['sys_log'])) {