mirror of
https://github.com/friendica/friendica
synced 2024-11-12 23:42:54 +00:00
Merge pull request #6991 from fabrixxm/fix/invalid-storage-on-legacy
Allow set empty string storage class for legacy
This commit is contained in:
commit
75387ea171
2 changed files with 38 additions and 31 deletions
|
@ -1152,12 +1152,10 @@ function admin_page_site_post(App $a)
|
|||
* @var $storagebackend \Friendica\Model\Storage\IStorage
|
||||
*/
|
||||
$storagebackend = Strings::escapeTags(trim(defaults($_POST, 'storagebackend', '')));
|
||||
if (!StorageManager::setBackend($storagebackend)) {
|
||||
info(L10n::t('Invalid storage backend setting value.'));
|
||||
}
|
||||
|
||||
// save storage backend form
|
||||
if (!is_null($storagebackend) && $storagebackend != "") {
|
||||
if (StorageManager::setBackend($storagebackend)) {
|
||||
$storage_opts = $storagebackend::getOptions();
|
||||
$storage_form_prefix = preg_replace('|[^a-zA-Z0-9]|', '', $storagebackend);
|
||||
$storage_opts_data = [];
|
||||
|
@ -1183,6 +1181,9 @@ function admin_page_site_post(App $a)
|
|||
}
|
||||
$a->internalRedirect('admin/site' . $active_panel);
|
||||
}
|
||||
} else {
|
||||
info(L10n::t('Invalid storage backend setting value.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1497,9 +1498,14 @@ function admin_page_site(App $a)
|
|||
*/
|
||||
$storage_current_backend = StorageManager::getBackend();
|
||||
|
||||
$storage_backends_choices = [
|
||||
'' => L10n::t('Database (legacy)')
|
||||
];
|
||||
$storage_backends_choices = [];
|
||||
|
||||
// show legacy option only if it is the current backend:
|
||||
// once changed can't be selected anymore
|
||||
if ($storage_current_backend == '') {
|
||||
$storage_backends_choices[''] = L10n::t('Database (legacy)');
|
||||
};
|
||||
|
||||
foreach ($storage_backends as $name => $class) {
|
||||
$storage_backends_choices[$class] = $name;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ class StorageManager
|
|||
|
||||
/**
|
||||
* @brief Return current storage backend class
|
||||
*
|
||||
* @return string
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue