Move Config::get() to DI::config()->get()

This commit is contained in:
nupplaPhil
2020-01-19 21:21:13 +01:00
parent 5d294e8be8
commit 6c36fd9e01
126 changed files with 581 additions and 596 deletions

View File

@@ -1096,7 +1096,7 @@ function api_statuses_update($type)
if (!$parent) {
// Check for throttling (maximum posts per day, week and month)
$throttle_day = Config::get('system', 'throttle_limit_day');
$throttle_day = DI::config()->get('system', 'throttle_limit_day');
if ($throttle_day > 0) {
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60);
@@ -1110,7 +1110,7 @@ function api_statuses_update($type)
}
}
$throttle_week = Config::get('system', 'throttle_limit_week');
$throttle_week = DI::config()->get('system', 'throttle_limit_week');
if ($throttle_week > 0) {
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60*7);
@@ -1124,7 +1124,7 @@ function api_statuses_update($type)
}
}
$throttle_month = Config::get('system', 'throttle_limit_month');
$throttle_month = DI::config()->get('system', 'throttle_limit_month');
if ($throttle_month > 0) {
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60*30);
@@ -2739,7 +2739,7 @@ function api_get_entitities(&$text, $bbcode)
if ($image) {
// If image cache is activated, then use the following sizes:
// thumb (150), small (340), medium (600) and large (1024)
if (!Config::get("system", "proxy_disabled")) {
if (!DI::config()->get("system", "proxy_disabled")) {
$media_url = ProxyUtils::proxifyUrl($url);
$sizes = [];
@@ -3572,15 +3572,15 @@ api_register_func('api/friendships/incoming', 'api_friendships_incoming', true);
*/
function api_statusnet_config($type)
{
$name = Config::get('config', 'sitename');
$name = DI::config()->get('config', 'sitename');
$server = DI::baseUrl()->getHostname();
$logo = DI::baseUrl() . '/images/friendica-64.png';
$email = Config::get('config', 'admin_email');
$closed = intval(Config::get('config', 'register_policy')) === \Friendica\Module\Register::CLOSED ? 'true' : 'false';
$private = Config::get('system', 'block_public') ? 'true' : 'false';
$textlimit = (string) Config::get('config', 'api_import_size', Config::get('config', 'max_import_size', 200000));
$ssl = Config::get('system', 'have_ssl') ? 'true' : 'false';
$sslserver = Config::get('system', 'have_ssl') ? str_replace('http:', 'https:', DI::baseUrl()) : '';
$email = DI::config()->get('config', 'admin_email');
$closed = intval(DI::config()->get('config', 'register_policy')) === \Friendica\Module\Register::CLOSED ? 'true' : 'false';
$private = DI::config()->get('system', 'block_public') ? 'true' : 'false';
$textlimit = (string) DI::config()->get('config', 'api_import_size', DI::config()->get('config', 'max_import_size', 200000));
$ssl = DI::config()->get('system', 'have_ssl') ? 'true' : 'false';
$sslserver = DI::config()->get('system', 'have_ssl') ? str_replace('http:', 'https:', DI::baseUrl()) : '';
$config = [
'site' => ['name' => $name,'server' => $server, 'theme' => 'default', 'path' => '',
@@ -4627,7 +4627,7 @@ function api_account_update_profile_image($type)
// Update global directory in background
$url = DI::baseUrl() . '/profile/' . DI::app()->user['nickname'];
if ($url && strlen(Config::get('system', 'directory'))) {
if ($url && strlen(DI::config()->get('system', 'directory'))) {
Worker::add(PRIORITY_LOW, "Directory", $url);
}
@@ -4684,7 +4684,7 @@ function api_account_update_profile($type)
Worker::add(PRIORITY_LOW, 'ProfileUpdate', $local_user);
// Update global directory in background
if ($api_user['url'] && strlen(Config::get('system', 'directory'))) {
if ($api_user['url'] && strlen(DI::config()->get('system', 'directory'))) {
Worker::add(PRIORITY_LOW, "Directory", $api_user['url']);
}
@@ -4792,7 +4792,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
throw new InternalServerErrorException("image size exceeds PHP config settings, file was rejected by server");
}
// check against max upload size within Friendica instance
$maximagesize = Config::get('system', 'maximagesize');
$maximagesize = DI::config()->get('system', 'maximagesize');
if ($maximagesize && ($filesize > $maximagesize)) {
$formattedBytes = Strings::formatBytes($maximagesize);
throw new InternalServerErrorException("image size exceeds Friendica config setting (uploaded size: $formattedBytes)");
@@ -4810,7 +4810,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
@unlink($src);
// check max length of images on server
$max_length = Config::get('system', 'max_image_length');
$max_length = DI::config()->get('system', 'max_image_length');
if (!$max_length) {
$max_length = MAX_IMAGE_LENGTH;
}
@@ -6119,7 +6119,7 @@ function api_friendica_profile_show($type)
// retrieve general information about profiles for user
$multi_profiles = Feature::isEnabled(api_user(), 'multi_profiles');
$directory = Config::get('system', 'directory');
$directory = DI::config()->get('system', 'directory');
// get data of the specified profile id or all profiles of the user if not specified
if ($profile_id != 0) {

View File

@@ -850,7 +850,7 @@ function conversation_fetch_comments($thread_items, $pinned) {
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
function conversation_add_children(array $parents, $block_authors, $order, $uid) {
$max_comments = Config::get('system', 'max_comments', 100);
$max_comments = DI::config()->get('system', 'max_comments', 100);
$params = ['order' => ['uid', 'commented' => true]];

View File

@@ -60,9 +60,9 @@ function notification($params)
$product = FRIENDICA_PLATFORM;
$siteurl = DI::baseUrl()->get(true);
$thanks = $l10n->t('Thank You,');
$sitename = Config::get('config', 'sitename');
if (Config::get('config', 'admin_name')) {
$site_admin = $l10n->t('%1$s, %2$s Administrator', Config::get('config', 'admin_name'), $sitename);
$sitename = DI::config()->get('config', 'sitename');
if (DI::config()->get('config', 'admin_name')) {
$site_admin = $l10n->t('%1$s, %2$s Administrator', DI::config()->get('config', 'admin_name'), $sitename);
} else {
$site_admin = $l10n->t('%s Administrator', $sitename);
}
@@ -587,7 +587,7 @@ function notification($params)
// check whether sending post content in email notifications is allowed
// always true for SYSTEM_EMAIL
$content_allowed = ((!Config::get('system', 'enotify_no_content')) || ($params['type'] == SYSTEM_EMAIL));
$content_allowed = ((!DI::config()->get('system', 'enotify_no_content')) || ($params['type'] == SYSTEM_EMAIL));
// load the template for private message notifications
$tpl = Renderer::getMarkupTemplate('email_notify_html.tpl');

View File

@@ -73,7 +73,7 @@ function add_page_info_data(array $data, $no_photos = false)
$preview = str_replace(["[", "]"], ["[", "]"], htmlentities($data["images"][0]["src"], ENT_QUOTES, 'UTF-8', false));
// if the preview picture is larger than 500 pixels then show it in a larger mode
// But only, if the picture isn't higher than large (To prevent huge posts)
if (!Config::get('system', 'always_show_preview') && ($data["images"][0]["width"] >= 500)
if (!DI::config()->get('system', 'always_show_preview') && ($data["images"][0]["width"] >= 500)
&& ($data["images"][0]["width"] >= $data["images"][0]["height"])) {
$text .= " image='".$preview."'";
} else {