Remove deprecated App::getBaseURL() - process methods to DI::baseUrl()->get()

This commit is contained in:
nupplaPhil 2019-12-16 01:05:15 +01:00
parent e57a87f224
commit e944d7bed6
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
43 changed files with 76 additions and 120 deletions

View file

@ -101,7 +101,7 @@ class Details extends BaseAdminModule
'$page' => L10n::t('Addons'),
'$toggle' => L10n::t('Toggle'),
'$settings' => L10n::t('Settings'),
'$baseurl' => $a->getBaseURL(true),
'$baseurl' => DI::baseUrl()->get(true),
'$addon' => $addon,
'$status' => $status,

View file

@ -14,8 +14,6 @@ class Index extends BaseAdminModule
{
parent::content($parameters);
$a = DI::app();
// reload active themes
if (!empty($_GET['action'])) {
parent::checkFormSecurityTokenRedirectOnError('/admin/addons', 'admin_addons', 't');
@ -52,7 +50,7 @@ class Index extends BaseAdminModule
'$page' => L10n::t('Addons'),
'$submit' => L10n::t('Save Settings'),
'$reload' => L10n::t('Reload active addons'),
'$baseurl' => $a->getBaseURL(true),
'$baseurl' => DI::baseUrl()->get(true),
'$function' => 'addons',
'$addons' => $addons,
'$pcount' => count($addons),

View file

@ -76,7 +76,7 @@ class Contact extends BaseAdminModule
'$form_security_token' => parent::getFormSecurityToken('admin_contactblock'),
// values //
'$baseurl' => $a->getBaseURL(true),
'$baseurl' => DI::baseUrl()->get(true),
'$contacts' => $contacts,
'$total_contacts' => L10n::tt('%s total blocked contact', '%s total blocked contacts', $total),

View file

@ -55,8 +55,6 @@ class Server extends BaseAdminModule
{
parent::content($parameters);
$a = DI::app();
$blocklist = Config::get('system', 'blocklist');
$blocklistform = [];
if (is_array($blocklist)) {
@ -91,7 +89,7 @@ class Server extends BaseAdminModule
'$threason' => L10n::t('Reason for the block'),
'$delentry' => L10n::t('Delete entry from blocklist'),
'$entries' => $blocklistform,
'$baseurl' => $a->getBaseURL(true),
'$baseurl' => DI::baseUrl()->get(true),
'$confirm_delete' => L10n::t('Delete entry from blocklist?'),
'$form_security_token' => parent::getFormSecurityToken("admin_blocklist")
]);

View file

@ -88,13 +88,13 @@ class DBSync extends BaseAdminModule
if (!count($failed)) {
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/dbsync/structure_check.tpl'), [
'$base' => $a->getBaseURL(true),
'$base' => DI::baseUrl()->get(true),
'$banner' => L10n::t('No failed updates.'),
'$check' => L10n::t('Check database structure'),
]);
} else {
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/dbsync/failed_updates.tpl'), [
'$base' => $a->getBaseURL(true),
'$base' => DI::baseUrl()->get(true),
'$banner' => L10n::t('Failed Updates'),
'$desc' => L10n::t('This does not include updates prior to 1139, which did not return a status.'),
'$mark' => L10n::t("Mark success \x28if update was manually applied\x29"),

View file

@ -42,8 +42,6 @@ class Settings extends BaseAdminModule
{
parent::content($parameters);
$a = DI::app();
$log_choices = [
LogLevel::ERROR => 'Error',
LogLevel::WARNING => 'Warning',
@ -65,7 +63,7 @@ class Settings extends BaseAdminModule
'$page' => L10n::t('Logs'),
'$submit' => L10n::t('Save Settings'),
'$clear' => L10n::t('Clear'),
'$baseurl' => $a->getBaseURL(true),
'$baseurl' => DI::baseUrl()->get(true),
'$logname' => Config::get('system', 'logfile'),
// see /help/smarty3-templates#1_1 on any Friendica node
'$debugging' => ['debugging', L10n::t("Enable Debugging"), Config::get('system', 'debugging'), ""],

View file

@ -56,7 +56,7 @@ class Site extends BaseAdminModule
* 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));
@ -417,8 +417,6 @@ class Site extends BaseAdminModule
{
parent::content($parameters);
$a = DI::app();
/* Installed langs */
$lang_choices = L10n::getAvailableLanguages();
@ -578,7 +576,7 @@ class Site extends BaseAdminModule
'$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'), ''],
@ -661,14 +659,14 @@ class Site extends BaseAdminModule
'$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')],

View file

@ -63,18 +63,18 @@ class Summary extends BaseAdminModule
// Legacy config file warning
if (file_exists('.htconfig.php')) {
$warningtext[] = L10n::t('Friendica\'s configuration now is stored in config/local.config.php, please copy config/local-sample.config.php and move your config from <code>.htconfig.php</code>. See <a href="%s">the Config help page</a> for help with the transition.', $a->getBaseURL() . '/help/Config');
$warningtext[] = L10n::t('Friendica\'s configuration now is stored in config/local.config.php, please copy config/local-sample.config.php and move your config from <code>.htconfig.php</code>. See <a href="%s">the Config help page</a> for help with the transition.', DI::baseUrl()->get() . '/help/Config');
}
if (file_exists('config/local.ini.php')) {
$warningtext[] = L10n::t('Friendica\'s configuration now is stored in config/local.config.php, please copy config/local-sample.config.php and move your config from <code>config/local.ini.php</code>. See <a href="%s">the Config help page</a> for help with the transition.', $a->getBaseURL() . '/help/Config');
$warningtext[] = L10n::t('Friendica\'s configuration now is stored in config/local.config.php, please copy config/local-sample.config.php and move your config from <code>config/local.ini.php</code>. See <a href="%s">the Config help page</a> for help with the transition.', DI::baseUrl()->get() . '/help/Config');
}
// Check server vitality
if (!self::checkSelfHostMeta()) {
$well_known = $a->getBaseURL() . '/.well-known/host-meta';
$well_known = DI::baseUrl()->get() . '/.well-known/host-meta';
$warningtext[] = L10n::t('<a href="%s">%s</a> is not reachable on your system. This is a severe configuration issue that prevents server to server communication. See <a href="%s">the installation page</a> for help.',
$well_known, $well_known, $a->getBaseURL() . '/help/Install');
$well_known, $well_known, DI::baseUrl()->get() . '/help/Install');
}
// Check logfile permission
@ -208,7 +208,7 @@ class Summary extends BaseAdminModule
private static function checkSelfHostMeta()
{
// Fetch the host-meta to check if this really is a vital server
return Network::curl(DI::app()->getBaseURL() . '/.well-known/host-meta')->isSuccess();
return Network::curl(DI::baseUrl()->get() . '/.well-known/host-meta')->isSuccess();
}
}

View file

@ -106,7 +106,7 @@ class Details extends BaseAdminModule
'$page' => L10n::t('Themes'),
'$toggle' => L10n::t('Toggle'),
'$settings' => L10n::t('Settings'),
'$baseurl' => $a->getBaseURL(true),
'$baseurl' => DI::baseUrl()->get(true),
'$addon' => $theme,
'$status' => $status,
'$action' => $action,

View file

@ -16,13 +16,11 @@ class Index extends BaseAdminModule
{
parent::content($parameters);
$a = DI::app();
$allowed_themes = Theme::getAllowedList();
// reload active themes
if (!empty($_GET['action'])) {
parent::checkFormSecurityTokenRedirectOnError($a->getBaseURL() . '/admin/themes', 'admin_themes', 't');
parent::checkFormSecurityTokenRedirectOnError(DI::baseUrl()->get() . '/admin/themes', 'admin_themes', 't');
switch ($_GET['action']) {
case 'reload':
@ -97,7 +95,7 @@ class Index extends BaseAdminModule
'$page' => L10n::t('Themes'),
'$submit' => L10n::t('Save Settings'),
'$reload' => L10n::t('Reload active themes'),
'$baseurl' => $a->getBaseURL(true),
'$baseurl' => DI::baseUrl()->get(true),
'$function' => 'themes',
'$addons' => $addons,
'$pcount' => count($themes),

View file

@ -20,8 +20,6 @@ class Users extends BaseAdminModule
{
parent::post($parameters);
$a = DI::app();
$pending = $_POST['pending'] ?? [];
$users = $_POST['user'] ?? [];
$nu_name = $_POST['new_user_name'] ?? '';
@ -78,7 +76,7 @@ class Users extends BaseAdminModule
Thank you and welcome to %4$s.'));
$preamble = sprintf($preamble, $user['username'], Config::get('config', 'sitename'));
$body = sprintf($body, $a->getBaseURL(), $user['nickname'], $result['password'], Config::get('config', 'sitename'));
$body = sprintf($body, DI::baseUrl()->get(), $user['nickname'], $result['password'], Config::get('config', 'sitename'));
notification([
'type' => SYSTEM_EMAIL,
@ -306,7 +304,7 @@ class Users extends BaseAdminModule
'$form_security_token' => parent::getFormSecurityToken('admin_users'),
// values //
'$baseurl' => $a->getBaseURL(true),
'$baseurl' => DI::baseUrl()->get(true),
'$pending' => $pending,
'deleted' => $deleted,