Remove unneeded module setting from App Metadata

This commit is contained in:
Jack Anderson 2024-07-15 08:14:23 +01:00 committed by y.yerli
parent 85e69e6cae
commit 957b553e05
3 changed files with 1 additions and 22 deletions

View file

@ -120,7 +120,7 @@ class CacheManagerHandler extends LegacyHandler implements CacheManagerInterface
while ($row = $db->fetchByAssoc($result)) {
foreach ($keys as $key) {
if ($row['cache_key'] == $key && $row['rebuild'] == 1) {
if (str_contains($row['cache_key'], 'all-module-metadata') && !empty($modules)) {
if (str_contains($row['cache_key'], 'all-module-metadata-' . $current_user->id ) && !empty($modules)) {
foreach ($modules as $module) {
if (empty($module)){
continue;

View file

@ -180,8 +180,6 @@ class AppMetadata
)]
protected string $id;
protected array $modules = [];
/**
* @return string
*/
@ -366,10 +364,4 @@ class AppMetadata
$this->adminMetadata = $adminMetadata;
}
public function setModules($modules): void
{
$this->modules = $modules;
}
}

View file

@ -139,8 +139,6 @@ class AppMetadataProvider implements AppMetadataProviderInterface
*/
protected $moduleRegistryHandler;
protected array $modules = [];
/**
* AppMetadataProvider constructor.
* @param ModuleNameMapperInterface $moduleNameMapper
@ -284,20 +282,11 @@ class AppMetadataProvider implements AppMetadataProviderInterface
$metadata->setModuleMetadata([]);
$metadata->setMinimalModuleMetadata([]);
$metadata->setModules([]);
if (in_array('moduleMetadata', $exposed, true)) {
$navigation = $this->navigationService->getNavbar();
$modules = $this->cache->get('all-module-metadata-' . $userId, function () {
return $this->getModules();
});
$moduleMetadata = $this->getModuleMetadata($moduleName, $navigation) ?? [];
$metadata->setModuleMetadata($moduleMetadata);
$metadata->setModules($modules);
} elseif (in_array('minimalModuleMetadata', $exposed, true)) {
$modules = $this->cache->get('all-module-metadata-' . $userId, function () {
return $this->getModules();
});
$metadata->setModules($modules);
$metadata->setMinimalModuleMetadata($this->getMinimalModuleMetadata($moduleName));
}
@ -686,10 +675,8 @@ class AppMetadataProvider implements AppMetadataProviderInterface
$metadata->setMinimalModuleMetadata([]);
if (in_array('moduleMetadata', $exposed, true)) {
$metadata->setModuleMetadata($this->getModuleMetadata($moduleName, $navigation));
$metadata->setModules($this->getModules($moduleName));
} elseif (in_array('minimalModuleMetadata', $exposed, true)) {
$metadata->setMinimalModuleMetadata($this->getMinimalModuleMetadata($moduleName));
$metadata->setModules($this->getModules($moduleName));
}
/** @var \User $currentUser */