use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
+use Friendica\Core\Search;
use Friendica\Core\StorageManager;
use Friendica\Core\Theme;
use Friendica\Core\Worker;
* send relocate for every local user
* */
- $old_url = $a->getBaseURL(true);
+ $old_url = DI::baseUrl()->get(true);
// Generate host names for relocation the addresses in the format user@address.tld
$new_host = str_replace("http://", "@", Strings::normaliseLink($new_url));
// update config
Config::set('system', 'url', $new_url);
- $a->setBaseURL($new_url);
+ DI::baseUrl()->saveByURL($new_url);
// send relocate
$usersStmt = DBA::select('user', ['uid'], ['account_removed' => false, 'account_expired' => false]);
$relay_user_tags = !empty($_POST['relay_user_tags']);
$active_panel = (!empty($_POST['active_panel']) ? "#" . Strings::escapeTags(trim($_POST['active_panel'])) : '');
- /**
- * @var $storagebackend \Friendica\Model\Storage\IStorage
- */
$storagebackend = Strings::escapeTags(trim($_POST['storagebackend'] ?? ''));
// 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 = [];
- foreach ($storage_opts as $name => $info) {
- $fieldname = $storage_form_prefix . '_' . $name;
- switch ($info[0]) { // type
- case 'checkbox':
- case 'yesno':
- $value = !empty($_POST[$fieldname]);
- break;
- default:
- $value = $_POST[$fieldname] ?? '';
- }
- $storage_opts_data[$name] = $value;
+ if (DI::storageManager()->setBackend($storagebackend)) {
+ $storage_opts = DI::storage()->getOptions();
+ $storage_form_prefix = preg_replace('|[^a-zA-Z0-9]|', '', $storagebackend);
+ $storage_opts_data = [];
+ foreach ($storage_opts as $name => $info) {
+ $fieldname = $storage_form_prefix . '_' . $name;
+ switch ($info[0]) { // type
+ case 'checkbox':
+ case 'yesno':
+ $value = !empty($_POST[$fieldname]);
+ break;
+ default:
+ $value = $_POST[$fieldname] ?? '';
}
- unset($name);
- unset($info);
-
- $storage_form_errors = $storagebackend::saveOptions($storage_opts_data);
- if (count($storage_form_errors)) {
- foreach ($storage_form_errors as $name => $err) {
- notice('Storage backend, ' . $storage_opts[$name][1] . ': ' . $err);
- }
- DI::baseUrl()->redirect('admin/site' . $active_panel);
+ $storage_opts_data[$name] = $value;
+ }
+ unset($name);
+ unset($info);
+
+ $storage_form_errors = DI::storage()->saveOptions($storage_opts_data);
+ if (count($storage_form_errors)) {
+ foreach ($storage_form_errors as $name => $err) {
+ notice('Storage backend, ' . $storage_opts[$name][1] . ': ' . $err);
}
- } else {
- info(L10n::t('Invalid storage backend setting value.'));
+ DI::baseUrl()->redirect('admin/site' . $active_panel);
}
+ } else {
+ info(L10n::t('Invalid storage backend setting value.'));
}
// Has the directory url changed? If yes, then resubmit the existing profiles there
{
parent::content($parameters);
- $a = DI::app();
-
/* Installed langs */
$lang_choices = L10n::getAvailableLanguages();
$optimize_max_tablesize = -1;
}
- $storage_backends = StorageManager::listBackends();
- /** @var $current_storage_backend \Friendica\Model\Storage\IStorage */
- $current_storage_backend = StorageManager::getBackend();
-
+ $current_storage_backend = DI::storage();
$available_storage_backends = [];
// show legacy option only if it is the current backend:
// once changed can't be selected anymore
- if ($current_storage_backend == '') {
+ if ($current_storage_backend == null) {
$available_storage_backends[''] = L10n::t('Database (legacy)');
}
- foreach ($storage_backends as $name => $class) {
- $available_storage_backends[$class] = $name;
+ foreach (DI::storageManager()->listBackends() as $name => $class) {
+ $available_storage_backends[$name] = $name;
}
- unset($storage_backends);
// build storage config form,
$storage_form_prefix = preg_replace('|[^a-zA-Z0-9]|' ,'', $current_storage_backend);
$storage_form = [];
if (!is_null($current_storage_backend) && $current_storage_backend != '') {
- foreach ($current_storage_backend::getOptions() as $name => $info) {
+ foreach ($current_storage_backend->getOptions() as $name => $info) {
$type = $info[0];
$info[0] = $storage_form_prefix . '_' . $name;
$info['type'] = $type;
'$relay_title' => L10n::t('Message Relay'),
'$relocate' => L10n::t('Relocate Instance'),
'$relocate_warning' => L10n::t('Warning! Advanced function. Could make this server unreachable.'),
- '$baseurl' => $a->getBaseURL(true),
+ '$baseurl' => DI::baseUrl()->get(true),
// name, label, value, help string, extra data...
'$sitename' => ['sitename', L10n::t('Site name'), Config::get('config', 'sitename'), ''],
'$banner' => ['banner', L10n::t('Banner/Logo'), $banner, ''],
'$shortcut_icon' => ['shortcut_icon', L10n::t('Shortcut icon'), Config::get('system', 'shortcut_icon'), L10n::t('Link to an icon that will be used for browsers.')],
'$touch_icon' => ['touch_icon', L10n::t('Touch icon'), Config::get('system', 'touch_icon'), L10n::t('Link to an icon that will be used for tablets and mobiles.')],
- '$additional_info' => ['additional_info', L10n::t('Additional Info'), $additional_info, L10n::t('For public servers: you can add additional information here that will be listed at %s/servers.', get_server())],
+ '$additional_info' => ['additional_info', L10n::t('Additional Info'), $additional_info, L10n::t('For public servers: you can add additional information here that will be listed at %s/servers.', Search::getGlobalDirectory())],
'$language' => ['language', L10n::t('System language'), Config::get('system', 'language'), '', $lang_choices],
'$theme' => ['theme', L10n::t('System theme'), Config::get('system', 'theme'), L10n::t('Default system theme - may be over-ridden by user profiles - <a href="/admin/themes" id="cnftheme">Change default theme settings</a>'), $theme_choices],
'$theme_mobile' => ['theme_mobile', L10n::t('Mobile system theme'), Config::get('system', 'mobile-theme', '---'), L10n::t('Theme for mobile devices'), $theme_choices_mobile],
'$proxy_disabled' => ['proxy_disabled', L10n::t('Disable picture proxy'), Config::get('system', 'proxy_disabled'), L10n::t('The picture proxy increases performance and privacy. It shouldn\'t be used on systems with very low bandwidth.')],
'$only_tag_search' => ['only_tag_search', L10n::t('Only search in tags'), Config::get('system', 'only_tag_search'), L10n::t('On large systems the text search can slow down the system extremely.')],
- '$relocate_url' => ['relocate_url', L10n::t('New base url'), $a->getBaseURL(), L10n::t('Change base url for this server. Sends relocate message to all Friendica and Diaspora* contacts of all users.')],
+ '$relocate_url' => ['relocate_url', L10n::t('New base url'), DI::baseUrl()->get(), L10n::t('Change base url for this server. Sends relocate message to all Friendica and Diaspora* contacts of all users.')],
'$rino' => ['rino', L10n::t('RINO Encryption'), intval(Config::get('system', 'rino_encrypt')), L10n::t('Encryption layer between nodes.'), [0 => L10n::t('Disabled'), 1 => L10n::t('Enabled')]],
'$worker_queues' => ['worker_queues', L10n::t('Maximum number of parallel workers'), Config::get('system', 'worker_queues'), L10n::t('On shared hosters set this to %d. On larger systems, values of %d are great. Default value is %d.', 5, 20, 10)],
'$worker_dont_fork' => ['worker_dont_fork', L10n::t('Don\'t use "proc_open" with the worker'), Config::get('system', 'worker_dont_fork'), L10n::t('Enable this if your system doesn\'t allow the use of "proc_open". This can happen on shared hosters. If this is enabled you should increase the frequency of worker calls in your crontab.')],
'$worker_fastlane' => ['worker_fastlane', L10n::t('Enable fastlane'), Config::get('system', 'worker_fastlane'), L10n::t('When enabed, the fastlane mechanism starts an additional worker if processes with higher priority are blocked by processes of lower priority.')],
- '$worker_frontend' => ['worker_frontend', L10n::t('Enable frontend worker'), Config::get('system', 'frontend_worker'), L10n::t('When enabled the Worker process is triggered when backend access is performed (e.g. messages being delivered). On smaller sites you might want to call %s/worker on a regular basis via an external cron job. You should only enable this option if you cannot utilize cron/scheduled jobs on your server.', $a->getBaseURL())],
+ '$worker_frontend' => ['worker_frontend', L10n::t('Enable frontend worker'), Config::get('system', 'frontend_worker'), L10n::t('When enabled the Worker process is triggered when backend access is performed (e.g. messages being delivered). On smaller sites you might want to call %s/worker on a regular basis via an external cron job. You should only enable this option if you cannot utilize cron/scheduled jobs on your server.', DI::baseUrl()->get())],
'$relay_subscribe' => ['relay_subscribe', L10n::t('Subscribe to relay'), Config::get('system', 'relay_subscribe'), L10n::t('Enables the receiving of public posts from the relay. They will be included in the search, subscribed tags and on the global community page.')],
'$relay_server' => ['relay_server', L10n::t('Relay server'), Config::get('system', 'relay_server', 'https://relay.diasp.org'), L10n::t('Address of the relay server where public posts should be send to. For example https://relay.diasp.org')],