Fix legacy storage config

This commit is contained in:
Philipp 2021-07-31 20:56:32 +02:00
parent f89cc6bd45
commit 839b5b5859
No known key found for this signature in database
GPG Key ID: 9A28B7D4FF5667BD

View File

@ -81,17 +81,9 @@ class Storage extends BaseAdmin
parent::content($parameters); parent::content($parameters);
$current_storage_backend = DI::storage(); $current_storage_backend = DI::storage();
$available_storage_backends = [];
$available_storage_forms = []; $available_storage_forms = [];
// show legacy option only if it is the current backend:
// once changed can't be selected anymore
if ($current_storage_backend == null) {
$available_storage_backends[''] = DI::l10n()->t('Database (legacy)');
}
foreach (DI::storageManager()->listBackends() as $name => $class) { foreach (DI::storageManager()->listBackends() as $name => $class) {
$available_storage_backends[$name] = $name;
// build storage config form, // build storage config form,
$storage_form_prefix = preg_replace('|[^a-zA-Z0-9]|', '', $name); $storage_form_prefix = preg_replace('|[^a-zA-Z0-9]|', '', $name);
@ -116,7 +108,7 @@ class Storage extends BaseAdmin
'name' => $name, 'name' => $name,
'prefix' => $storage_form_prefix, 'prefix' => $storage_form_prefix,
'form' => $storage_form, 'form' => $storage_form,
'active' => $name === $current_storage_backend::getName(), 'active' => $current_storage_backend instanceof IStorage && $name === $current_storage_backend::getName(),
]; ];
} }
@ -132,7 +124,7 @@ class Storage extends BaseAdmin
'$noconfig' => DI::l10n()->t('This backend doesn\'t have custom settings'), '$noconfig' => DI::l10n()->t('This backend doesn\'t have custom settings'),
'$baseurl' => DI::baseUrl()->get(true), '$baseurl' => DI::baseUrl()->get(true),
'$form_security_token' => self::getFormSecurityToken("admin_storage"), '$form_security_token' => self::getFormSecurityToken("admin_storage"),
'$storagebackend' => $current_storage_backend, '$storagebackend' => $current_storage_backend instanceof IStorage ? $current_storage_backend::getName() : DI::l10n()->t('Database (legacy)'),
'$availablestorageforms' => $available_storage_forms, '$availablestorageforms' => $available_storage_forms,
]); ]);
} }