Commit 154aacdd authored by Alexander Nitsche's avatar Alexander Nitsche Committed by Georg Ringer
Browse files

[TASK] Allow flushing of the internal StorageRepository cache

To explicitly refresh the internal cache of StorageRepository
when a file storage has been added/removed/updated, a public
method flush() has been added to the class.

Releases: master
Resolves: #93057
Change-Id: I514bc5c39f6749a171006968a8b513803c599f4d
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/67097

Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Simon Gilli's avatarSimon Gilli <typo3@gilbertsoft.org>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
parent a8663d87
......@@ -171,8 +171,8 @@ class StorageRepository implements LoggerAwareInterface
'This is the local fileadmin/ directory. This storage mount has been created automatically by TYPO3.',
true
) > 0) {
// reset to null to force reloading of storages
$this->storageRowCache = null;
// clear Cache to force reloading of storages
$this->flush();
// call self for initialize Cache
$this->initializeLocalCache();
}
......@@ -181,6 +181,18 @@ class StorageRepository implements LoggerAwareInterface
}
}
/**
* Flush the internal storage caches to force reloading of storages with the next fetch.
*
* @internal
*/
public function flush(): void
{
$this->storageRowCache = null;
$this->storageInstances = null;
$this->localDriverStorageCache = null;
}
/**
* Finds storages by type, i.e. the driver used
*
......@@ -281,7 +293,7 @@ class StorageRepository implements LoggerAwareInterface
$dbConnection->insert($this->table, $field_values);
// Flush local resourceStorage cache so the storage can be accessed during the same request right away
$this->storageRowCache = null;
$this->flush();
return (int)$dbConnection->lastInsertId($this->table);
}
......
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