]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Admin/Site.php
New option to disallow
[friendica.git] / src / Module / Admin / Site.php
index c1ba01d38343a02ea3c5499b0f79784f5acb3414..d4d07b25bcb2849839846d1d61849c9084ad4737 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2023, the Friendica project
+ * @copyright Copyright (C) 2010-2024, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -92,6 +92,7 @@ class Site extends BaseAdmin
                $private_addons         = !empty($_POST['private_addons']);
                $disable_embedded       = !empty($_POST['disable_embedded']);
                $allow_users_remote_self = !empty($_POST['allow_users_remote_self']);
+               $allow_relay_channels   = !empty($_POST['allow_relay_channels']);
                $adjust_poll_frequency  = !empty($_POST['adjust_poll_frequency']);
                $min_poll_interval      = (!empty($_POST['min_poll_interval']) ? intval(trim($_POST['min_poll_interval']))                : 0);
                $explicit_content       = !empty($_POST['explicit_content']);
@@ -106,6 +107,7 @@ class Site extends BaseAdmin
                $register_notification  = !empty($_POST['register_notification']);
                $community_page_style   = (!empty($_POST['community_page_style']) ? intval(trim($_POST['community_page_style'])) : 0);
                $max_author_posts_community_page = (!empty($_POST['max_author_posts_community_page']) ? intval(trim($_POST['max_author_posts_community_page'])) : 0);
+               $max_server_posts_community_page = (!empty($_POST['max_server_posts_community_page']) ? intval(trim($_POST['max_server_posts_community_page'])) : 0);
 
                $verifyssl              = !empty($_POST['verifyssl']);
                $proxyuser              = (!empty($_POST['proxyuser'])              ? trim($_POST['proxyuser']) : '');
@@ -147,8 +149,10 @@ class Site extends BaseAdmin
                $worker_load_cooldown = (!empty($_POST['worker_load_cooldown'])       ? intval($_POST['worker_load_cooldown'])          : 0);
                $worker_fastlane      = !empty($_POST['worker_fastlane']);
                $decoupled_receiver   = (!empty($_POST['decoupled_receiver'])         ? intval(trim($_POST['decoupled_receiver'])) : false);
-               $cron_interval        = (!empty($_POST['cron_interval'])              ? intval($_POST['cron_interval'])            : 0);
+               $cron_interval        = (!empty($_POST['cron_interval'])              ? intval($_POST['cron_interval'])            : 1);
                $worker_defer_limit   = (!empty($_POST['worker_defer_limit'])         ? intval($_POST['worker_defer_limit'])       : 15);
+               $worker_fetch_limit   = (!empty($_POST['worker_fetch_limit'])         ? intval($_POST['worker_fetch_limit'])       : 1);
+               
 
                $relay_directly    = !empty($_POST['relay_directly']);
                $relay_scope       = (!empty($_POST['relay_scope'])       ? trim($_POST['relay_scope'])        : '');
@@ -259,6 +263,7 @@ class Site extends BaseAdmin
                $transactionConfig->set('system', 'enotify_no_content'     , $enotify_no_content);
                $transactionConfig->set('system', 'disable_embedded'       , $disable_embedded);
                $transactionConfig->set('system', 'allow_users_remote_self', $allow_users_remote_self);
+               $transactionConfig->set('system', 'allow_relay_channels'   , $allow_relay_channels);
                $transactionConfig->set('system', 'adjust_poll_frequency'  , $adjust_poll_frequency);
                $transactionConfig->set('system', 'min_poll_interval'      , $min_poll_interval);
                $transactionConfig->set('system', 'explicit_content'       , $explicit_content);
@@ -274,6 +279,7 @@ class Site extends BaseAdmin
                $transactionConfig->set('system', 'register_notification'  , $register_notification);
                $transactionConfig->set('system', 'community_page_style'   , $community_page_style);
                $transactionConfig->set('system', 'max_author_posts_community_page', $max_author_posts_community_page);
+               $transactionConfig->set('system', 'max_server_posts_community_page', $max_server_posts_community_page);
                $transactionConfig->set('system', 'verifyssl'              , $verifyssl);
                $transactionConfig->set('system', 'proxyuser'              , $proxyuser);
                $transactionConfig->set('system', 'proxy'                  , $proxy);
@@ -317,9 +323,10 @@ class Site extends BaseAdmin
                $transactionConfig->set('system', 'worker_load_cooldown', $worker_load_cooldown);
                $transactionConfig->set('system', 'worker_fastlane'     , $worker_fastlane);
                $transactionConfig->set('system', 'decoupled_receiver'  , $decoupled_receiver);
-               $transactionConfig->set('system', 'cron_interval'       , $cron_interval);
+               $transactionConfig->set('system', 'cron_interval'       , max($cron_interval, 1));
                $transactionConfig->set('system', 'worker_defer_limit'  , $worker_defer_limit);
-
+               $transactionConfig->set('system', 'worker_fetch_limit'  , max($worker_fetch_limit, 1));
+               
                $transactionConfig->set('system', 'relay_directly'                , $relay_directly);
                $transactionConfig->set('system', 'relay_scope'                   , $relay_scope);
                $transactionConfig->set('system', 'relay_server_tags'             , $relay_server_tags);
@@ -327,7 +334,7 @@ class Site extends BaseAdmin
                $transactionConfig->set('system', 'relay_user_tags'               , $relay_user_tags);
                $transactionConfig->set('system', 'relay_deny_undetected_language', $relay_deny_undetected_language);
                $transactionConfig->set('system', 'relay_language_quality'        , $relay_language_quality);
-               $transactionConfig->set('system', 'relay_languages'               , $relay_languages);
+               $transactionConfig->set('system', 'relay_languages'               , max($relay_languages, 1));
 
                $transactionConfig->set('channel', 'engagement_hours'       , $engagement_hours);
                $transactionConfig->set('channel', 'engagement_post_limit'  , $engagement_post_limit);
@@ -509,6 +516,7 @@ class Site extends BaseAdmin
                        '$blocked_tags'           => ['blocked_tags', DI::l10n()->t('Blocked tags for trending tags'), DI::config()->get('system', 'blocked_tags'), DI::l10n()->t("Comma separated list of hashtags that shouldn't be displayed in the trending tags.")],
                        '$cache_contact_avatar'   => ['cache_contact_avatar', DI::l10n()->t('Cache contact avatars'), DI::config()->get('system', 'cache_contact_avatar'), DI::l10n()->t('Locally store the avatar pictures of the contacts. This uses a lot of storage space but it increases the performance.')],
                        '$allow_users_remote_self'=> ['allow_users_remote_self', DI::l10n()->t('Allow Users to set remote_self'), DI::config()->get('system', 'allow_users_remote_self'), DI::l10n()->t('With checking this, every user is allowed to mark every contact as a remote_self in the repair contact dialog. Setting this flag on a contact causes mirroring every posting of that contact in the users stream.')],
+                       '$allow_relay_channels'   => ['allow_relay_channels', DI::l10n()->t('Allow Users to set up relay channels'), DI::config()->get('system', 'allow_relay_channels'), DI::l10n()->t('If enabled, it is possible to create relay users that are used to reshare content based on user defined channels.')],
                        '$adjust_poll_frequency'  => ['adjust_poll_frequency', DI::l10n()->t('Adjust the feed poll frequency'), DI::config()->get('system', 'adjust_poll_frequency'), DI::l10n()->t('Automatically detect and set the best feed poll frequency.')],
                        '$min_poll_interval'      => ['min_poll_interval', DI::l10n()->t('Minimum poll interval'), DI::config()->get('system', 'min_poll_interval'), DI::l10n()->t('Minimal distance in minutes between two polls for mail and feed contacts. Reasonable values are between 1 and 59.')],
                        '$enable_multi_reg'       => ['enable_multi_reg', DI::l10n()->t('Enable multiple registrations'), !DI::config()->get('system', 'block_extended_register'), DI::l10n()->t('Enable users to register additional accounts for use as pages.')],
@@ -516,7 +524,8 @@ class Site extends BaseAdmin
                        '$enable_regfullname'     => ['enable_regfullname', DI::l10n()->t('Enable full name check'), !DI::config()->get('system', 'no_regfullname'), DI::l10n()->t('Prevents users from registering with a display name with fewer than two parts separated by spaces.')],
                        '$register_notification'  => ['register_notification', DI::l10n()->t('Email administrators on new registration'), DI::config()->get('system', 'register_notification'), DI::l10n()->t('If enabled and the system is set to an open registration, an email for each new registration is sent to the administrators.')],
                        '$community_page_style'   => ['community_page_style', DI::l10n()->t('Community pages for visitors'), DI::config()->get('system', 'community_page_style'), DI::l10n()->t('Which community pages should be available for visitors. Local users always see both pages.'), $community_page_style_choices],
-                       '$max_author_posts_community_page' => ['max_author_posts_community_page', DI::l10n()->t('Posts per user on community page'), DI::config()->get('system', 'max_author_posts_community_page'), DI::l10n()->t('The maximum number of posts per user on the community page. (Not valid for "Global Community")')],
+                       '$max_author_posts_community_page' => ['max_author_posts_community_page', DI::l10n()->t('Posts per user on community page'), DI::config()->get('system', 'max_author_posts_community_page'), DI::l10n()->t('The maximum number of posts per user on the local community page. This is useful, when a single user floods the local community page.')],
+                       '$max_server_posts_community_page' => ['max_server_posts_community_page', DI::l10n()->t('Posts per server on community page'), DI::config()->get('system', 'max_server_posts_community_page'), DI::l10n()->t('The maximum number of posts per server on the global community page. This is useful, when posts from a single server flood the global community page.')],
                        '$mail_able'              => function_exists('imap_open'),
                        '$mail_enabled'           => ['mail_enabled', DI::l10n()->t('Enable Mail support'), !DI::config()->get('system', 'imap_disabled', !function_exists('imap_open')), DI::l10n()->t('Enable built-in mail support to poll IMAP folders and to reply via mail.')],
                        '$mail_not_able'          => DI::l10n()->t('Mail support can\'t be enabled because the PHP IMAP module is not installed.'),
@@ -566,8 +575,9 @@ class Site extends BaseAdmin
                        '$worker_load_cooldown'   => ['worker_load_cooldown', DI::l10n()->t('Maximum load for workers'), DI::config()->get('system', 'worker_load_cooldown'), DI::l10n()->t('Maximum load that causes a cooldown before each worker function call.')],
                        '$worker_fastlane'        => ['worker_fastlane', DI::l10n()->t('Enable fastlane'), DI::config()->get('system', 'worker_fastlane'), DI::l10n()->t('When enabed, the fastlane mechanism starts an additional worker if processes with higher priority are blocked by processes of lower priority.')],
                        '$decoupled_receiver'     => ['decoupled_receiver', DI::l10n()->t('Decoupled receiver'), DI::config()->get('system', 'decoupled_receiver'), DI::l10n()->t('Decouple incoming ActivityPub posts by processing them in the background via a worker process. Only enable this on fast systems.')],
-                       '$cron_interval'          => ['cron_interval', DI::l10n()->t('Cron interval'), DI::config()->get('system', 'decoupled_receiver'), DI::l10n()->t('Minimal period in minutes between two calls of the "Cron" worker job.')],
+                       '$cron_interval'          => ['cron_interval', DI::l10n()->t('Cron interval'), DI::config()->get('system', 'cron_interval'), DI::l10n()->t('Minimal period in minutes between two calls of the "Cron" worker job.')],
                        '$worker_defer_limit'     => ['worker_defer_limit', DI::l10n()->t('Worker defer limit'), DI::config()->get('system', 'worker_defer_limit'), DI::l10n()->t('Per default the systems tries delivering for 15 times before dropping it.')],
+                       '$worker_fetch_limit'     => ['worker_fetch_limit', DI::l10n()->t('Worker fetch limit'), DI::config()->get('system', 'worker_fetch_limit'), DI::l10n()->t('Number of worker tasks that are fetched in a single query. Higher values should increase the performance, too high values will mostly likely decrease it. Only change it, when you know how to measure the performance of your system.')],
 
                        '$relay_directly'                 => ['relay_directly', DI::l10n()->t('Direct relay transfer'), DI::config()->get('system', 'relay_directly'), DI::l10n()->t('Enables the direct transfer to other servers without using the relay servers')],
                        '$relay_scope'                    => ['relay_scope', DI::l10n()->t('Relay scope'), DI::config()->get('system', 'relay_scope'), DI::l10n()->t('Can be "all" or "tags". "all" means that every public post should be received. "tags" means that only posts with selected tags should be received.'), [Relay::SCOPE_NONE => DI::l10n()->t('Disabled'), Relay::SCOPE_ALL => DI::l10n()->t('all'), Relay::SCOPE_TAGS => DI::l10n()->t('tags')]],
@@ -578,10 +588,10 @@ class Site extends BaseAdmin
                        '$relay_language_quality'         => ['relay_language_quality', DI::l10n()->t('Language Quality'), DI::config()->get('system', 'relay_language_quality'), DI::l10n()->t('The minimum language quality that is required to accept the post.')],
                        '$relay_languages'                => ['relay_languages', DI::l10n()->t('Number of languages for the language detection'), DI::config()->get('system', 'relay_languages'), DI::l10n()->t('The system detects a list of languages per post. Only if the desired languages are in the list, the message will be accepted. The higher the number, the more posts will be falsely detected.')],
 
-                       '$engagement_hours'        => ['engagement_hours', DI::l10n()->t('Maximum age of channel'), DI::config()->get('channel', 'engagement_hours'), DI::l10n()->t('This defines the maximum age of items that should be displayed in channels. This affects the channel performance.')],
+                       '$engagement_hours'        => ['engagement_hours', DI::l10n()->t('Maximum age of channel'), DI::config()->get('channel', 'engagement_hours'), DI::l10n()->t('This defines the maximum age in hours of items that should be displayed in channels. This affects the channel performance.')],
                        '$engagement_post_limit'   => ['engagement_post_limit', DI::l10n()->t('Maximum number of channel posts'), DI::config()->get('channel', 'engagement_post_limit'), DI::l10n()->t('For performance reasons, the channels use a dedicated table to store content. The higher the value the slower the channels.')],
                        '$interaction_score_days'  => ['interaction_score_days', DI::l10n()->t('Interaction score days'), DI::config()->get('channel', 'interaction_score_days'), DI::l10n()->t('Number of days that are used to calculate the interaction score.')],
-                       '$max_posts_per_author'    => ['max_posts_per_author', DI::l10n()->t('Maximum number of posts per author'), DI::config()->get('channel', 'max_posts_per_author'), DI::l10n()->t('Maximum number of posts per page by author. If there are more posts, then the post with the most interactions will be displayed.')],
+                       '$max_posts_per_author'    => ['max_posts_per_author', DI::l10n()->t('Maximum number of posts per author'), DI::config()->get('channel', 'max_posts_per_author'), DI::l10n()->t('Maximum number of posts per page by author if the contact frequency is set to "Display only few posts". If there are more posts, then the post with the most interactions will be displayed.')],
                        '$sharer_interaction_days' => ['sharer_interaction_days', DI::l10n()->t('Sharer interaction days'), DI::config()->get('channel', 'sharer_interaction_days'), DI::l10n()->t('Number of days of the last interaction that are used to define which sharers are used for the "sharers of sharers" channel.')],
 
                        '$form_security_token'    => self::getFormSecurityToken('admin_site'),