Skip to content
Snippets Groups Projects
Commit 87361777 authored by Michael Oehlhof's avatar Michael Oehlhof Committed by Frank Naegler
Browse files

[BUGFIX] EXT:Scheduler: Update storage index saves correct storage

When creating an "update storage index" task, now the selected storage
is saved correct.

Resolves: #67241
Releases: master
Change-Id: I371c5aa882ff78095536f1e413d58850ccb46c2b
Reviewed-on: https://review.typo3.org/51036


Reviewed-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: default avatarMona Muzaffar <mona.muzaffar@gmx.de>
Reviewed-by: default avatarFrank Naegler <frank.naegler@typo3.org>
Tested-by: default avatarFrank Naegler <frank.naegler@typo3.org>
parent bb60d697
Branches
Tags
No related merge requests found
...@@ -33,7 +33,7 @@ class FileStorageIndexingAdditionalFieldProvider implements \TYPO3\CMS\Scheduler ...@@ -33,7 +33,7 @@ class FileStorageIndexingAdditionalFieldProvider implements \TYPO3\CMS\Scheduler
if ($task !== null && !$task instanceof FileStorageIndexingTask) { if ($task !== null && !$task instanceof FileStorageIndexingTask) {
throw new \InvalidArgumentException('Task not of type FileStorageExtractionTask', 1384275696); throw new \InvalidArgumentException('Task not of type FileStorageExtractionTask', 1384275696);
} }
$additionalFields['scheduler_fileStorageIndexing_storage'] = $this->getAllStoragesField($task); $additionalFields['scheduler_fileStorageIndexing_storage'] = $this->getAllStoragesField($task, $taskInfo);
return $additionalFields; return $additionalFields;
} }
...@@ -41,19 +41,22 @@ class FileStorageIndexingAdditionalFieldProvider implements \TYPO3\CMS\Scheduler ...@@ -41,19 +41,22 @@ class FileStorageIndexingAdditionalFieldProvider implements \TYPO3\CMS\Scheduler
* Add a select field of available storages. * Add a select field of available storages.
* *
* @param FileStorageIndexingTask $task When editing, reference to the current task object. NULL when adding. * @param FileStorageIndexingTask $task When editing, reference to the current task object. NULL when adding.
* @param array $taskInfo
* @return array Array containing all the information pertaining to the additional fields * @return array Array containing all the information pertaining to the additional fields
*/ */
protected function getAllStoragesField(FileStorageIndexingTask $task = null) protected function getAllStoragesField(FileStorageIndexingTask $task = null, $taskInfo)
{ {
/** @var \TYPO3\CMS\Core\Resource\ResourceStorage[] $storages */ /** @var \TYPO3\CMS\Core\Resource\ResourceStorage[] $storages */
$storages = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\StorageRepository::class)->findAll(); $storages = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\StorageRepository::class)->findAll();
$options = []; $options = [];
foreach ($storages as $storage) { foreach ($storages as $storage) {
if ($task != null && $task->storageUid === $storage->getUid()) { $selected = '';
$options[] = '<option value="' . $storage->getUid() . '" selected="selected">' . $storage->getName() . '</option>'; if ($task !== null && $task->storageUid === $storage->getUid()) {
} else { $selected =' selected="selected"';
$options[] = '<option value="' . $storage->getUid() . '">' . $storage->getName() . '</option>'; } elseif ((int)$taskInfo['scheduler_fileStorageIndexing_storage'] === $storage->getUid()) {
$selected =' selected="selected"';
} }
$options[] = '<option value="' . $storage->getUid() . '" ' . $selected . ' >' . $storage->getName() . '</option>';
} }
$fieldName = 'tx_scheduler[scheduler_fileStorageIndexing_storage]'; $fieldName = 'tx_scheduler[scheduler_fileStorageIndexing_storage]';
......
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