X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FAdmin%2FStorage.php;h=434b43b32ed6e7095ed75b5b1f2fdfbc3e65fedd;hb=c81a9d1ddd7e5b7fff6a173a159ae78ee7fc7698;hp=1f598c1a23f8101e69697e06a83196d785ef9231;hpb=714f0febc4918f5569eb09f8800b6739cff36347;p=friendica.git diff --git a/src/Module/Admin/Storage.php b/src/Module/Admin/Storage.php index 1f598c1a23..434b43b32e 100644 --- a/src/Module/Admin/Storage.php +++ b/src/Module/Admin/Storage.php @@ -1,6 +1,6 @@ parameters['name'] ?? ''); try { /** @var ICanConfigureStorage|false $newStorageConfig */ $newStorageConfig = DI::storageManager()->getConfigurationByName($storagebackend); } catch (InvalidClassStorageException $storageException) { - notice(DI::l10n()->t('Storage backend, %s is invalid.', $storagebackend)); + DI::sysmsg()->addNotice(DI::l10n()->t('Storage backend, %s is invalid.', $storagebackend)); DI::baseUrl()->redirect('admin/storage'); } @@ -70,28 +70,28 @@ class Storage extends BaseAdmin $storage_form_errors = $newStorageConfig->saveOptions($storage_opts_data); if (count($storage_form_errors)) { foreach ($storage_form_errors as $name => $err) { - notice(DI::l10n()->t('Storage backend %s error: %s', $storage_opts[$name][1], $err)); + DI::sysmsg()->addNotice(DI::l10n()->t('Storage backend %s error: %s', $storage_opts[$name][1], $err)); } DI::baseUrl()->redirect('admin/storage'); } } - if (!empty($_POST['submit_save_set'])) { + if (!empty($_POST['submit_save_set']) && DI::config()->isWritable('storage', 'name') ) { try { $newstorage = DI::storageManager()->getWritableStorageByName($storagebackend); if (!DI::storageManager()->setBackend($newstorage)) { - notice(DI::l10n()->t('Invalid storage backend setting value.')); + DI::sysmsg()->addNotice(DI::l10n()->t('Invalid storage backend setting value.')); } } catch (InvalidClassStorageException $storageException) { - notice(DI::l10n()->t('Invalid storage backend setting value.')); + DI::sysmsg()->addNotice(DI::l10n()->t('Invalid storage backend setting value.')); } } DI::baseUrl()->redirect('admin/storage'); } - public static function content() + protected function content(array $request = []): string { parent::content(); @@ -110,7 +110,7 @@ class Storage extends BaseAdmin foreach ($storageConfig->getOptions() as $option => $info) { $type = $info[0]; - // Backward compatibilty with yesno field description + // Backward compatibility with yesno field description if ($type == 'yesno') { $type = 'checkbox'; // Remove translated labels Yes No from field info @@ -144,8 +144,9 @@ class Storage extends BaseAdmin '$use' => DI::l10n()->t('Use storage backend'), '$save_reload' => DI::l10n()->t('Save & Reload'), '$noconfig' => DI::l10n()->t('This backend doesn\'t have custom settings'), - '$baseurl' => DI::baseUrl()->get(true), '$form_security_token' => self::getFormSecurityToken("admin_storage"), + '$storagebackend_ro_txt' => !DI::config()->isWritable('storage', 'name') ? DI::l10n()->t('Changing the current backend is prohibited because it is set by an environment variable') : '', + '$is_writable' => DI::config()->isWritable('storage', 'name'), '$storagebackend' => $current_storage_backend instanceof ICanWriteToStorage ? $current_storage_backend::getName() : DI::l10n()->t('Database (legacy)'), '$availablestorageforms' => $available_storage_forms, ]);