mirror of
https://github.com/friendica/friendica
synced 2025-12-07 12:17:12 +01:00
Merge pull request #8142 from nupplaphil/task/di_config
CleanUp Config namespace
This commit is contained in:
commit
04d620fc2f
207 changed files with 1276 additions and 1439 deletions
|
|
@ -8,7 +8,6 @@
|
|||
*/
|
||||
|
||||
use Dice\Dice;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
|
|
@ -44,9 +43,9 @@ if (DI::mode()->isInstall()) {
|
|||
die("Friendica isn't properly installed yet.\n");
|
||||
}
|
||||
|
||||
Config::load();
|
||||
DI::config()->load();
|
||||
|
||||
if (empty(Config::get('system', 'pidfile'))) {
|
||||
if (empty(DI::config()->get('system', 'pidfile'))) {
|
||||
die(<<<TXT
|
||||
Please set system.pidfile in config/local.config.php. For example:
|
||||
|
||||
|
|
@ -57,7 +56,7 @@ TXT
|
|||
);
|
||||
}
|
||||
|
||||
$pidfile = Config::get('system', 'pidfile');
|
||||
$pidfile = DI::config()->get('system', 'pidfile');
|
||||
|
||||
if (in_array("start", $_SERVER["argv"])) {
|
||||
$mode = "start";
|
||||
|
|
@ -88,7 +87,7 @@ if (is_readable($pidfile)) {
|
|||
}
|
||||
|
||||
if (empty($pid) && in_array($mode, ["stop", "status"])) {
|
||||
Config::set('system', 'worker_daemon_mode', false);
|
||||
DI::config()->set('system', 'worker_daemon_mode', false);
|
||||
die("Pidfile wasn't found. Is the daemon running?\n");
|
||||
}
|
||||
|
||||
|
|
@ -99,7 +98,7 @@ if ($mode == "status") {
|
|||
|
||||
unlink($pidfile);
|
||||
|
||||
Config::set('system', 'worker_daemon_mode', false);
|
||||
DI::config()->set('system', 'worker_daemon_mode', false);
|
||||
die("Daemon process $pid isn't running.\n");
|
||||
}
|
||||
|
||||
|
|
@ -110,7 +109,7 @@ if ($mode == "stop") {
|
|||
|
||||
Logger::notice("Worker daemon process was killed", ["pid" => $pid]);
|
||||
|
||||
Config::set('system', 'worker_daemon_mode', false);
|
||||
DI::config()->set('system', 'worker_daemon_mode', false);
|
||||
die("Worker daemon process $pid was killed.\n");
|
||||
}
|
||||
|
||||
|
|
@ -153,12 +152,12 @@ if (!$foreground) {
|
|||
DBA::reconnect();
|
||||
}
|
||||
|
||||
Config::set('system', 'worker_daemon_mode', true);
|
||||
DI::config()->set('system', 'worker_daemon_mode', true);
|
||||
|
||||
// Just to be sure that this script really runs endlessly
|
||||
set_time_limit(0);
|
||||
|
||||
$wait_interval = intval(Config::get('system', 'cron_interval', 5)) * 60;
|
||||
$wait_interval = intval(DI::config()->get('system', 'cron_interval', 5)) * 60;
|
||||
|
||||
$do_cron = true;
|
||||
$last_cron = 0;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
use Dice\Dice;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Update;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\DI;
|
||||
|
|
@ -46,7 +45,7 @@ if (!DI::mode()->has(App\Mode::MAINTENANCEDISABLED)) {
|
|||
return;
|
||||
}
|
||||
|
||||
DI::baseUrl()->saveByURL(Config::get('system', 'url'));
|
||||
DI::baseUrl()->saveByURL(DI::config()->get('system', 'url'));
|
||||
|
||||
$spawn = array_key_exists('s', $options) || array_key_exists('spawn', $options);
|
||||
|
||||
|
|
|
|||
19
boot.php
19
boot.php
|
|
@ -17,7 +17,6 @@
|
|||
* easily as email does today.
|
||||
*/
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
|
|
@ -383,7 +382,7 @@ function is_site_admin()
|
|||
{
|
||||
$a = DI::app();
|
||||
|
||||
$admin_email = Config::get('config', 'admin_email');
|
||||
$admin_email = DI::config()->get('config', 'admin_email');
|
||||
|
||||
$adminlist = explode(',', str_replace(' ', '', $admin_email));
|
||||
|
||||
|
|
@ -446,7 +445,7 @@ function curPageURL()
|
|||
|
||||
function get_temppath()
|
||||
{
|
||||
$temppath = Config::get("system", "temppath");
|
||||
$temppath = DI::config()->get("system", "temppath");
|
||||
|
||||
if (($temppath != "") && System::isDirectoryUsable($temppath)) {
|
||||
// We have a temp path and it is usable
|
||||
|
|
@ -470,7 +469,7 @@ function get_temppath()
|
|||
|
||||
if (System::isDirectoryUsable($new_temppath)) {
|
||||
// The new path is usable, we are happy
|
||||
Config::set("system", "temppath", $new_temppath);
|
||||
DI::config()->set("system", "temppath", $new_temppath);
|
||||
return $new_temppath;
|
||||
} else {
|
||||
// We can't create a subdirectory, strange.
|
||||
|
|
@ -520,7 +519,7 @@ function clear_cache($basepath = "", $path = "")
|
|||
return;
|
||||
}
|
||||
|
||||
$cachetime = (int) Config::get('system', 'itemcache_duration');
|
||||
$cachetime = (int) DI::config()->get('system', 'itemcache_duration');
|
||||
if ($cachetime == 0) {
|
||||
$cachetime = 86400;
|
||||
}
|
||||
|
|
@ -544,12 +543,12 @@ function clear_cache($basepath = "", $path = "")
|
|||
function get_itemcachepath()
|
||||
{
|
||||
// Checking, if the cache is deactivated
|
||||
$cachetime = (int) Config::get('system', 'itemcache_duration');
|
||||
$cachetime = (int) DI::config()->get('system', 'itemcache_duration');
|
||||
if ($cachetime < 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
$itemcache = Config::get('system', 'itemcache');
|
||||
$itemcache = DI::config()->get('system', 'itemcache');
|
||||
if (($itemcache != "") && System::isDirectoryUsable($itemcache)) {
|
||||
return BasePath::getRealPath($itemcache);
|
||||
}
|
||||
|
|
@ -563,7 +562,7 @@ function get_itemcachepath()
|
|||
}
|
||||
|
||||
if (System::isDirectoryUsable($itemcache)) {
|
||||
Config::set("system", "itemcache", $itemcache);
|
||||
DI::config()->set("system", "itemcache", $itemcache);
|
||||
return $itemcache;
|
||||
}
|
||||
}
|
||||
|
|
@ -577,7 +576,7 @@ function get_itemcachepath()
|
|||
*/
|
||||
function get_spoolpath()
|
||||
{
|
||||
$spoolpath = Config::get('system', 'spoolpath');
|
||||
$spoolpath = DI::config()->get('system', 'spoolpath');
|
||||
if (($spoolpath != "") && System::isDirectoryUsable($spoolpath)) {
|
||||
// We have a spool path and it is usable
|
||||
return $spoolpath;
|
||||
|
|
@ -595,7 +594,7 @@ function get_spoolpath()
|
|||
|
||||
if (System::isDirectoryUsable($spoolpath)) {
|
||||
// The new path is usable, we are happy
|
||||
Config::set("system", "spoolpath", $spoolpath);
|
||||
DI::config()->set("system", "spoolpath", $spoolpath);
|
||||
return $spoolpath;
|
||||
} else {
|
||||
// We can't create a subdirectory, strange.
|
||||
|
|
|
|||
|
|
@ -136,26 +136,26 @@ namespace Friendica\Addon\samplestorage;
|
|||
|
||||
use Friendica\Model\Storage\IStorage;
|
||||
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\L10n;
|
||||
|
||||
class SampleStorageBackend implements IStorage
|
||||
{
|
||||
const NAME = 'Sample Storage';
|
||||
|
||||
/** @var IConfiguration */
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
/** @var L10n */
|
||||
private $l10n;
|
||||
|
||||
/**
|
||||
* SampleStorageBackend constructor.
|
||||
* @param IConfiguration $config The configuration of Friendica
|
||||
* @param IConfig $config The configuration of Friendica
|
||||
*
|
||||
* You can add here every dynamic class as dependency you like and add them to a private field
|
||||
* Friendica automatically creates these classes and passes them as argument to the constructor
|
||||
*/
|
||||
public function __construct(IConfiguration $config, L10n $l10n)
|
||||
public function __construct(IConfig $config, L10n $l10n)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->l10n = $l10n;
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ There you'll find somethink alike
|
|||
|
||||
$colorset = DI::pConfig()->get( local_user(), 'duepuntozero','colorset');
|
||||
if (!$colorset)
|
||||
$colorset = Config::get('duepuntozero', 'colorset');
|
||||
$colorset = DI::config()->get('duepuntozero', 'colorset');
|
||||
if ($colorset) {
|
||||
if ($colorset == 'greenzero')
|
||||
DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/greenzero.css" type="text/css" media="screen" />'."\n";
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ use Friendica\Content\ContactSelector;
|
|||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
|
|
@ -1096,7 +1095,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 +1109,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 +1123,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 +2738,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 +3571,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 +4626,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 +4683,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 +4791,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 +4809,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 +6118,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) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ use Friendica\Content\ContactSelector;
|
|||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Pager;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
|
|
@ -850,7 +849,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]];
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
|
|
@ -60,9 +59,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 +586,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');
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
* @file include/items.php
|
||||
*/
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
|
|
@ -73,7 +72,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 {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ $a = \Friendica\DI::app();
|
|||
$a->runFrontend(
|
||||
$dice->create(\Friendica\App\Module::class),
|
||||
$dice->create(\Friendica\App\Router::class),
|
||||
$dice->create(\Friendica\Core\Config\IPConfiguration::class),
|
||||
$dice->create(\Friendica\Core\PConfig\IPConfig::class),
|
||||
$dice->create(\Friendica\App\Authentication::class),
|
||||
$dice->create(\Friendica\App\Page::class)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
|
@ -68,7 +67,7 @@ function api_content(App $a)
|
|||
$consumer = new OAuthConsumer($app['client_id'], $app['pw'], $app['redirect_uri']);
|
||||
|
||||
$verifier = md5($app['secret'] . local_user());
|
||||
Config::set("oauth", $verifier, local_user());
|
||||
DI::config()->set("oauth", $verifier, local_user());
|
||||
|
||||
if ($consumer->callback_url != null) {
|
||||
$params = $request->get_parameters();
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ use Friendica\App;
|
|||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
|
|
@ -25,7 +24,7 @@ use Friendica\Util\Temporal;
|
|||
|
||||
function cal_init(App $a)
|
||||
{
|
||||
if (Config::get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
throw new \Friendica\Network\HTTPException\ForbiddenException(DI::l10n()->t('Access denied.'));
|
||||
}
|
||||
|
||||
|
|
@ -237,7 +236,7 @@ function cal_content(App $a)
|
|||
if (!empty($_GET['id'])) {
|
||||
$tpl = Renderer::getMarkupTemplate("event.tpl");
|
||||
} else {
|
||||
// if (Config::get('experimentals','new_calendar')==1){
|
||||
// if (DI::config()->get('experimentals','new_calendar')==1){
|
||||
$tpl = Renderer::getMarkupTemplate("events_js.tpl");
|
||||
// } else {
|
||||
// $tpl = Renderer::getMarkupTemplate("events.tpl");
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ use Friendica\Content\Nav;
|
|||
use Friendica\Content\Pager;
|
||||
use Friendica\Content\Widget\TrendingTags;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
|
|
@ -21,12 +20,12 @@ function community_content(App $a, $update = 0)
|
|||
{
|
||||
$o = '';
|
||||
|
||||
if (Config::get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
notice(DI::l10n()->t('Public access denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
$page_style = Config::get('system', 'community_page_style');
|
||||
$page_style = DI::config()->get('system', 'community_page_style');
|
||||
|
||||
if ($page_style == CP_NO_INTERNAL_COMMUNITY) {
|
||||
notice(DI::l10n()->t('Access denied.') . EOL);
|
||||
|
|
@ -55,7 +54,7 @@ function community_content(App $a, $update = 0)
|
|||
if ($a->argc > 1) {
|
||||
$content = $a->argv[1];
|
||||
} else {
|
||||
if (!empty(Config::get('system', 'singleuser'))) {
|
||||
if (!empty(DI::config()->get('system', 'singleuser'))) {
|
||||
// On single user systems only the global page does make sense
|
||||
$content = 'global';
|
||||
} else {
|
||||
|
|
@ -90,7 +89,7 @@ function community_content(App $a, $update = 0)
|
|||
if (!$update) {
|
||||
$tabs = [];
|
||||
|
||||
if ((local_user() || in_array($page_style, [CP_USERS_AND_GLOBAL, CP_USERS_ON_SERVER])) && empty(Config::get('system', 'singleuser'))) {
|
||||
if ((local_user() || in_array($page_style, [CP_USERS_AND_GLOBAL, CP_USERS_ON_SERVER])) && empty(DI::config()->get('system', 'singleuser'))) {
|
||||
$tabs[] = [
|
||||
'label' => DI::l10n()->t('Local Community'),
|
||||
'url' => 'community/local',
|
||||
|
|
@ -156,7 +155,7 @@ function community_content(App $a, $update = 0)
|
|||
return $o;
|
||||
}
|
||||
|
||||
$maxpostperauthor = (int) Config::get('system', 'max_author_posts_community_page');
|
||||
$maxpostperauthor = (int) DI::config()->get('system', 'max_author_posts_community_page');
|
||||
|
||||
if (($maxpostperauthor != 0) && ($content == 'local')) {
|
||||
$count = 1;
|
||||
|
|
@ -203,7 +202,7 @@ function community_content(App $a, $update = 0)
|
|||
return Renderer::replaceMacros($t, [
|
||||
'$content' => $o,
|
||||
'$header' => '',
|
||||
'$show_global_community_hint' => ($content == 'global') && Config::get('system', 'show_global_community_hint'),
|
||||
'$show_global_community_hint' => ($content == 'global') && DI::config()->get('system', 'show_global_community_hint'),
|
||||
'$global_community_hint' => DI::l10n()->t("This community stream shows all public posts received by this node. They may not reflect the opinions of this node’s users.")
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
|
|
@ -117,7 +116,7 @@ function crepair_content(App $a)
|
|||
|
||||
$returnaddr = "contact/$cid";
|
||||
|
||||
$allow_remote_self = Config::get('system', 'allow_users_remote_self');
|
||||
$allow_remote_self = DI::config()->get('system', 'allow_users_remote_self');
|
||||
|
||||
// Disable remote self for everything except feeds.
|
||||
// There is an issue when you repeat an item from maybe twitter and you got comments from friendica and twitter
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
|
|
@ -229,7 +228,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
return;
|
||||
}
|
||||
|
||||
if (strlen($leading_junk) && Config::get('system', 'debugging')) {
|
||||
if (strlen($leading_junk) && DI::config()->get('system', 'debugging')) {
|
||||
// This might be more common. Mixed error text and some XML.
|
||||
// If we're configured for debugging, show the text. Proceed in either case.
|
||||
notice(DI::l10n()->t('Unexpected response from remote site: ') . EOL . $leading_junk . EOL);
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Protocol\DFRN;
|
||||
|
|
@ -128,7 +128,7 @@ function dfrn_notify_post(App $a) {
|
|||
System::xmlExit(0, 'relationship dissolved');
|
||||
}
|
||||
|
||||
$rino = Config::get('system', 'rino_encrypt');
|
||||
$rino = DI::config()->get('system', 'rino_encrypt');
|
||||
$rino = intval($rino);
|
||||
|
||||
if (strlen($key)) {
|
||||
|
|
@ -343,7 +343,7 @@ function dfrn_notify_content(App $a) {
|
|||
$encrypted_id = bin2hex($encrypted_id);
|
||||
|
||||
|
||||
$rino = Config::get('system', 'rino_encrypt');
|
||||
$rino = DI::config()->get('system', 'rino_encrypt');
|
||||
$rino = intval($rino);
|
||||
|
||||
Logger::log("Local rino version: ". $rino, Logger::DATA);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Session;
|
||||
|
|
@ -49,7 +48,7 @@ function dfrn_poll_init(App $a)
|
|||
$hidewall = false;
|
||||
|
||||
if (($dfrn_id === '') && empty($_POST['dfrn_id'])) {
|
||||
if (Config::get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
throw new \Friendica\Network\HTTPException\ForbiddenException();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
|
|
@ -595,8 +594,8 @@ function dfrn_request_content(App $a)
|
|||
exit();
|
||||
} else {
|
||||
// Normal web request. Display our user's introduction form.
|
||||
if (Config::get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
if (!Config::get('system', 'local_block')) {
|
||||
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
if (!DI::config()->get('system', 'local_block')) {
|
||||
notice(DI::l10n()->t('Public access denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ use Friendica\Content\Pager;
|
|||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
|
|
@ -30,7 +29,7 @@ function display_init(App $a)
|
|||
Objects::rawContent();
|
||||
}
|
||||
|
||||
if (Config::get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -164,7 +163,7 @@ function display_fetchauthor($a, $item)
|
|||
|
||||
function display_content(App $a, $update = false, $update_uid = 0)
|
||||
{
|
||||
if (Config::get('system','block_public') && !Session::isAuthenticated()) {
|
||||
if (DI::config()->get('system','block_public') && !Session::isAuthenticated()) {
|
||||
throw new HTTPException\ForbiddenException(DI::l10n()->t('Public access denied.'));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
* @file mod/follow.php
|
||||
*/
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
|
@ -94,14 +93,14 @@ function follow_content(App $a)
|
|||
|
||||
$protocol = Contact::getProtocol($ret['url'], $ret['network']);
|
||||
|
||||
if (($protocol == Protocol::DIASPORA) && !Config::get('system', 'diaspora_enabled')) {
|
||||
if (($protocol == Protocol::DIASPORA) && !DI::config()->get('system', 'diaspora_enabled')) {
|
||||
notice(DI::l10n()->t("Diaspora support isn't enabled. Contact can't be added."));
|
||||
$submit = '';
|
||||
//$a->internalRedirect($_SESSION['return_path']);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
if (($protocol == Protocol::OSTATUS) && Config::get('system', 'ostatus_disabled')) {
|
||||
if (($protocol == Protocol::OSTATUS) && DI::config()->get('system', 'ostatus_disabled')) {
|
||||
notice(DI::l10n()->t("OStatus support is disabled. Contact can't be added."));
|
||||
$submit = '';
|
||||
//$a->internalRedirect($_SESSION['return_path']);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ use Friendica\App;
|
|||
use Friendica\Content\Pager;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
|
|
@ -315,7 +314,7 @@ function item_post(App $a) {
|
|||
|
||||
// if using the API, we won't see pubmail_enable - figure out if it should be set
|
||||
if ($api_source && $profile_uid && $profile_uid == local_user() && !$private) {
|
||||
if (function_exists('imap_open') && !Config::get('system', 'imap_disabled')) {
|
||||
if (function_exists('imap_open') && !DI::config()->get('system', 'imap_disabled')) {
|
||||
$pubmail_enabled = DBA::exists('mailacct', ["`uid` = ? AND `server` != ? AND `pubmail`", local_user(), '']);
|
||||
}
|
||||
}
|
||||
|
|
@ -1060,7 +1059,7 @@ function handle_tag(&$body, &$inform, &$str_tags, $profile_uid, $tag, $network =
|
|||
|
||||
function item_add_implicit_mentions(array $tags, array $thread_parent_contact, $thread_parent_id)
|
||||
{
|
||||
if (Config::get('system', 'disable_implicit_mentions')) {
|
||||
if (DI::config()->get('system', 'disable_implicit_mentions')) {
|
||||
// Add a tag if the parent contact is from ActivityPub or OStatus (This will notify them)
|
||||
if (in_array($thread_parent_contact['network'], [Protocol::OSTATUS, Protocol::ACTIVITYPUB])) {
|
||||
$contact = Term::TAG_CHARACTER[Term::MENTION] . '[url=' . $thread_parent_contact['url'] . ']' . $thread_parent_contact['nick'] . '[/url]';
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
|
@ -38,7 +37,7 @@ function lostpass_post(App $a)
|
|||
info(DI::l10n()->t('Password reset request issued. Check your email.') . EOL);
|
||||
}
|
||||
|
||||
$sitename = Config::get('config', 'sitename');
|
||||
$sitename = DI::config()->get('config', 'sitename');
|
||||
$resetlink = DI::baseUrl() . '/lostpass/' . $pwdreset_token;
|
||||
|
||||
$preamble = Strings::deindent(DI::l10n()->t('
|
||||
|
|
@ -143,7 +142,7 @@ function lostpass_generate_password($user)
|
|||
|
||||
info("Your password has been reset." . EOL);
|
||||
|
||||
$sitename = Config::get('config', 'sitename');
|
||||
$sitename = DI::config()->get('config', 'sitename');
|
||||
$preamble = Strings::deindent(DI::l10n()->t('
|
||||
Dear %1$s,
|
||||
Your password has been changed as requested. Please retain this
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Search;
|
||||
use Friendica\Database\DBA;
|
||||
|
|
@ -55,7 +54,7 @@ function match_content(App $a)
|
|||
$params['s'] = $tags;
|
||||
$params['n'] = 100;
|
||||
|
||||
if (strlen(Config::get('system', 'directory'))) {
|
||||
if (strlen(DI::config()->get('system', 'directory'))) {
|
||||
$host = Search::getGlobalDirectory();
|
||||
} else {
|
||||
$host = DI::baseUrl();
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ use Friendica\Content\Pager;
|
|||
use Friendica\Content\Widget;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
|
|
@ -357,7 +356,7 @@ function networkFlatView(App $a, $update = 0)
|
|||
|
||||
$o .= status_editor($a, $x);
|
||||
|
||||
if (!Config::get('theme', 'hide_eventlist')) {
|
||||
if (!DI::config()->get('theme', 'hide_eventlist')) {
|
||||
$o .= Profile::getBirthdays();
|
||||
$o .= Profile::getEventsReminderHTML();
|
||||
}
|
||||
|
|
@ -620,7 +619,7 @@ function networkThreadedView(App $a, $update, $parent)
|
|||
}
|
||||
}
|
||||
|
||||
if (!$gid && !$cid && !$update && !Config::get('theme', 'hide_eventlist')) {
|
||||
if (!$gid && !$cid && !$update && !DI::config()->get('theme', 'hide_eventlist')) {
|
||||
$o .= Profile::getBirthdays();
|
||||
$o .= Profile::getEventsReminderHTML();
|
||||
}
|
||||
|
|
@ -703,7 +702,7 @@ function networkThreadedView(App $a, $update, $parent)
|
|||
} else {
|
||||
// Load all unseen items
|
||||
$sql_extra4 = "`item`.`unseen`";
|
||||
if (Config::get("system", "like_no_comment")) {
|
||||
if (DI::config()->get("system", "like_no_comment")) {
|
||||
$sql_extra4 .= " AND `item`.`gravity` IN (" . GRAVITY_PARENT . "," . GRAVITY_COMMENT . ")";
|
||||
}
|
||||
if ($order === 'post') {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ use Friendica\Content\Nav;
|
|||
use Friendica\Content\Pager;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
|
|
@ -36,7 +35,7 @@ use Friendica\Util\XML;
|
|||
|
||||
function photos_init(App $a) {
|
||||
|
||||
if (Config::get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -696,7 +695,7 @@ function photos_post(App $a)
|
|||
|
||||
Logger::log('photos: upload: received file: ' . $filename . ' as ' . $src . ' ('. $type . ') ' . $filesize . ' bytes', Logger::DEBUG);
|
||||
|
||||
$maximagesize = Config::get('system', 'maximagesize');
|
||||
$maximagesize = DI::config()->get('system', 'maximagesize');
|
||||
|
||||
if ($maximagesize && ($filesize > $maximagesize)) {
|
||||
notice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize)) . EOL);
|
||||
|
|
@ -732,7 +731,7 @@ function photos_post(App $a)
|
|||
$exif = $image->orient($src);
|
||||
@unlink($src);
|
||||
|
||||
$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;
|
||||
}
|
||||
|
|
@ -833,7 +832,7 @@ function photos_content(App $a)
|
|||
// photos/name/image/xxxxx/edit
|
||||
// photos/name/image/xxxxx/drop
|
||||
|
||||
if (Config::get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
notice(DI::l10n()->t('Public access denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1157,7 +1156,7 @@ function photos_content(App $a)
|
|||
* The query leads to a really intense used index.
|
||||
* By now we hide it if someone wants to.
|
||||
*/
|
||||
if ($cmd === 'view' && !Config::get('system', 'no_count', false)) {
|
||||
if ($cmd === 'view' && !DI::config()->get('system', 'no_count', false)) {
|
||||
$order_field = $_GET['order'] ?? '';
|
||||
|
||||
if ($order_field === 'posted') {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ use Friendica\App;
|
|||
use Friendica\Content\ForumManager;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Cache\Duration;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
|
@ -186,7 +185,7 @@ function ping_init(App $a)
|
|||
);
|
||||
$mail_count = count($mails);
|
||||
|
||||
if (intval(Config::get('config', 'register_policy')) === \Friendica\Module\Register::APPROVE && is_site_admin()) {
|
||||
if (intval(DI::config()->get('config', 'register_policy')) === \Friendica\Module\Register::APPROVE && is_site_admin()) {
|
||||
$regs = Friendica\Model\Register::getPending();
|
||||
|
||||
if (DBA::isResult($regs)) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
|
|
@ -20,7 +19,7 @@ use Friendica\Util\XML;
|
|||
function poco_init(App $a) {
|
||||
$system_mode = false;
|
||||
|
||||
if (intval(Config::get('system', 'block_public')) || (Config::get('system', 'block_local_dir'))) {
|
||||
if (intval(DI::config()->get('system', 'block_public')) || (DI::config()->get('system', 'block_local_dir'))) {
|
||||
throw new \Friendica\Network\HTTPException\ForbiddenException();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
|
|
@ -123,7 +122,7 @@ function profile_photo_post(App $a)
|
|||
|
||||
info(DI::l10n()->t('Shift-reload the page or clear browser cache if the new photo does not display immediately.') . EOL);
|
||||
// Update global directory in background
|
||||
if ($path && strlen(Config::get('system', 'directory'))) {
|
||||
if ($path && strlen(DI::config()->get('system', 'directory'))) {
|
||||
Worker::add(PRIORITY_LOW, "Directory", DI::baseUrl()->get() . '/' . $path);
|
||||
}
|
||||
|
||||
|
|
@ -145,7 +144,7 @@ function profile_photo_post(App $a)
|
|||
$filetype = Image::guessType($filename);
|
||||
}
|
||||
|
||||
$maximagesize = Config::get('system', 'maximagesize');
|
||||
$maximagesize = DI::config()->get('system', 'maximagesize');
|
||||
|
||||
if (($maximagesize) && ($filesize > $maximagesize)) {
|
||||
notice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize)) . EOL);
|
||||
|
|
@ -217,7 +216,7 @@ function profile_photo_content(App $a)
|
|||
|
||||
// Update global directory in background
|
||||
$url = $_SESSION['my_url'];
|
||||
if ($url && strlen(Config::get('system', 'directory'))) {
|
||||
if ($url && strlen(DI::config()->get('system', 'directory'))) {
|
||||
Worker::add(PRIORITY_LOW, "Directory", $url);
|
||||
}
|
||||
|
||||
|
|
@ -271,7 +270,7 @@ function profile_photo_content(App $a)
|
|||
|
||||
function profile_photo_crop_ui_head(Image $image)
|
||||
{
|
||||
$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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ use Friendica\BaseModule;
|
|||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Worker;
|
||||
|
|
@ -479,7 +478,7 @@ function profiles_post(App $a) {
|
|||
|
||||
// Update global directory in background
|
||||
$url = $_SESSION['my_url'];
|
||||
if ($url && strlen(Config::get('system', 'directory'))) {
|
||||
if ($url && strlen(DI::config()->get('system', 'directory'))) {
|
||||
Worker::add(PRIORITY_LOW, "Directory", $url);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
* @file mod/profperm.php
|
||||
*/
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Database\DBA;
|
||||
|
|
@ -42,7 +41,7 @@ function profperm_content(App $a) {
|
|||
|
||||
$switchtotext = DI::pConfig()->get(local_user(),'system','groupedit_image_limit');
|
||||
if (is_null($switchtotext)) {
|
||||
$switchtotext = Config::get('system','groupedit_image_limit', 400);
|
||||
$switchtotext = DI::config()->get('system','groupedit_image_limit', 400);
|
||||
}
|
||||
|
||||
if (($a->argc > 2) && intval($a->argv[1]) && intval($a->argv[2])) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
|
@ -16,7 +15,7 @@ function post_var($name) {
|
|||
function pubsubhubbub_init(App $a) {
|
||||
// PuSH subscription must be considered "public" so just block it
|
||||
// if public access isn't enabled.
|
||||
if (Config::get('system', 'block_public')) {
|
||||
if (DI::config()->get('system', 'block_public')) {
|
||||
throw new \Friendica\Network\HTTPException\ForbiddenException();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
|
@ -30,7 +29,7 @@ function user_allow($hash)
|
|||
|
||||
$profile = DBA::selectFirst('profile', ['net-publish'], ['uid' => $register['uid'], 'is-default' => true]);
|
||||
|
||||
if (DBA::isResult($profile) && $profile['net-publish'] && Config::get('system', 'directory')) {
|
||||
if (DBA::isResult($profile) && $profile['net-publish'] && DI::config()->get('system', 'directory')) {
|
||||
$url = DI::baseUrl() . '/profile/' . $user['nickname'];
|
||||
Worker::add(PRIORITY_LOW, "Directory", $url);
|
||||
}
|
||||
|
|
@ -40,7 +39,7 @@ function user_allow($hash)
|
|||
$res = User::sendRegisterOpenEmail(
|
||||
$l10n,
|
||||
$user,
|
||||
Config::get('config', 'sitename'),
|
||||
DI::config()->get('config', 'sitename'),
|
||||
DI::baseUrl()->get(),
|
||||
($register['password'] ?? '') ?: 'Sent in a previous email'
|
||||
);
|
||||
|
|
@ -78,7 +77,7 @@ function regmod_content(App $a)
|
|||
{
|
||||
if (!local_user()) {
|
||||
info(DI::l10n()->t('Please login.') . EOL);
|
||||
return Login::form(DI::args()->getQueryString(), intval(Config::get('config', 'register_policy')) === \Friendica\Module\Register::CLOSED ? 0 : 1);
|
||||
return Login::form(DI::args()->getQueryString(), intval(DI::config()->get('config', 'register_policy')) === \Friendica\Module\Register::CLOSED ? 0 : 1);
|
||||
}
|
||||
|
||||
if (!is_site_admin() || !empty($_SESSION['submanage'])) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
|
@ -35,7 +34,7 @@ function removeme_post(App $a)
|
|||
|
||||
// send notification to admins so that they can clean um the backups
|
||||
// send email to admins
|
||||
$admin_mails = explode(",", str_replace(" ", "", Config::get('config', 'admin_email')));
|
||||
$admin_mails = explode(",", str_replace(" ", "", DI::config()->get('config', 'admin_email')));
|
||||
foreach ($admin_mails as $mail) {
|
||||
$admin = DBA::selectFirst('user', ['uid', 'language', 'email', 'username'], ['email' => $mail]);
|
||||
if (!DBA::isResult($admin)) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ use Friendica\BaseModule;
|
|||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
|
|
@ -250,9 +249,9 @@ function settings_post(App $a)
|
|||
$mail_pubmail = $_POST['mail_pubmail'] ?? '';
|
||||
|
||||
if (
|
||||
!Config::get('system', 'dfrn_only')
|
||||
!DI::config()->get('system', 'dfrn_only')
|
||||
&& function_exists('imap_open')
|
||||
&& !Config::get('system', 'imap_disabled')
|
||||
&& !DI::config()->get('system', 'imap_disabled')
|
||||
) {
|
||||
$failed = false;
|
||||
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
|
||||
|
|
@ -541,8 +540,8 @@ function settings_post(App $a)
|
|||
$err .= DI::l10n()->t('Invalid email.');
|
||||
}
|
||||
// ensure new email is not the admin mail
|
||||
if (Config::get('config', 'admin_email')) {
|
||||
$adminlist = explode(",", str_replace(" ", "", strtolower(Config::get('config', 'admin_email'))));
|
||||
if (DI::config()->get('config', 'admin_email')) {
|
||||
$adminlist = explode(",", str_replace(" ", "", strtolower(DI::config()->get('config', 'admin_email'))));
|
||||
if (in_array(strtolower($email), $adminlist)) {
|
||||
$err .= DI::l10n()->t('Cannot change to that email.');
|
||||
$email = $a->user['email'];
|
||||
|
|
@ -625,7 +624,7 @@ function settings_post(App $a)
|
|||
if (($old_visibility != $net_publish) || ($page_flags != $old_page_flags)) {
|
||||
// Update global directory in background
|
||||
$url = $_SESSION['my_url'];
|
||||
if ($url && strlen(Config::get('system', 'directory'))) {
|
||||
if ($url && strlen(DI::config()->get('system', 'directory'))) {
|
||||
Worker::add(PRIORITY_LOW, "Directory", $url);
|
||||
}
|
||||
}
|
||||
|
|
@ -791,15 +790,15 @@ function settings_content(App $a)
|
|||
Hook::callAll('connector_settings', $settings_connectors);
|
||||
|
||||
if (is_site_admin()) {
|
||||
$diasp_enabled = DI::l10n()->t('Built-in support for %s connectivity is %s', DI::l10n()->t('Diaspora'), ((Config::get('system', 'diaspora_enabled')) ? DI::l10n()->t('enabled') : DI::l10n()->t('disabled')));
|
||||
$ostat_enabled = DI::l10n()->t('Built-in support for %s connectivity is %s', DI::l10n()->t("GNU Social \x28OStatus\x29"), ((Config::get('system', 'ostatus_disabled')) ? DI::l10n()->t('disabled') : DI::l10n()->t('enabled')));
|
||||
$diasp_enabled = DI::l10n()->t('Built-in support for %s connectivity is %s', DI::l10n()->t('Diaspora'), ((DI::config()->get('system', 'diaspora_enabled')) ? DI::l10n()->t('enabled') : DI::l10n()->t('disabled')));
|
||||
$ostat_enabled = DI::l10n()->t('Built-in support for %s connectivity is %s', DI::l10n()->t("GNU Social \x28OStatus\x29"), ((DI::config()->get('system', 'ostatus_disabled')) ? DI::l10n()->t('disabled') : DI::l10n()->t('enabled')));
|
||||
} else {
|
||||
$diasp_enabled = "";
|
||||
$ostat_enabled = "";
|
||||
}
|
||||
|
||||
$mail_disabled = ((function_exists('imap_open') && (!Config::get('system', 'imap_disabled'))) ? 0 : 1);
|
||||
if (Config::get('system', 'dfrn_only')) {
|
||||
$mail_disabled = ((function_exists('imap_open') && (!DI::config()->get('system', 'imap_disabled'))) ? 0 : 1);
|
||||
if (DI::config()->get('system', 'dfrn_only')) {
|
||||
$mail_disabled = 1;
|
||||
}
|
||||
if (!$mail_disabled) {
|
||||
|
|
@ -827,7 +826,7 @@ function settings_content(App $a)
|
|||
|
||||
$ssl_options = ['TLS' => 'TLS', 'SSL' => 'SSL'];
|
||||
|
||||
if (Config::get('system', 'insecure_imap')) {
|
||||
if (DI::config()->get('system', 'insecure_imap')) {
|
||||
$ssl_options['notls'] = DI::l10n()->t('None');
|
||||
}
|
||||
|
||||
|
|
@ -877,11 +876,11 @@ function settings_content(App $a)
|
|||
* DISPLAY SETTINGS
|
||||
*/
|
||||
if (($a->argc > 1) && ($a->argv[1] === 'display')) {
|
||||
$default_theme = Config::get('system', 'theme');
|
||||
$default_theme = DI::config()->get('system', 'theme');
|
||||
if (!$default_theme) {
|
||||
$default_theme = 'default';
|
||||
}
|
||||
$default_mobile_theme = Config::get('system', 'mobile-theme');
|
||||
$default_mobile_theme = DI::config()->get('system', 'mobile-theme');
|
||||
if (!$default_mobile_theme) {
|
||||
$default_mobile_theme = 'none';
|
||||
}
|
||||
|
|
@ -894,7 +893,7 @@ function settings_content(App $a)
|
|||
$is_experimental = file_exists('view/theme/' . $theme . '/experimental');
|
||||
$is_unsupported = file_exists('view/theme/' . $theme . '/unsupported');
|
||||
$is_mobile = file_exists('view/theme/' . $theme . '/mobile');
|
||||
if (!$is_experimental || ($is_experimental && (Config::get('experimentals', 'exp_themes')==1 || is_null(Config::get('experimentals', 'exp_themes'))))) {
|
||||
if (!$is_experimental || ($is_experimental && (DI::config()->get('experimentals', 'exp_themes')==1 || is_null(DI::config()->get('experimentals', 'exp_themes'))))) {
|
||||
$theme_name = ucfirst($theme);
|
||||
if ($is_unsupported) {
|
||||
$theme_name = DI::l10n()->t('%s - (Unsupported)', $theme_name);
|
||||
|
|
@ -1068,7 +1067,7 @@ function settings_content(App $a)
|
|||
|
||||
]);
|
||||
|
||||
$noid = Config::get('system', 'no_openid');
|
||||
$noid = DI::config()->get('system', 'no_openid');
|
||||
|
||||
if ($noid) {
|
||||
$openid_field = false;
|
||||
|
|
@ -1077,7 +1076,7 @@ function settings_content(App $a)
|
|||
}
|
||||
|
||||
$opt_tpl = Renderer::getMarkupTemplate("field_yesno.tpl");
|
||||
if (Config::get('system', 'publish_all')) {
|
||||
if (DI::config()->get('system', 'publish_all')) {
|
||||
$profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />';
|
||||
} else {
|
||||
$profile_in_dir = Renderer::replaceMacros($opt_tpl, [
|
||||
|
|
@ -1085,9 +1084,9 @@ function settings_content(App $a)
|
|||
]);
|
||||
}
|
||||
|
||||
if (strlen(Config::get('system', 'directory'))) {
|
||||
if (strlen(DI::config()->get('system', 'directory'))) {
|
||||
$profile_in_net_dir = Renderer::replaceMacros($opt_tpl, [
|
||||
'$field' => ['profile_in_netdirectory', DI::l10n()->t('Publish your default profile in the global social directory?'), $profile['net-publish'], DI::l10n()->t('Your profile will be published in the global friendica directories (e.g. <a href="%s">%s</a>). Your profile will be visible in public.', Config::get('system', 'directory'), Config::get('system', 'directory')) . " " . DI::l10n()->t("This setting also determines whether Friendica will inform search engines that your profile should be indexed or not. Third-party search engines may or may not respect this setting."), [DI::l10n()->t('No'), DI::l10n()->t('Yes')]]
|
||||
'$field' => ['profile_in_netdirectory', DI::l10n()->t('Publish your default profile in the global social directory?'), $profile['net-publish'], DI::l10n()->t('Your profile will be published in the global friendica directories (e.g. <a href="%s">%s</a>). Your profile will be visible in public.', DI::config()->get('system', 'directory'), DI::config()->get('system', 'directory')) . " " . DI::l10n()->t("This setting also determines whether Friendica will inform search engines that your profile should be indexed or not. Third-party search engines may or may not respect this setting."), [DI::l10n()->t('No'), DI::l10n()->t('Yes')]]
|
||||
]);
|
||||
} else {
|
||||
$profile_in_net_dir = '';
|
||||
|
|
@ -1181,7 +1180,7 @@ function settings_content(App $a)
|
|||
'$password2'=> ['confirm', DI::l10n()->t('Confirm:'), '', DI::l10n()->t('Leave password fields blank unless changing')],
|
||||
'$password3'=> ['opassword', DI::l10n()->t('Current Password:'), '', DI::l10n()->t('Your current password to confirm the changes')],
|
||||
'$password4'=> ['mpassword', DI::l10n()->t('Password:'), '', DI::l10n()->t('Your current password to confirm the changes')],
|
||||
'$oid_enable' => (!Config::get('system', 'no_openid')),
|
||||
'$oid_enable' => (!DI::config()->get('system', 'no_openid')),
|
||||
'$openid' => $openid_field,
|
||||
'$delete_openid' => ['delete_openid', DI::l10n()->t('Delete OpenID URL'), false, ''],
|
||||
|
||||
|
|
@ -1256,7 +1255,7 @@ function settings_content(App $a)
|
|||
'$importcontact' => DI::l10n()->t('Import Contacts'),
|
||||
'$importcontact_text' => DI::l10n()->t('Upload a CSV file that contains the handle of your followed accounts in the first column you exported from the old account.'),
|
||||
'$importcontact_button' => DI::l10n()->t('Upload File'),
|
||||
'$importcontact_maxsize' => Config::get('system', 'max_csv_file_size', 30720),
|
||||
'$importcontact_maxsize' => DI::config()->get('system', 'max_csv_file_size', 30720),
|
||||
'$relocate' => DI::l10n()->t('Relocate'),
|
||||
'$relocate_text' => DI::l10n()->t("If you have moved this profile from another server, and some of your contacts don't receive your updates, try pushing this button."),
|
||||
'$relocate_button' => DI::l10n()->t("Resend relocate message to contacts"),
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\UserImport;
|
||||
use Friendica\Core\Renderer;
|
||||
|
|
@ -13,7 +12,7 @@ use Friendica\DI;
|
|||
|
||||
function uimport_post(App $a)
|
||||
{
|
||||
if ((Config::get('config', 'register_policy') != \Friendica\Module\Register::OPEN) && !is_site_admin()) {
|
||||
if ((DI::config()->get('config', 'register_policy') != \Friendica\Module\Register::OPEN) && !is_site_admin()) {
|
||||
notice(DI::l10n()->t('Permission denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
|
@ -26,12 +25,12 @@ function uimport_post(App $a)
|
|||
|
||||
function uimport_content(App $a)
|
||||
{
|
||||
if ((Config::get('config', 'register_policy') != \Friendica\Module\Register::OPEN) && !is_site_admin()) {
|
||||
if ((DI::config()->get('config', 'register_policy') != \Friendica\Module\Register::OPEN) && !is_site_admin()) {
|
||||
notice(DI::l10n()->t('User imports on closed servers can only be done by an administrator.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
$max_dailies = intval(Config::get('system', 'max_daily_registrations'));
|
||||
$max_dailies = intval(DI::config()->get('system', 'max_daily_registrations'));
|
||||
if ($max_dailies) {
|
||||
$r = q("select count(*) as total from user where register_date > UTC_TIMESTAMP - INTERVAL 1 day");
|
||||
if ($r && $r[0]['total'] >= $max_dailies) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Pager;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
|
|
@ -20,7 +19,7 @@ use Friendica\Util\Security;
|
|||
|
||||
function videos_init(App $a)
|
||||
{
|
||||
if (Config::get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +107,7 @@ function videos_content(App $a)
|
|||
// videos/name/video/xxxxx/edit
|
||||
|
||||
|
||||
if (Config::get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
notice(DI::l10n()->t('Public access denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
|
@ -78,7 +77,7 @@ function wall_attach_post(App $a) {
|
|||
$filename = basename($_FILES['userfile']['name']);
|
||||
$filesize = intval($_FILES['userfile']['size']);
|
||||
|
||||
$maxfilesize = Config::get('system','maxfilesize');
|
||||
$maxfilesize = DI::config()->get('system','maxfilesize');
|
||||
|
||||
/* Found html code written in text field of form,
|
||||
* when trying to upload a file with filesize
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
|
|
@ -179,7 +178,7 @@ function wall_upload_post(App $a, $desktopmode = true)
|
|||
Logger::log("File upload src: " . $src . " - filename: " . $filename .
|
||||
" - size: " . $filesize . " - type: " . $filetype, Logger::DEBUG);
|
||||
|
||||
$maximagesize = Config::get('system', 'maximagesize');
|
||||
$maximagesize = DI::config()->get('system', 'maximagesize');
|
||||
|
||||
if (($maximagesize) && ($filesize > $maximagesize)) {
|
||||
$msg = DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize));
|
||||
|
|
@ -209,7 +208,7 @@ function wall_upload_post(App $a, $desktopmode = true)
|
|||
$Image->orient($src);
|
||||
@unlink($src);
|
||||
|
||||
$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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,16 +4,16 @@
|
|||
* Module for running the worker as frontend process
|
||||
*/
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
function worker_init()
|
||||
{
|
||||
|
||||
if (!Config::get("system", "frontend_worker")) {
|
||||
if (!DI::config()->get("system", "frontend_worker")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ function worker_init()
|
|||
|
||||
$workers = q("SELECT COUNT(*) AS `processes` FROM `process` WHERE `command` = 'worker.php'");
|
||||
|
||||
if ($workers[0]["processes"] > Config::get("system", "worker_queues", 4)) {
|
||||
if ($workers[0]["processes"] > DI::config()->get("system", "worker_queues", 4)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace Friendica\Api\Entity\Mastodon;
|
||||
|
||||
use Friendica\Api\BaseEntity;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\User;
|
||||
|
|
@ -52,27 +51,27 @@ class Instance extends BaseEntity
|
|||
*/
|
||||
public static function get()
|
||||
{
|
||||
$register_policy = intval(Config::get('config', 'register_policy'));
|
||||
$register_policy = intval(DI::config()->get('config', 'register_policy'));
|
||||
|
||||
$baseUrl = DI::baseUrl();
|
||||
|
||||
$instance = new Instance();
|
||||
$instance->uri = $baseUrl->get();
|
||||
$instance->title = Config::get('config', 'sitename');
|
||||
$instance->description = Config::get('config', 'info');
|
||||
$instance->email = Config::get('config', 'admin_email');
|
||||
$instance->title = DI::config()->get('config', 'sitename');
|
||||
$instance->description = DI::config()->get('config', 'info');
|
||||
$instance->email = DI::config()->get('config', 'admin_email');
|
||||
$instance->version = FRIENDICA_VERSION;
|
||||
$instance->urls = []; // Not supported
|
||||
$instance->stats = Stats::get();
|
||||
$instance->thumbnail = $baseUrl->get() . (Config::get('system', 'shortcut_icon') ?? 'images/friendica-32.png');
|
||||
$instance->languages = [Config::get('system', 'language')];
|
||||
$instance->max_toot_chars = (int)Config::get('config', 'api_import_size', Config::get('config', 'max_import_size'));
|
||||
$instance->thumbnail = $baseUrl->get() . (DI::config()->get('system', 'shortcut_icon') ?? 'images/friendica-32.png');
|
||||
$instance->languages = [DI::config()->get('system', 'language')];
|
||||
$instance->max_toot_chars = (int)DI::config()->get('config', 'api_import_size', DI::config()->get('config', 'max_import_size'));
|
||||
$instance->registrations = ($register_policy != Register::CLOSED);
|
||||
$instance->approval_required = ($register_policy == Register::APPROVE);
|
||||
$instance->contact_account = [];
|
||||
|
||||
if (!empty(Config::get('config', 'admin_email'))) {
|
||||
$adminList = explode(',', str_replace(' ', '', Config::get('config', 'admin_email')));
|
||||
if (!empty(DI::config()->get('config', 'admin_email'))) {
|
||||
$adminList = explode(',', str_replace(' ', '', DI::config()->get('config', 'admin_email')));
|
||||
$administrator = User::getByEmail($adminList[0], ['nickname']);
|
||||
if (!empty($administrator)) {
|
||||
$adminContact = DBA::selectFirst('contact', ['id'], ['nick' => $administrator['nickname'], 'self' => true]);
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
namespace Friendica\Api\Entity\Mastodon;
|
||||
|
||||
use Friendica\Api\BaseEntity;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
||||
/**
|
||||
* Class Stats
|
||||
|
|
@ -29,9 +29,9 @@ class Stats extends BaseEntity
|
|||
*/
|
||||
public static function get() {
|
||||
$stats = new Stats();
|
||||
if (!empty(Config::get('system', 'nodeinfo'))) {
|
||||
$stats->user_count = intval(Config::get('nodeinfo', 'total_users'));
|
||||
$stats->status_count = Config::get('nodeinfo', 'local_posts') + Config::get('nodeinfo', 'local_comments');
|
||||
if (!empty(DI::config()->get('system', 'nodeinfo'))) {
|
||||
$stats->user_count = intval(DI::config()->get('nodeinfo', 'total_users'));
|
||||
$stats->status_count = DI::config()->get('nodeinfo', 'local_posts') + DI::config()->get('nodeinfo', 'local_comments');
|
||||
$stats->domain_count = DBA::count('gserver', ["`network` in (?, ?) AND `last_contact` >= `last_failure`", Protocol::DFRN, Protocol::ACTIVITYPUB]);
|
||||
}
|
||||
return $stats;
|
||||
|
|
|
|||
23
src/App.php
23
src/App.php
|
|
@ -8,9 +8,9 @@ use Exception;
|
|||
use Friendica\App\Arguments;
|
||||
use Friendica\App\BaseURL;
|
||||
use Friendica\App\Authentication;
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IPConfiguration;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\PConfig\IPConfig;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Theme;
|
||||
|
|
@ -83,7 +83,7 @@ class App
|
|||
private $currentMobileTheme;
|
||||
|
||||
/**
|
||||
* @var IConfiguration The config
|
||||
* @var IConfig The config
|
||||
*/
|
||||
private $config;
|
||||
|
||||
|
|
@ -118,14 +118,14 @@ class App
|
|||
private $process;
|
||||
|
||||
/**
|
||||
* @var IPConfiguration
|
||||
* @var IPConfig
|
||||
*/
|
||||
private $pConfig;
|
||||
|
||||
/**
|
||||
* Returns the current config cache of this node
|
||||
*
|
||||
* @return ConfigCache
|
||||
* @return Cache
|
||||
*/
|
||||
public function getConfigCache()
|
||||
{
|
||||
|
|
@ -145,7 +145,7 @@ class App
|
|||
|
||||
/**
|
||||
* @param Database $database The Friendica Database
|
||||
* @param IConfiguration $config The Configuration
|
||||
* @param IConfig $config The Configuration
|
||||
* @param App\Mode $mode The mode of this Friendica app
|
||||
* @param BaseURL $baseURL The full base URL of this Friendica app
|
||||
* @param LoggerInterface $logger The current app logger
|
||||
|
|
@ -153,9 +153,9 @@ class App
|
|||
* @param L10n $l10n The translator instance
|
||||
* @param App\Arguments $args The Friendica Arguments of the call
|
||||
* @param Core\Process $process The process methods
|
||||
* @param IPConfiguration $pConfig Personal configuration
|
||||
* @param IPConfig $pConfig Personal configuration
|
||||
*/
|
||||
public function __construct(Database $database, IConfiguration $config, App\Mode $mode, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, Arguments $args, Core\Process $process, IPConfiguration $pConfig)
|
||||
public function __construct(Database $database, IConfig $config, App\Mode $mode, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, Arguments $args, Core\Process $process, IPConfig $pConfig)
|
||||
{
|
||||
$this->database = $database;
|
||||
$this->config = $config;
|
||||
|
|
@ -432,13 +432,14 @@ class App
|
|||
*
|
||||
* @param App\Module $module The determined module
|
||||
* @param App\Router $router
|
||||
* @param IPConfiguration $pconfig
|
||||
* @param IPConfig $pconfig
|
||||
* @param Authentication $auth The Authentication backend of the node
|
||||
* @param App\Page $page The Friendica page printing container
|
||||
*
|
||||
* @throws HTTPException\InternalServerErrorException
|
||||
* @throws \ImagickException
|
||||
*/
|
||||
public function runFrontend(App\Module $module, App\Router $router, IPConfiguration $pconfig, Authentication $auth, App\Page $page)
|
||||
public function runFrontend(App\Module $module, App\Router $router, IPConfig $pconfig, Authentication $auth, App\Page $page)
|
||||
{
|
||||
$moduleName = $module->getName();
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ namespace Friendica\App;
|
|||
|
||||
use Exception;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IPConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\PConfig\IPConfig;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
|
|
@ -30,7 +30,7 @@ use Psr\Log\LoggerInterface;
|
|||
*/
|
||||
class Authentication
|
||||
{
|
||||
/** @var IConfiguration */
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
/** @var App\Mode */
|
||||
private $mode;
|
||||
|
|
@ -46,13 +46,13 @@ class Authentication
|
|||
private $cookie;
|
||||
/** @var Session\ISession */
|
||||
private $session;
|
||||
/** @var IPConfiguration */
|
||||
/** @var IPConfig */
|
||||
private $pConfig;
|
||||
|
||||
/**
|
||||
* Authentication constructor.
|
||||
*
|
||||
* @param IConfiguration $config
|
||||
* @param IConfig $config
|
||||
* @param App\Mode $mode
|
||||
* @param App\BaseURL $baseUrl
|
||||
* @param L10n $l10n
|
||||
|
|
@ -60,9 +60,9 @@ class Authentication
|
|||
* @param LoggerInterface $logger
|
||||
* @param User\Cookie $cookie
|
||||
* @param Session\ISession $session
|
||||
* @param IPConfiguration $pConfig
|
||||
* @param IPConfig $pConfig
|
||||
*/
|
||||
public function __construct(IConfiguration $config, App\Mode $mode, App\BaseURL $baseUrl, L10n $l10n, Database $dba, LoggerInterface $logger, User\Cookie $cookie, Session\ISession $session, IPConfiguration $pConfig)
|
||||
public function __construct(IConfig $config, App\Mode $mode, App\BaseURL $baseUrl, L10n $l10n, Database $dba, LoggerInterface $logger, User\Cookie $cookie, Session\ISession $session, IPConfig $pConfig)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->mode = $mode;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Friendica\App;
|
||||
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Strings;
|
||||
|
|
@ -37,7 +37,7 @@ class BaseURL
|
|||
/**
|
||||
* The Friendica Config
|
||||
*
|
||||
* @var IConfiguration
|
||||
* @var IConfig
|
||||
*/
|
||||
private $config;
|
||||
|
||||
|
|
@ -253,10 +253,10 @@ class BaseURL
|
|||
}
|
||||
|
||||
/**
|
||||
* @param IConfiguration $config The Friendica IConfiguration
|
||||
* @param IConfig $config The Friendica IConfiguration
|
||||
* @param array $server The $_SERVER array
|
||||
*/
|
||||
public function __construct(IConfiguration $config, array $server)
|
||||
public function __construct(IConfig $config, array $server)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->server = $server;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace Friendica\App;
|
||||
|
||||
use Detection\MobileDetect;
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Util\BasePath;
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ class Mode
|
|||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function determine(BasePath $basepath, Database $database, ConfigCache $configCache)
|
||||
public function determine(BasePath $basepath, Database $database, Cache $configCache)
|
||||
{
|
||||
$mode = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -151,13 +151,13 @@ class Module
|
|||
*
|
||||
* @param Arguments $args The Friendica execution arguments
|
||||
* @param Router $router The Friendica routing instance
|
||||
* @param Core\Config\IConfiguration $config The Friendica Configuration
|
||||
* @param Core\Config\IConfig $config The Friendica Configuration
|
||||
*
|
||||
* @return Module The determined module of this call
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function determineClass(Arguments $args, Router $router, Core\Config\IConfiguration $config)
|
||||
public function determineClass(Arguments $args, Router $router, Core\Config\IConfig $config)
|
||||
{
|
||||
$printNotAllowedAddon = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ use DOMDocument;
|
|||
use DOMXPath;
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IPConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\PConfig\IPConfig;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
|
|
@ -171,12 +171,12 @@ class Page implements ArrayAccess
|
|||
* @param App $app The Friendica App instance
|
||||
* @param Module $module The loaded Friendica module
|
||||
* @param L10n $l10n The l10n language instance
|
||||
* @param IConfiguration $config The Friendica configuration
|
||||
* @param IPConfiguration $pConfig The Friendica personal configuration (for user)
|
||||
* @param IConfig $config The Friendica configuration
|
||||
* @param IPConfig $pConfig The Friendica personal configuration (for user)
|
||||
*
|
||||
* @throws HTTPException\InternalServerErrorException
|
||||
*/
|
||||
private function initHead(App $app, Module $module, L10n $l10n, IConfiguration $config, IPConfiguration $pConfig)
|
||||
private function initHead(App $app, Module $module, L10n $l10n, IConfig $config, IPConfig $pConfig)
|
||||
{
|
||||
$interval = ((local_user()) ? $pConfig->get(local_user(), 'system', 'update_interval') : 40000);
|
||||
|
||||
|
|
@ -347,12 +347,12 @@ class Page implements ArrayAccess
|
|||
* @param Mode $mode The current node mode
|
||||
* @param Module $module The loaded Friendica module
|
||||
* @param L10n $l10n The l10n language class
|
||||
* @param IConfiguration $config The Configuration of this node
|
||||
* @param IPConfiguration $pconfig The personal/user configuration
|
||||
* @param IConfig $config The Configuration of this node
|
||||
* @param IPConfig $pconfig The personal/user configuration
|
||||
*
|
||||
* @throws HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public function run(App $app, BaseURL $baseURL, Mode $mode, Module $module, L10n $l10n, IConfiguration $config, IPConfiguration $pconfig)
|
||||
public function run(App $app, BaseURL $baseURL, Mode $mode, Module $module, L10n $l10n, IConfig $config, IPConfig $pconfig)
|
||||
{
|
||||
$moduleName = $module->getName();
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use FastRoute\Dispatcher;
|
|||
use FastRoute\RouteCollector;
|
||||
use FastRoute\RouteParser\Std;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
/**
|
||||
|
|
@ -44,12 +44,18 @@ class Router
|
|||
*/
|
||||
private $parameters = [];
|
||||
|
||||
/** @var L10n */
|
||||
private $l10n;
|
||||
|
||||
/**
|
||||
* @param array $server The $_SERVER variable
|
||||
* @param L10n $l10n
|
||||
* @param RouteCollector|null $routeCollector Optional the loaded Route collector
|
||||
*/
|
||||
public function __construct(array $server, RouteCollector $routeCollector = null)
|
||||
public function __construct(array $server, L10n $l10n, RouteCollector $routeCollector = null)
|
||||
{
|
||||
$this->l10n = $l10n;
|
||||
|
||||
$httpMethod = $server['REQUEST_METHOD'] ?? self::GET;
|
||||
$this->httpMethod = in_array($httpMethod, self::ALLOWED_METHODS) ? $httpMethod : self::GET;
|
||||
|
||||
|
|
@ -181,9 +187,9 @@ class Router
|
|||
$moduleClass = $routeInfo[1];
|
||||
$this->parameters = $routeInfo[2];
|
||||
} elseif ($routeInfo[0] === Dispatcher::METHOD_NOT_ALLOWED) {
|
||||
throw new HTTPException\MethodNotAllowedException(DI::l10n()->t('Method not allowed for this module. Allowed method(s): %s', implode(', ', $routeInfo[1])));
|
||||
throw new HTTPException\MethodNotAllowedException($this->l10n->t('Method not allowed for this module. Allowed method(s): %s', implode(', ', $routeInfo[1])));
|
||||
} else {
|
||||
throw new HTTPException\NotFoundException(DI::l10n()->t('Page not found.'));
|
||||
throw new HTTPException\NotFoundException($this->l10n->t('Page not found.'));
|
||||
}
|
||||
|
||||
return $moduleClass;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ namespace Friendica\Console;
|
|||
use Asika\SimpleConsole\Console;
|
||||
use Friendica\App;
|
||||
use Friendica\App\BaseURL;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Core\Installer;
|
||||
use Friendica\Core\Theme;
|
||||
use Friendica\Database\Database;
|
||||
|
|
@ -15,23 +16,13 @@ use RuntimeException;
|
|||
|
||||
class AutomaticInstallation extends Console
|
||||
{
|
||||
/**
|
||||
* @var App\Mode
|
||||
*/
|
||||
/** @var App\Mode */
|
||||
private $appMode;
|
||||
/**
|
||||
* @var Config\Cache\ConfigCache
|
||||
*/
|
||||
/** @var Cache */
|
||||
private $configCache;
|
||||
|
||||
/**
|
||||
* @var Config\IConfiguration
|
||||
*/
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
/**
|
||||
* @var Database
|
||||
*/
|
||||
/** @var Database */
|
||||
private $dba;
|
||||
|
||||
protected function getHelp()
|
||||
|
|
@ -89,12 +80,12 @@ Examples
|
|||
HELP;
|
||||
}
|
||||
|
||||
public function __construct(App\Mode $appMode, Config\Cache\ConfigCache $configCache, Config\IConfiguration $config, Database $dba, array $argv = null)
|
||||
public function __construct(App\Mode $appMode, Cache $configCache, IConfig $config, Database $dba, array $argv = null)
|
||||
{
|
||||
parent::__construct($argv);
|
||||
|
||||
$this->appMode = $appMode;
|
||||
$this->configCache =$configCache;
|
||||
$this->configCache = $configCache;
|
||||
$this->config = $config;
|
||||
$this->dba = $dba;
|
||||
}
|
||||
|
|
@ -242,12 +233,12 @@ HELP;
|
|||
|
||||
/**
|
||||
* @param Installer $installer The Installer instance
|
||||
* @param Config\Cache\ConfigCache $configCache The config cache
|
||||
* @param Cache $configCache The config cache
|
||||
*
|
||||
* @return bool true if checks were successfully, otherwise false
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
private function runBasicChecks(Installer $installer, Config\Cache\ConfigCache $configCache)
|
||||
private function runBasicChecks(Installer $installer, Cache $configCache)
|
||||
{
|
||||
$checked = true;
|
||||
|
||||
|
|
@ -281,6 +272,7 @@ HELP;
|
|||
|
||||
/**
|
||||
* @param array $results
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function extractErrors($results)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace Friendica\Console;
|
|||
|
||||
use Asika\SimpleConsole\CommandArgsException;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
|
|
@ -40,7 +40,7 @@ class Config extends \Asika\SimpleConsole\Console
|
|||
*/
|
||||
private $appMode;
|
||||
/**
|
||||
* @var IConfiguration
|
||||
* @var IConfig
|
||||
*/
|
||||
private $config;
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ HELP;
|
|||
return $help;
|
||||
}
|
||||
|
||||
public function __construct(App\Mode $appMode, IConfiguration $config, array $argv = null)
|
||||
public function __construct(App\Mode $appMode, IConfig $config, array $argv = null)
|
||||
{
|
||||
parent::__construct($argv);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Friendica\Console;
|
||||
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Core\Update;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Database\DBStructure;
|
||||
|
|
@ -22,7 +22,7 @@ class DatabaseStructure extends \Asika\SimpleConsole\Console
|
|||
*/
|
||||
private $dba;
|
||||
/**
|
||||
* @var ConfigCache
|
||||
* @var Cache
|
||||
*/
|
||||
private $configCache;
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ HELP;
|
|||
return $help;
|
||||
}
|
||||
|
||||
public function __construct(Database $dba, ConfigCache $configCache, $argv = null)
|
||||
public function __construct(Database $dba, Cache $configCache, $argv = null)
|
||||
{
|
||||
parent::__construct($argv);
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace Friendica\Console;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
|
||||
/**
|
||||
* Sets maintenance mode for this node
|
||||
|
|
@ -19,7 +19,7 @@ class Maintenance extends \Asika\SimpleConsole\Console
|
|||
*/
|
||||
private $appMode;
|
||||
/**
|
||||
* @var IConfiguration
|
||||
* @var IConfig
|
||||
*/
|
||||
private $config;
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ HELP;
|
|||
return $help;
|
||||
}
|
||||
|
||||
public function __construct(App\Mode $appMode, IConfiguration $config, $argv = null)
|
||||
public function __construct(App\Mode $appMode, IConfig $config, $argv = null)
|
||||
{
|
||||
parent::__construct($argv);
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace Friendica\Console;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Update;
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ class PostUpdate extends \Asika\SimpleConsole\Console
|
|||
*/
|
||||
private $appMode;
|
||||
/**
|
||||
* @var IConfiguration
|
||||
* @var IConfig
|
||||
*/
|
||||
private $config;
|
||||
/**
|
||||
|
|
@ -46,7 +46,7 @@ HELP;
|
|||
return $help;
|
||||
}
|
||||
|
||||
public function __construct(App\Mode $appMode, IConfiguration $config, L10n $l10n, array $argv = null)
|
||||
public function __construct(App\Mode $appMode, IConfig $config, L10n $l10n, array $argv = null)
|
||||
{
|
||||
parent::__construct($argv);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace Friendica\Console;
|
|||
use Asika\SimpleConsole\CommandArgsException;
|
||||
use Asika\SimpleConsole\Console;
|
||||
use Console_Table;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
|
||||
/**
|
||||
* Manage blocked servers
|
||||
|
|
@ -20,7 +20,7 @@ class ServerBlock extends Console
|
|||
protected $helpOptions = ['h', 'help', '?'];
|
||||
|
||||
/**
|
||||
* @var IConfiguration
|
||||
* @var IConfig
|
||||
*/
|
||||
private $config;
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ HELP;
|
|||
return $help;
|
||||
}
|
||||
|
||||
public function __construct(IConfiguration $config, $argv = null)
|
||||
public function __construct(IConfig $config, $argv = null)
|
||||
{
|
||||
parent::__construct($argv);
|
||||
|
||||
|
|
@ -77,9 +77,9 @@ HELP;
|
|||
/**
|
||||
* Prints the whole list of blocked domains including the reason
|
||||
*
|
||||
* @param IConfiguration $config
|
||||
* @param IConfig $config
|
||||
*/
|
||||
private function printBlockedServers(IConfiguration $config)
|
||||
private function printBlockedServers(IConfig $config)
|
||||
{
|
||||
$table = new Console_Table();
|
||||
$table->setHeaders(['Domain', 'Reason']);
|
||||
|
|
@ -93,11 +93,11 @@ HELP;
|
|||
/**
|
||||
* Adds a server to the blocked list
|
||||
*
|
||||
* @param IConfiguration $config
|
||||
* @param IConfig $config
|
||||
*
|
||||
* @return int The return code (0 = success, 1 = failed)
|
||||
*/
|
||||
private function addBlockedServer(IConfiguration $config)
|
||||
private function addBlockedServer(IConfig $config)
|
||||
{
|
||||
if (count($this->args) < 2 || count($this->args) > 3) {
|
||||
throw new CommandArgsException('Add needs a domain and optional a reason.');
|
||||
|
|
@ -145,11 +145,11 @@ HELP;
|
|||
/**
|
||||
* Removes a server from the blocked list
|
||||
*
|
||||
* @param IConfiguration $config
|
||||
* @param IConfig $config
|
||||
*
|
||||
* @return int The return code (0 = success, 1 = failed)
|
||||
*/
|
||||
private function removeBlockedServer(IConfiguration $config)
|
||||
private function removeBlockedServer(IConfig $config)
|
||||
{
|
||||
if (count($this->args) !== 2) {
|
||||
throw new CommandArgsException('Remove needs a second parameter.');
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Friendica\Console;
|
||||
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
|
||||
/**
|
||||
* Tired of chasing typos and finding them after a commit.
|
||||
|
|
@ -15,7 +15,7 @@ class Typo extends \Asika\SimpleConsole\Console
|
|||
protected $helpOptions = ['h', 'help', '?'];
|
||||
|
||||
/**
|
||||
* @var IConfiguration
|
||||
* @var IConfig
|
||||
*/
|
||||
private $config;
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ HELP;
|
|||
return $help;
|
||||
}
|
||||
|
||||
public function __construct(IConfiguration $config, array $argv = null)
|
||||
public function __construct(IConfig $config, array $argv = null)
|
||||
{
|
||||
parent::__construct($argv);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
namespace Friendica\Content;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
|
||||
|
|
@ -21,14 +20,14 @@ class Feature
|
|||
*/
|
||||
public static function isEnabled(int $uid, $feature)
|
||||
{
|
||||
$x = Config::get('feature_lock', $feature, false);
|
||||
$x = DI::config()->get('feature_lock', $feature, false);
|
||||
|
||||
if ($x === false) {
|
||||
$x = DI::pConfig()->get($uid, 'feature', $feature, false);
|
||||
}
|
||||
|
||||
if ($x === false) {
|
||||
$x = Config::get('feature', $feature, false);
|
||||
$x = DI::config()->get('feature', $feature, false);
|
||||
}
|
||||
|
||||
if ($x === false) {
|
||||
|
|
@ -80,45 +79,45 @@ class Feature
|
|||
'general' => [
|
||||
DI::l10n()->t('General Features'),
|
||||
//array('expire', DI::l10n()->t('Content Expiration'), DI::l10n()->t('Remove old posts/comments after a period of time')),
|
||||
['multi_profiles', DI::l10n()->t('Multiple Profiles'), DI::l10n()->t('Ability to create multiple profiles'), false, Config::get('feature_lock', 'multi_profiles', false)],
|
||||
['photo_location', DI::l10n()->t('Photo Location'), DI::l10n()->t("Photo metadata is normally stripped. This extracts the location \x28if present\x29 prior to stripping metadata and links it to a map."), false, Config::get('feature_lock', 'photo_location', false)],
|
||||
['export_calendar', DI::l10n()->t('Export Public Calendar'), DI::l10n()->t('Ability for visitors to download the public calendar'), false, Config::get('feature_lock', 'export_calendar', false)],
|
||||
['trending_tags', DI::l10n()->t('Trending Tags'), DI::l10n()->t('Show a community page widget with a list of the most popular tags in recent public posts.'), false, Config::get('feature_lock', 'trending_tags', false)],
|
||||
['multi_profiles', DI::l10n()->t('Multiple Profiles'), DI::l10n()->t('Ability to create multiple profiles'), false, DI::config()->get('feature_lock', 'multi_profiles', false)],
|
||||
['photo_location', DI::l10n()->t('Photo Location'), DI::l10n()->t("Photo metadata is normally stripped. This extracts the location \x28if present\x29 prior to stripping metadata and links it to a map."), false, DI::config()->get('feature_lock', 'photo_location', false)],
|
||||
['export_calendar', DI::l10n()->t('Export Public Calendar'), DI::l10n()->t('Ability for visitors to download the public calendar'), false, DI::config()->get('feature_lock', 'export_calendar', false)],
|
||||
['trending_tags', DI::l10n()->t('Trending Tags'), DI::l10n()->t('Show a community page widget with a list of the most popular tags in recent public posts.'), false, DI::config()->get('feature_lock', 'trending_tags', false)],
|
||||
],
|
||||
|
||||
// Post composition
|
||||
'composition' => [
|
||||
DI::l10n()->t('Post Composition Features'),
|
||||
['aclautomention', DI::l10n()->t('Auto-mention Forums'), DI::l10n()->t('Add/remove mention when a forum page is selected/deselected in ACL window.'), false, Config::get('feature_lock', 'aclautomention', false)],
|
||||
['explicit_mentions', DI::l10n()->t('Explicit Mentions'), DI::l10n()->t('Add explicit mentions to comment box for manual control over who gets mentioned in replies.'), false, Config::get('feature_lock', 'explicit_mentions', false)],
|
||||
['aclautomention', DI::l10n()->t('Auto-mention Forums'), DI::l10n()->t('Add/remove mention when a forum page is selected/deselected in ACL window.'), false, DI::config()->get('feature_lock', 'aclautomention', false)],
|
||||
['explicit_mentions', DI::l10n()->t('Explicit Mentions'), DI::l10n()->t('Add explicit mentions to comment box for manual control over who gets mentioned in replies.'), false, DI::config()->get('feature_lock', 'explicit_mentions', false)],
|
||||
],
|
||||
|
||||
// Network sidebar widgets
|
||||
'widgets' => [
|
||||
DI::l10n()->t('Network Sidebar'),
|
||||
['archives', DI::l10n()->t('Archives'), DI::l10n()->t('Ability to select posts by date ranges'), false, Config::get('feature_lock', 'archives', false)],
|
||||
['networks', DI::l10n()->t('Protocol Filter'), DI::l10n()->t('Enable widget to display Network posts only from selected protocols'), false, Config::get('feature_lock', 'networks', false)],
|
||||
['archives', DI::l10n()->t('Archives'), DI::l10n()->t('Ability to select posts by date ranges'), false, DI::config()->get('feature_lock', 'archives', false)],
|
||||
['networks', DI::l10n()->t('Protocol Filter'), DI::l10n()->t('Enable widget to display Network posts only from selected protocols'), false, DI::config()->get('feature_lock', 'networks', false)],
|
||||
],
|
||||
|
||||
// Network tabs
|
||||
'net_tabs' => [
|
||||
DI::l10n()->t('Network Tabs'),
|
||||
['new_tab', DI::l10n()->t('Network New Tab'), DI::l10n()->t("Enable tab to display only new Network posts \x28from the last 12 hours\x29"), false, Config::get('feature_lock', 'new_tab', false)],
|
||||
['link_tab', DI::l10n()->t('Network Shared Links Tab'), DI::l10n()->t('Enable tab to display only Network posts with links in them'), false, Config::get('feature_lock', 'link_tab', false)],
|
||||
['new_tab', DI::l10n()->t('Network New Tab'), DI::l10n()->t("Enable tab to display only new Network posts \x28from the last 12 hours\x29"), false, DI::config()->get('feature_lock', 'new_tab', false)],
|
||||
['link_tab', DI::l10n()->t('Network Shared Links Tab'), DI::l10n()->t('Enable tab to display only Network posts with links in them'), false, DI::config()->get('feature_lock', 'link_tab', false)],
|
||||
],
|
||||
|
||||
// Item tools
|
||||
'tools' => [
|
||||
DI::l10n()->t('Post/Comment Tools'),
|
||||
['categories', DI::l10n()->t('Post Categories'), DI::l10n()->t('Add categories to your posts'), false, Config::get('feature_lock', 'categories', false)],
|
||||
['categories', DI::l10n()->t('Post Categories'), DI::l10n()->t('Add categories to your posts'), false, DI::config()->get('feature_lock', 'categories', false)],
|
||||
],
|
||||
|
||||
// Advanced Profile Settings
|
||||
'advanced_profile' => [
|
||||
DI::l10n()->t('Advanced Profile Settings'),
|
||||
['forumlist_profile', DI::l10n()->t('List Forums'), DI::l10n()->t('Show visitors public community forums at the Advanced Profile Page'), false, Config::get('feature_lock', 'forumlist_profile', false)],
|
||||
['tagadelic', DI::l10n()->t('Tag Cloud'), DI::l10n()->t('Provide a personal tag cloud on your profile page'), false, Config::get('feature_lock', 'tagadelic', false)],
|
||||
['profile_membersince', DI::l10n()->t('Display Membership Date'), DI::l10n()->t('Display membership date in profile'), false, Config::get('feature_lock', 'profile_membersince', false)],
|
||||
['forumlist_profile', DI::l10n()->t('List Forums'), DI::l10n()->t('Show visitors public community forums at the Advanced Profile Page'), false, DI::config()->get('feature_lock', 'forumlist_profile', false)],
|
||||
['tagadelic', DI::l10n()->t('Tag Cloud'), DI::l10n()->t('Provide a personal tag cloud on your profile page'), false, DI::config()->get('feature_lock', 'tagadelic', false)],
|
||||
['profile_membersince', DI::l10n()->t('Display Membership Date'), DI::l10n()->t('Display membership date in profile'), false, DI::config()->get('feature_lock', 'profile_membersince', false)],
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
namespace Friendica\Content;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
|
|
@ -105,7 +104,7 @@ class Nav
|
|||
self::$app_menu = [];
|
||||
|
||||
//Don't populate apps_menu if apps are private
|
||||
$privateapps = Config::get('config', 'private_addons', false);
|
||||
$privateapps = DI::config()->get('config', 'private_addons', false);
|
||||
if (local_user() || !$privateapps) {
|
||||
$arr = ['app_menu' => self::$app_menu];
|
||||
|
||||
|
|
@ -180,13 +179,13 @@ class Nav
|
|||
$nav['home'] = [$homelink, DI::l10n()->t('Home'), '', DI::l10n()->t('Home Page')];
|
||||
}
|
||||
|
||||
if (intval(Config::get('config', 'register_policy')) === \Friendica\Module\Register::OPEN && !Session::isAuthenticated()) {
|
||||
if (intval(DI::config()->get('config', 'register_policy')) === \Friendica\Module\Register::OPEN && !Session::isAuthenticated()) {
|
||||
$nav['register'] = ['register', DI::l10n()->t('Register'), '', DI::l10n()->t('Create an account')];
|
||||
}
|
||||
|
||||
$help_url = 'help';
|
||||
|
||||
if (!Config::get('system', 'hide_help')) {
|
||||
if (!DI::config()->get('system', 'hide_help')) {
|
||||
$nav['help'] = [$help_url, DI::l10n()->t('Help'), '', DI::l10n()->t('Help and documentation')];
|
||||
}
|
||||
|
||||
|
|
@ -194,7 +193,7 @@ class Nav
|
|||
$nav['apps'] = ['apps', DI::l10n()->t('Apps'), '', DI::l10n()->t('Addon applications, utilities, games')];
|
||||
}
|
||||
|
||||
if (local_user() || !Config::get('system', 'local_search')) {
|
||||
if (local_user() || !DI::config()->get('system', 'local_search')) {
|
||||
$nav['search'] = ['search', DI::l10n()->t('Search'), '', DI::l10n()->t('Search site content')];
|
||||
|
||||
$nav['searchoption'] = [
|
||||
|
|
@ -203,22 +202,22 @@ class Nav
|
|||
DI::l10n()->t('Contacts')
|
||||
];
|
||||
|
||||
if (Config::get('system', 'poco_local_search')) {
|
||||
if (DI::config()->get('system', 'poco_local_search')) {
|
||||
$nav['searchoption'][] = DI::l10n()->t('Forums');
|
||||
}
|
||||
}
|
||||
|
||||
$gdirpath = 'directory';
|
||||
|
||||
if (strlen(Config::get('system', 'singleuser'))) {
|
||||
$gdir = Config::get('system', 'directory');
|
||||
if (strlen(DI::config()->get('system', 'singleuser'))) {
|
||||
$gdir = DI::config()->get('system', 'directory');
|
||||
if (strlen($gdir)) {
|
||||
$gdirpath = Profile::zrl($gdir, true);
|
||||
}
|
||||
}
|
||||
|
||||
if ((local_user() || Config::get('system', 'community_page_style') != CP_NO_COMMUNITY_PAGE) &&
|
||||
!(Config::get('system', 'community_page_style') == CP_NO_INTERNAL_COMMUNITY)) {
|
||||
if ((local_user() || DI::config()->get('system', 'community_page_style') != CP_NO_COMMUNITY_PAGE) &&
|
||||
!(DI::config()->get('system', 'community_page_style') == CP_NO_INTERNAL_COMMUNITY)) {
|
||||
$nav['community'] = ['community', DI::l10n()->t('Community'), '', DI::l10n()->t('Conversations on this and other servers')];
|
||||
}
|
||||
|
||||
|
|
@ -230,7 +229,7 @@ class Nav
|
|||
|
||||
$nav['about'] = ['friendica', DI::l10n()->t('Information'), '', DI::l10n()->t('Information about this friendica instance')];
|
||||
|
||||
if (Config::get('system', 'tosdisplay')) {
|
||||
if (DI::config()->get('system', 'tosdisplay')) {
|
||||
$nav['tos'] = ['tos', DI::l10n()->t('Terms of Service'), '', DI::l10n()->t('Terms of Service of this Friendica instance')];
|
||||
}
|
||||
|
||||
|
|
@ -274,7 +273,7 @@ class Nav
|
|||
$nav['navigation'] = ['navigation/', DI::l10n()->t('Navigation'), '', DI::l10n()->t('Site map')];
|
||||
|
||||
// Provide a banner/logo/whatever
|
||||
$banner = Config::get('system', 'banner');
|
||||
$banner = DI::config()->get('system', 'banner');
|
||||
if (is_null($banner)) {
|
||||
$banner = '<a href="https://friendi.ca"><img id="logo-img" src="images/friendica-32.png" alt="logo" /></a><span id="logo-text"><a href="https://friendi.ca">Friendica</a></span>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ use DOMText;
|
|||
use DOMXPath;
|
||||
use Exception;
|
||||
use Friendica\Core\Cache\Duration;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
|
|
@ -248,7 +247,7 @@ class OEmbed
|
|||
|
||||
public static function BBCode2HTML($text)
|
||||
{
|
||||
$stopoembed = Config::get("system", "no_oembed");
|
||||
$stopoembed = DI::config()->get("system", "no_oembed");
|
||||
if ($stopoembed == true) {
|
||||
return preg_replace("/\[embed\](.+?)\[\/embed\]/is", "<!-- oembed $1 --><i>" . DI::l10n()->t('Embedding disabled') . " : $1</i><!-- /oembed $1 -->", $text);
|
||||
}
|
||||
|
|
@ -302,7 +301,7 @@ class OEmbed
|
|||
*/
|
||||
public static function isAllowedURL($url)
|
||||
{
|
||||
if (!Config::get('system', 'no_oembed_rich_content')) {
|
||||
if (!DI::config()->get('system', 'no_oembed_rich_content')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -311,7 +310,7 @@ class OEmbed
|
|||
return false;
|
||||
}
|
||||
|
||||
$str_allowed = Config::get('system', 'allowed_oembed', '');
|
||||
$str_allowed = DI::config()->get('system', 'allowed_oembed', '');
|
||||
if (empty($str_allowed)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
*/
|
||||
namespace Friendica\Content;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Strings;
|
||||
|
|
@ -207,7 +206,7 @@ class Smilies
|
|||
*/
|
||||
public static function replaceFromArray($text, array $smilies, $no_images = false)
|
||||
{
|
||||
if (intval(Config::get('system', 'no_smilies'))
|
||||
if (intval(DI::config()->get('system', 'no_smilies'))
|
||||
|| (local_user() && intval(DI::pConfig()->get(local_user(), 'system', 'no_smilies')))
|
||||
) {
|
||||
return $text;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ use DOMXPath;
|
|||
use Exception;
|
||||
use Friendica\Content\OEmbed;
|
||||
use Friendica\Content\Smilies;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
|
|
@ -496,7 +495,7 @@ class BBCode
|
|||
*/
|
||||
public static function limitBodySize($body)
|
||||
{
|
||||
$maxlen = Config::get('config', 'max_import_size', 0);
|
||||
$maxlen = DI::config()->get('config', 'max_import_size', 0);
|
||||
|
||||
// If the length of the body, including the embedded images, is smaller
|
||||
// than the maximum, then don't waste time looking for the images
|
||||
|
|
@ -598,7 +597,7 @@ class BBCode
|
|||
$data['title'] = null;
|
||||
}
|
||||
|
||||
if (((strpos($data['text'], "[img=") !== false) || (strpos($data['text'], "[img]") !== false) || Config::get('system', 'always_show_preview')) && !empty($data['image'])) {
|
||||
if (((strpos($data['text'], "[img=") !== false) || (strpos($data['text'], "[img]") !== false) || DI::config()->get('system', 'always_show_preview')) && !empty($data['image'])) {
|
||||
$data['preview'] = $data['image'];
|
||||
$data['image'] = '';
|
||||
}
|
||||
|
|
@ -1345,7 +1344,7 @@ class BBCode
|
|||
$text = str_replace($search, $replace, $text);
|
||||
|
||||
// removing multiplicated newlines
|
||||
if (Config::get('system', 'remove_multiplicated_lines')) {
|
||||
if (DI::config()->get('system', 'remove_multiplicated_lines')) {
|
||||
$search = ["\n\n\n", "\n ", " \n", "[/quote]\n\n", "\n[/quote]", "[/li]\n", "\n[li]", "\n[ul]", "[/ul]\n", "\n\n[share ", "[/attachment]\n",
|
||||
"\n[h1]", "[/h1]\n", "\n[h2]", "[/h2]\n", "\n[h3]", "[/h3]\n", "\n[h4]", "[/h4]\n", "\n[h5]", "[/h5]\n", "\n[h6]", "[/h6]\n"];
|
||||
$replace = ["\n\n", "\n", "\n", "[/quote]\n", "[/quote]", "[/li]", "[li]", "[ul]", "[/ul]", "\n[share ", "[/attachment]",
|
||||
|
|
@ -1835,7 +1834,7 @@ class BBCode
|
|||
|
||||
// sanitize href attributes (only whitelisted protocols URLs)
|
||||
// default value for backward compatibility
|
||||
$allowed_link_protocols = Config::get('system', 'allowed_link_protocols', []);
|
||||
$allowed_link_protocols = DI::config()->get('system', 'allowed_link_protocols', []);
|
||||
|
||||
// Always allowed protocol even if config isn't set or not including it
|
||||
$allowed_link_protocols[] = '//';
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ use DOMDocument;
|
|||
use DOMXPath;
|
||||
use Friendica\Content\Widget\ContactBlock;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
|
|
@ -912,7 +911,7 @@ class HTML
|
|||
'contacts' => DI::l10n()->t('Contacts')
|
||||
];
|
||||
|
||||
if (Config::get('system', 'poco_local_search')) {
|
||||
if (DI::config()->get('system', 'poco_local_search')) {
|
||||
$values['$searchoption']['forums'] = DI::l10n()->t('Forums');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
namespace Friendica\Content;
|
||||
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
|
|
@ -46,9 +45,9 @@ class Widget
|
|||
*/
|
||||
public static function findPeople()
|
||||
{
|
||||
$global_dir = Config::get('system', 'directory');
|
||||
$global_dir = DI::config()->get('system', 'directory');
|
||||
|
||||
if (Config::get('system', 'invitation_only')) {
|
||||
if (DI::config()->get('system', 'invitation_only')) {
|
||||
$x = intval(DI::pConfig()->get(local_user(), 'system', 'invites_remaining'));
|
||||
if ($x || is_site_admin()) {
|
||||
DI::page()['aside'] .= '<div class="side-link widget" id="side-invite-remain">'
|
||||
|
|
@ -101,11 +100,11 @@ class Widget
|
|||
$networks[] = Protocol::TWITTER;
|
||||
}
|
||||
|
||||
if (Config::get("system", "ostatus_disabled")) {
|
||||
if (DI::config()->get("system", "ostatus_disabled")) {
|
||||
$networks[] = Protocol::OSTATUS;
|
||||
}
|
||||
|
||||
if (!Config::get("system", "diaspora_enabled")) {
|
||||
if (!DI::config()->get("system", "diaspora_enabled")) {
|
||||
$networks[] = Protocol::DIASPORA;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ class ACL
|
|||
$mail_enabled = false;
|
||||
$pubmail_enabled = false;
|
||||
|
||||
if (function_exists('imap_open') && !Config::get('system', 'imap_disabled')) {
|
||||
if (function_exists('imap_open') && !DI::config()->get('system', 'imap_disabled')) {
|
||||
$mailacct = DBA::selectFirst('mailacct', ['pubmail'], ['`uid` = ? AND `server` != ""', $user['uid']]);
|
||||
if (DBA::isResult($mailacct)) {
|
||||
$mail_enabled = true;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class Addon
|
|||
list($tmp, $addon) = array_map('trim', explode('/', $file));
|
||||
$info = self::getInfo($addon);
|
||||
|
||||
if (Config::get('system', 'show_unsupported_addons')
|
||||
if (DI::config()->get('system', 'show_unsupported_addons')
|
||||
|| strtolower($info['status']) != 'unsupported'
|
||||
|| self::isEnabled($addon)
|
||||
) {
|
||||
|
|
@ -103,7 +103,7 @@ class Addon
|
|||
$installed_addons = DBA::toArray($r);
|
||||
}
|
||||
|
||||
$addons = Config::get('system', 'addon');
|
||||
$addons = DI::config()->get('system', 'addon');
|
||||
$addons_arr = [];
|
||||
|
||||
if ($addons) {
|
||||
|
|
@ -210,7 +210,7 @@ class Addon
|
|||
*/
|
||||
public static function reload()
|
||||
{
|
||||
$addons = Config::get('system', 'addon');
|
||||
$addons = DI::config()->get('system', 'addon');
|
||||
if (strlen($addons)) {
|
||||
$r = DBA::select('addon', [], ['installed' => 1]);
|
||||
if (DBA::isResult($r)) {
|
||||
|
|
@ -348,7 +348,7 @@ class Addon
|
|||
*/
|
||||
public static function saveEnabledList()
|
||||
{
|
||||
return Config::set('system', 'addon', implode(',', self::$addons));
|
||||
return DI::config()->set('system', 'addon', implode(',', self::$addons));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Core\Config;
|
||||
namespace Friendica\Core;
|
||||
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Model;
|
||||
|
||||
/**
|
||||
|
|
@ -10,10 +12,10 @@ use Friendica\Model;
|
|||
* - The Config-Files (loaded into the FileCache @see Cache\ConfigCache)
|
||||
* - The Config-DB-Table (per Config-DB-model @see Model\Config\Config)
|
||||
*/
|
||||
abstract class Configuration implements IConfiguration
|
||||
abstract class BaseConfig implements IConfig
|
||||
{
|
||||
/**
|
||||
* @var Cache\ConfigCache
|
||||
* @var Cache
|
||||
*/
|
||||
protected $configCache;
|
||||
|
||||
|
|
@ -23,10 +25,10 @@ abstract class Configuration implements IConfiguration
|
|||
protected $configModel;
|
||||
|
||||
/**
|
||||
* @param Cache\ConfigCache $configCache The configuration cache (based on the config-files)
|
||||
* @param Cache $configCache The configuration cache (based on the config-files)
|
||||
* @param Model\Config\Config $configModel The configuration model
|
||||
*/
|
||||
public function __construct(Cache\ConfigCache $configCache, Model\Config\Config $configModel)
|
||||
public function __construct(Cache $configCache, Model\Config\Config $configModel)
|
||||
{
|
||||
$this->configCache = $configCache;
|
||||
$this->configModel = $configModel;
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Core\Config;
|
||||
namespace Friendica\Core;
|
||||
|
||||
use Friendica\Core\PConfig\Cache;
|
||||
use Friendica\Core\PConfig\IPConfig;
|
||||
use Friendica\Model;
|
||||
|
||||
/**
|
||||
|
|
@ -11,10 +13,10 @@ use Friendica\Model;
|
|||
* The configuration cache (@see Cache\PConfigCache) is used for temporary caching of database calls. This will
|
||||
* increase the performance.
|
||||
*/
|
||||
abstract class PConfiguration implements IPConfiguration
|
||||
abstract class BasePConfig implements IPConfig
|
||||
{
|
||||
/**
|
||||
* @var Cache\PConfigCache
|
||||
* @var Cache
|
||||
*/
|
||||
protected $configCache;
|
||||
|
||||
|
|
@ -24,10 +26,10 @@ abstract class PConfiguration implements IPConfiguration
|
|||
protected $configModel;
|
||||
|
||||
/**
|
||||
* @param Cache\PConfigCache $configCache The configuration cache
|
||||
* @param Cache $configCache The configuration cache
|
||||
* @param Model\Config\PConfig $configModel The configuration model
|
||||
*/
|
||||
public function __construct(Cache\PConfigCache $configCache, Model\Config\PConfig $configModel)
|
||||
public function __construct(Cache $configCache, Model\Config\PConfig $configModel)
|
||||
{
|
||||
$this->configCache = $configCache;
|
||||
$this->configModel = $configModel;
|
||||
|
|
@ -36,7 +38,7 @@ abstract class PConfiguration implements IPConfiguration
|
|||
/**
|
||||
* Returns the Config Cache
|
||||
*
|
||||
* @return Cache\PConfigCache
|
||||
* @return Cache
|
||||
*/
|
||||
public function getCache()
|
||||
{
|
||||
|
|
@ -4,7 +4,7 @@ namespace Friendica\Core\Cache;
|
|||
|
||||
use Exception;
|
||||
use Friendica\Core\BaseCache;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Memcache;
|
||||
|
||||
/**
|
||||
|
|
@ -26,7 +26,7 @@ class MemcacheCache extends BaseCache implements IMemoryCache
|
|||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct(string $hostname, IConfiguration $config)
|
||||
public function __construct(string $hostname, IConfig $config)
|
||||
{
|
||||
if (!class_exists('Memcache', false)) {
|
||||
throw new Exception('Memcache class isn\'t available');
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace Friendica\Core\Cache;
|
|||
|
||||
use Exception;
|
||||
use Friendica\Core\BaseCache;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Memcached;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ class MemcachedCache extends BaseCache implements IMemoryCache
|
|||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct(string $hostname, IConfiguration $config, LoggerInterface $logger)
|
||||
public function __construct(string $hostname, IConfig $config, LoggerInterface $logger)
|
||||
{
|
||||
if (!class_exists('Memcached', false)) {
|
||||
throw new Exception('Memcached class isn\'t available');
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace Friendica\Core\Cache;
|
|||
|
||||
use Exception;
|
||||
use Friendica\Core\BaseCache;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Redis;
|
||||
|
||||
/**
|
||||
|
|
@ -23,7 +23,7 @@ class RedisCache extends BaseCache implements IMemoryCache
|
|||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct(string $hostname, IConfiguration $config)
|
||||
public function __construct(string $hostname, IConfig $config)
|
||||
{
|
||||
if (!class_exists('Redis', false)) {
|
||||
throw new Exception('Redis class isn\'t available');
|
||||
|
|
|
|||
|
|
@ -1,77 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* System Configuration Class
|
||||
*
|
||||
* @file include/Core/Config.php
|
||||
*
|
||||
* Contains the class with methods for system configuration
|
||||
*/
|
||||
namespace Friendica\Core;
|
||||
|
||||
use Friendica\DI;
|
||||
|
||||
/**
|
||||
* Arbitrary system configuration storage
|
||||
*
|
||||
* Note:
|
||||
* If we ever would decide to return exactly the variable type as entered,
|
||||
* we will have fun with the additional features. :-)
|
||||
*/
|
||||
class Config
|
||||
{
|
||||
/**
|
||||
* Loads all configuration values of family into a cached storage.
|
||||
*
|
||||
* @param string $cat The category of the configuration value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function load($cat = "config")
|
||||
{
|
||||
DI::config()->load($cat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a particular user's config variable given the category name ($family) and a key.
|
||||
*
|
||||
* @param string $cat The category of the configuration value
|
||||
* @param string $key The configuration key to query
|
||||
* @param mixed $default_value optional, The value to return if key is not set (default: null)
|
||||
* @param boolean $refresh optional, If true the config is loaded from the db and not from the cache (default: false)
|
||||
*
|
||||
* @return mixed Stored value or null if it does not exist
|
||||
*/
|
||||
public static function get($cat, $key, $default_value = null, $refresh = false)
|
||||
{
|
||||
return DI::config()->get($cat, $key, $default_value, $refresh);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores a config value ($value) in the category ($cat) under the key ($key)
|
||||
*
|
||||
* Note: Please do not store booleans - convert to 0/1 integer values!
|
||||
*
|
||||
* @param string $cat The category of the configuration value
|
||||
* @param string $key The configuration key to set
|
||||
* @param mixed $value The value to store
|
||||
*
|
||||
* @return bool Operation success
|
||||
*/
|
||||
public static function set($cat, $key, $value)
|
||||
{
|
||||
return DI::config()->set($cat, $key, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the given key from the system configuration.
|
||||
*
|
||||
* @param string $cat The category of the configuration value
|
||||
* @param string $key The configuration key to delete
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function delete($cat, $key)
|
||||
{
|
||||
return DI::config()->delete($cat, $key);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Core\Config\Cache;
|
||||
namespace Friendica\Core\Config;
|
||||
|
||||
use ParagonIE\HiddenString\HiddenString;
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ use ParagonIE\HiddenString\HiddenString;
|
|||
* Initial, all *.config.php files are loaded into this cache with the
|
||||
* ConfigFileLoader ( @see ConfigFileLoader )
|
||||
*/
|
||||
class ConfigCache
|
||||
class Cache
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
|
|
@ -5,15 +5,13 @@ namespace Friendica\Core\Config;
|
|||
/**
|
||||
* Interface for accessing system wide configurations
|
||||
*/
|
||||
interface IConfiguration
|
||||
interface IConfig
|
||||
{
|
||||
|
||||
/**
|
||||
* Loads all configuration values of family into a cached storage.
|
||||
*
|
||||
* All configuration values of the system are stored in the cache ( @see ConfigCache )
|
||||
*
|
||||
* @param string $cat The category of the configuration value
|
||||
* All configuration values of the system are stored in the cache ( @param string $cat The category of the configuration value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -67,7 +65,7 @@ interface IConfiguration
|
|||
/**
|
||||
* Returns the Config Cache
|
||||
*
|
||||
* @return Cache\ConfigCache
|
||||
* @return Cache
|
||||
*/
|
||||
function getCache();
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Friendica\Core\Config;
|
||||
|
||||
use Friendica\Core\BaseConfig;
|
||||
use Friendica\Model;
|
||||
|
||||
/**
|
||||
|
|
@ -11,7 +12,7 @@ use Friendica\Model;
|
|||
* Default Configuration type.
|
||||
* Provides the best performance for pages loading few configuration variables.
|
||||
*/
|
||||
class JitConfiguration extends Configuration
|
||||
class JitConfig extends BaseConfig
|
||||
{
|
||||
/**
|
||||
* @var array Array of already loaded db values (even if there was no value)
|
||||
|
|
@ -19,10 +20,10 @@ class JitConfiguration extends Configuration
|
|||
private $db_loaded;
|
||||
|
||||
/**
|
||||
* @param Cache\ConfigCache $configCache The configuration cache (based on the config-files)
|
||||
* @param Cache $configCache The configuration cache (based on the config-files)
|
||||
* @param Model\Config\Config $configModel The configuration model
|
||||
*/
|
||||
public function __construct(Cache\ConfigCache $configCache, Model\Config\Config $configModel)
|
||||
public function __construct(Cache $configCache, Model\Config\Config $configModel)
|
||||
{
|
||||
parent::__construct($configCache, $configModel);
|
||||
$this->db_loaded = [];
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Friendica\Core\Config;
|
||||
|
||||
use Friendica\Core\BaseConfig;
|
||||
use Friendica\Model;
|
||||
|
||||
/**
|
||||
|
|
@ -10,16 +11,16 @@ use Friendica\Model;
|
|||
*
|
||||
* Minimizes the number of database queries to retrieve configuration values at the cost of memory.
|
||||
*/
|
||||
class PreloadConfiguration extends Configuration
|
||||
class PreloadConfig extends BaseConfig
|
||||
{
|
||||
/** @var bool */
|
||||
private $config_loaded;
|
||||
|
||||
/**
|
||||
* @param Cache\ConfigCache $configCache The configuration cache (based on the config-files)
|
||||
* @param Cache $configCache The configuration cache (based on the config-files)
|
||||
* @param Model\Config\Config $configModel The configuration model
|
||||
*/
|
||||
public function __construct(Cache\ConfigCache $configCache, Model\Config\Config $configModel)
|
||||
public function __construct(Cache $configCache, Model\Config\Config $configModel)
|
||||
{
|
||||
parent::__construct($configCache, $configModel);
|
||||
$this->config_loaded = false;
|
||||
|
|
@ -6,7 +6,7 @@ namespace Friendica\Core;
|
|||
|
||||
use DOMDocument;
|
||||
use Exception;
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Database\DBStructure;
|
||||
use Friendica\DI;
|
||||
|
|
@ -129,12 +129,12 @@ class Installer
|
|||
* - Creates `config/local.config.php`
|
||||
* - Installs Database Structure
|
||||
*
|
||||
* @param ConfigCache $configCache The config cache with all config relevant information
|
||||
* @param Cache $configCache The config cache with all config relevant information
|
||||
*
|
||||
* @return bool true if the config was created, otherwise false
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public function createConfig(ConfigCache $configCache)
|
||||
public function createConfig(Cache $configCache)
|
||||
{
|
||||
$basepath = $configCache->get('system', 'basepath');
|
||||
|
||||
|
|
@ -618,12 +618,12 @@ class Installer
|
|||
/**
|
||||
* Setup the default cache for a new installation
|
||||
*
|
||||
* @param ConfigCache $configCache The configuration cache
|
||||
* @param Cache $configCache The configuration cache
|
||||
* @param string $basePath The determined basepath
|
||||
*
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public function setUpCache(ConfigCache $configCache, $basePath)
|
||||
public function setUpCache(Cache $configCache, $basePath)
|
||||
{
|
||||
$configCache->set('config', 'php_path' , $this->getPHPPath());
|
||||
$configCache->set('system', 'basepath' , $basePath);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Friendica\Core;
|
||||
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\Session\ISession;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Util\Strings;
|
||||
|
|
@ -40,7 +40,7 @@ class L10n
|
|||
*/
|
||||
private $logger;
|
||||
|
||||
public function __construct(IConfiguration $config, Database $dba, LoggerInterface $logger, ISession $session, array $server, array $get)
|
||||
public function __construct(IConfig $config, Database $dba, LoggerInterface $logger, ISession $session, array $server, array $get)
|
||||
{
|
||||
$this->dba = $dba;
|
||||
$this->logger = $logger;
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Core\Config\Cache;
|
||||
namespace Friendica\Core\PConfig;
|
||||
|
||||
use ParagonIE\HiddenString\HiddenString;
|
||||
|
||||
/**
|
||||
* The Friendica config cache for users
|
||||
*/
|
||||
class PConfigCache
|
||||
class Cache
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Core\Config;
|
||||
namespace Friendica\Core\PConfig;
|
||||
|
||||
/**
|
||||
* Interface for accessing user specific configurations
|
||||
*/
|
||||
interface IPConfiguration
|
||||
interface IPConfig
|
||||
{
|
||||
|
||||
/**
|
||||
|
|
@ -17,7 +17,7 @@ interface IPConfiguration
|
|||
* @param string $cat The category of the configuration value
|
||||
*
|
||||
* @return void
|
||||
* @see PConfigCache
|
||||
* @see Cache
|
||||
*
|
||||
*/
|
||||
function load(int $uid, string $cat = 'config');
|
||||
|
|
@ -76,7 +76,7 @@ interface IPConfiguration
|
|||
/**
|
||||
* Returns the Config Cache
|
||||
*
|
||||
* @return Cache\PConfigCache
|
||||
* @return Cache
|
||||
*/
|
||||
function getCache();
|
||||
}
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Core\Config;
|
||||
namespace Friendica\Core\PConfig;
|
||||
|
||||
use Friendica\Core\BasePConfig;
|
||||
use Friendica\Model;
|
||||
|
||||
/**
|
||||
|
|
@ -11,7 +12,7 @@ use Friendica\Model;
|
|||
* Default Configuration type.
|
||||
* Provides the best performance for pages loading few configuration variables.
|
||||
*/
|
||||
class JitPConfiguration extends PConfiguration
|
||||
class JitPConfig extends BasePConfig
|
||||
{
|
||||
/**
|
||||
* @var array Array of already loaded db values (even if there was no value)
|
||||
|
|
@ -19,10 +20,10 @@ class JitPConfiguration extends PConfiguration
|
|||
private $db_loaded;
|
||||
|
||||
/**
|
||||
* @param Cache\PConfigCache $configCache The configuration cache
|
||||
* @param Cache $configCache The configuration cache
|
||||
* @param Model\Config\PConfig $configModel The configuration model
|
||||
*/
|
||||
public function __construct(Cache\PConfigCache $configCache, Model\Config\PConfig $configModel)
|
||||
public function __construct(Cache $configCache, Model\Config\PConfig $configModel)
|
||||
{
|
||||
parent::__construct($configCache, $configModel);
|
||||
$this->db_loaded = [];
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Core\Config;
|
||||
namespace Friendica\Core\PConfig;
|
||||
|
||||
use Friendica\Core\BasePConfig;
|
||||
use Friendica\Model;
|
||||
|
||||
/**
|
||||
|
|
@ -10,16 +11,16 @@ use Friendica\Model;
|
|||
*
|
||||
* Minimizes the number of database queries to retrieve configuration values at the cost of memory.
|
||||
*/
|
||||
class PreloadPConfiguration extends PConfiguration
|
||||
class PreloadPConfig extends BasePConfig
|
||||
{
|
||||
/** @var array */
|
||||
private $config_loaded;
|
||||
|
||||
/**
|
||||
* @param Cache\PConfigCache $configCache The configuration cache
|
||||
* @param Cache $configCache The configuration cache
|
||||
* @param Model\Config\PConfig $configModel The configuration model
|
||||
*/
|
||||
public function __construct(Cache\PConfigCache $configCache, Model\Config\PConfig $configModel)
|
||||
public function __construct(Cache $configCache, Model\Config\PConfig $configModel)
|
||||
{
|
||||
parent::__construct($configCache, $configModel);
|
||||
$this->config_loaded = [];
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
namespace Friendica\Core;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
|
|
@ -28,7 +28,7 @@ final class Process
|
|||
private $mode;
|
||||
|
||||
/**
|
||||
* @var IConfiguration
|
||||
* @var IConfig
|
||||
*/
|
||||
private $config;
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ final class Process
|
|||
*/
|
||||
private $basePath;
|
||||
|
||||
public function __construct(LoggerInterface $logger, App\Mode $mode, IConfiguration $config, string $basepath)
|
||||
public function __construct(LoggerInterface $logger, App\Mode $mode, IConfig $config, string $basepath)
|
||||
{
|
||||
$this->logger = $logger;
|
||||
$this->mode = $mode;
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ class Search
|
|||
*/
|
||||
public static function searchGlobalContact($search, $mode, int $page = 1)
|
||||
{
|
||||
if (Config::get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
|
@ -267,7 +267,7 @@ class Search
|
|||
}
|
||||
|
||||
// check if searching in the local global contact table is enabled
|
||||
if (Config::get('system', 'poco_local_search')) {
|
||||
if (DI::config()->get('system', 'poco_local_search')) {
|
||||
$return = GContact::searchByName($search, $mode);
|
||||
} else {
|
||||
$p = $page > 1 ? 'p=' . $page : '';
|
||||
|
|
@ -290,6 +290,6 @@ class Search
|
|||
*/
|
||||
public static function getGlobalDirectory()
|
||||
{
|
||||
return Config::get('system', 'directory', self::DEFAULT_DIRECTORY);
|
||||
return DI::config()->get('system', 'directory', self::DEFAULT_DIRECTORY);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace Friendica\Core;
|
||||
|
||||
use Exception;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Model\Storage;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
|
@ -35,7 +35,7 @@ class StorageManager
|
|||
|
||||
/** @var Database */
|
||||
private $dba;
|
||||
/** @var IConfiguration */
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
|
@ -47,11 +47,11 @@ class StorageManager
|
|||
|
||||
/**
|
||||
* @param Database $dba
|
||||
* @param IConfiguration $config
|
||||
* @param IConfig $config
|
||||
* @param LoggerInterface $logger
|
||||
* @param L10n $l10n
|
||||
*/
|
||||
public function __construct(Database $dba, IConfiguration $config, LoggerInterface $logger, L10n $l10n)
|
||||
public function __construct(Database $dba, IConfig $config, LoggerInterface $logger, L10n $l10n)
|
||||
{
|
||||
$this->dba = $dba;
|
||||
$this->config = $config;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class Theme
|
|||
{
|
||||
public static function getAllowedList()
|
||||
{
|
||||
$allowed_themes_str = Config::get('system', 'allowed_themes');
|
||||
$allowed_themes_str = DI::config()->get('system', 'allowed_themes');
|
||||
$allowed_themes_raw = explode(',', str_replace(' ', '', $allowed_themes_str));
|
||||
$allowed_themes = [];
|
||||
if (count($allowed_themes_raw)) {
|
||||
|
|
@ -36,7 +36,7 @@ class Theme
|
|||
|
||||
public static function setAllowedList(array $allowed_themes)
|
||||
{
|
||||
Config::set('system', 'allowed_themes', implode(',', array_unique($allowed_themes)));
|
||||
DI::config()->set('system', 'allowed_themes', implode(',', array_unique($allowed_themes)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -29,14 +29,14 @@ class Update
|
|||
}
|
||||
|
||||
// Don't check the status if the last update was failed
|
||||
if (Config::get('system', 'update', Update::SUCCESS, true) == Update::FAILED) {
|
||||
if (DI::config()->get('system', 'update', Update::SUCCESS, true) == Update::FAILED) {
|
||||
return;
|
||||
}
|
||||
|
||||
$build = Config::get('system', 'build');
|
||||
$build = DI::config()->get('system', 'build');
|
||||
|
||||
if (empty($build)) {
|
||||
Config::set('system', 'build', DB_UPDATE_VERSION - 1);
|
||||
DI::config()->set('system', 'build', DB_UPDATE_VERSION - 1);
|
||||
$build = DB_UPDATE_VERSION - 1;
|
||||
}
|
||||
|
||||
|
|
@ -77,11 +77,11 @@ class Update
|
|||
DI::lock()->release('dbupdate', true);
|
||||
}
|
||||
|
||||
$build = Config::get('system', 'build', null, true);
|
||||
$build = DI::config()->get('system', 'build', null, true);
|
||||
|
||||
if (empty($build) || ($build > DB_UPDATE_VERSION)) {
|
||||
$build = DB_UPDATE_VERSION - 1;
|
||||
Config::set('system', 'build', $build);
|
||||
DI::config()->set('system', 'build', $build);
|
||||
}
|
||||
|
||||
if ($build != DB_UPDATE_VERSION || $force) {
|
||||
|
|
@ -90,7 +90,7 @@ class Update
|
|||
$stored = intval($build);
|
||||
$current = intval(DB_UPDATE_VERSION);
|
||||
if ($stored < $current || $force) {
|
||||
Config::load('database');
|
||||
DI::config()->load('database');
|
||||
|
||||
Logger::info('Update starting.', ['from' => $stored, 'to' => $current]);
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ class Update
|
|||
if (DI::lock()->acquire('dbupdate', 120, Cache\Duration::INFINITE)) {
|
||||
|
||||
// Checks if the build changed during Lock acquiring (so no double update occurs)
|
||||
$retryBuild = Config::get('system', 'build', null, true);
|
||||
$retryBuild = DI::config()->get('system', 'build', null, true);
|
||||
if ($retryBuild !== $build) {
|
||||
Logger::info('Update already done.', ['from' => $stored, 'to' => $current]);
|
||||
DI::lock()->release('dbupdate');
|
||||
|
|
@ -110,7 +110,7 @@ class Update
|
|||
for ($x = $stored + 1; $x <= $current; $x++) {
|
||||
$r = self::runUpdateFunction($x, 'pre_update');
|
||||
if (!$r) {
|
||||
Config::set('system', 'update', Update::FAILED);
|
||||
DI::config()->set('system', 'update', Update::FAILED);
|
||||
DI::lock()->release('dbupdate');
|
||||
return $r;
|
||||
}
|
||||
|
|
@ -126,12 +126,12 @@ class Update
|
|||
);
|
||||
}
|
||||
Logger::error('Update ERROR.', ['from' => $stored, 'to' => $current, 'retval' => $retval]);
|
||||
Config::set('system', 'update', Update::FAILED);
|
||||
DI::config()->set('system', 'update', Update::FAILED);
|
||||
DI::lock()->release('dbupdate');
|
||||
return $retval;
|
||||
} else {
|
||||
Config::set('database', 'last_successful_update', $current);
|
||||
Config::set('database', 'last_successful_update_time', time());
|
||||
DI::config()->set('database', 'last_successful_update', $current);
|
||||
DI::config()->set('database', 'last_successful_update_time', time());
|
||||
Logger::info('Update finished.', ['from' => $stored, 'to' => $current]);
|
||||
}
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ class Update
|
|||
for ($x = $stored + 1; $x <= $current; $x++) {
|
||||
$r = self::runUpdateFunction($x, 'update');
|
||||
if (!$r) {
|
||||
Config::set('system', 'update', Update::FAILED);
|
||||
DI::config()->set('system', 'update', Update::FAILED);
|
||||
DI::lock()->release('dbupdate');
|
||||
return $r;
|
||||
}
|
||||
|
|
@ -150,7 +150,7 @@ class Update
|
|||
self::updateSuccessfull($stored, $current);
|
||||
}
|
||||
|
||||
Config::set('system', 'update', Update::SUCCESS);
|
||||
DI::config()->set('system', 'update', Update::SUCCESS);
|
||||
DI::lock()->release('dbupdate');
|
||||
}
|
||||
}
|
||||
|
|
@ -197,11 +197,11 @@ class Update
|
|||
DI::lock()->release('dbupdate_function');
|
||||
return false;
|
||||
} else {
|
||||
Config::set('database', 'last_successful_update_function', $funcname);
|
||||
Config::set('database', 'last_successful_update_function_time', time());
|
||||
DI::config()->set('database', 'last_successful_update_function', $funcname);
|
||||
DI::config()->set('database', 'last_successful_update_function_time', time());
|
||||
|
||||
if ($prefix == 'update') {
|
||||
Config::set('system', 'build', $x);
|
||||
DI::config()->set('system', 'build', $x);
|
||||
}
|
||||
|
||||
DI::lock()->release('dbupdate_function');
|
||||
|
|
@ -212,11 +212,11 @@ class Update
|
|||
} else {
|
||||
Logger::info('Update function skipped.', ['function' => $funcname]);
|
||||
|
||||
Config::set('database', 'last_successful_update_function', $funcname);
|
||||
Config::set('database', 'last_successful_update_function_time', time());
|
||||
DI::config()->set('database', 'last_successful_update_function', $funcname);
|
||||
DI::config()->set('database', 'last_successful_update_function_time', time());
|
||||
|
||||
if ($prefix == 'update') {
|
||||
Config::set('system', 'build', $x);
|
||||
DI::config()->set('system', 'build', $x);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -232,7 +232,7 @@ class Update
|
|||
*/
|
||||
private static function updateFailed($update_id, $error_message) {
|
||||
//send the administrators an e-mail
|
||||
$condition = ['email' => explode(",", str_replace(" ", "", Config::get('config', 'admin_email'))), 'parent-uid' => 0];
|
||||
$condition = ['email' => explode(",", str_replace(" ", "", DI::config()->get('config', 'admin_email'))), 'parent-uid' => 0];
|
||||
$adminlist = DBA::select('user', ['uid', 'language', 'email'], $condition, ['order' => ['uid']]);
|
||||
|
||||
// No valid result?
|
||||
|
|
@ -281,7 +281,7 @@ class Update
|
|||
private static function updateSuccessfull($from_build, $to_build)
|
||||
{
|
||||
//send the administrators an e-mail
|
||||
$condition = ['email' => explode(",", str_replace(" ", "", Config::get('config', 'admin_email'))), 'parent-uid' => 0];
|
||||
$condition = ['email' => explode(",", str_replace(" ", "", DI::config()->get('config', 'admin_email'))), 'parent-uid' => 0];
|
||||
$adminlist = DBA::select('user', ['uid', 'language', 'email'], $condition, ['order' => ['uid']]);
|
||||
|
||||
if (DBA::isResult($adminlist)) {
|
||||
|
|
|
|||
|
|
@ -63,9 +63,9 @@ class Worker
|
|||
self::startProcess();
|
||||
|
||||
// Kill stale processes every 5 minutes
|
||||
$last_cleanup = Config::get('system', 'worker_last_cleaned', 0);
|
||||
$last_cleanup = DI::config()->get('system', 'worker_last_cleaned', 0);
|
||||
if (time() > ($last_cleanup + 300)) {
|
||||
Config::set('system', 'worker_last_cleaned', time());
|
||||
DI::config()->set('system', 'worker_last_cleaned', time());
|
||||
self::killStaleWorkers();
|
||||
}
|
||||
|
||||
|
|
@ -148,7 +148,7 @@ class Worker
|
|||
}
|
||||
|
||||
// Quit the worker once every cron interval
|
||||
if (time() > ($starttime + (Config::get('system', 'cron_interval') * 60))) {
|
||||
if (time() > ($starttime + (DI::config()->get('system', 'cron_interval') * 60))) {
|
||||
Logger::info('Process lifetime reached, respawning.');
|
||||
self::spawnWorker();
|
||||
return;
|
||||
|
|
@ -156,7 +156,7 @@ class Worker
|
|||
}
|
||||
|
||||
// Cleaning up. Possibly not needed, but it doesn't harm anything.
|
||||
if (Config::get('system', 'worker_daemon_mode', false)) {
|
||||
if (DI::config()->get('system', 'worker_daemon_mode', false)) {
|
||||
self::IPCSetJobState(false);
|
||||
}
|
||||
Logger::log("Couldn't select a workerqueue entry, quitting process " . getmypid() . ".", Logger::DEBUG);
|
||||
|
|
@ -252,7 +252,7 @@ class Worker
|
|||
$mypid = getmypid();
|
||||
|
||||
// Quit when in maintenance
|
||||
if (Config::get('system', 'maintenance', false, true)) {
|
||||
if (DI::config()->get('system', 'maintenance', false, true)) {
|
||||
Logger::log("Maintenance mode - quit process ".$mypid, Logger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -297,7 +297,7 @@ class Worker
|
|||
$stamp = (float)microtime(true);
|
||||
$condition = ["`id` = ? AND `next_try` < ?", $queue['id'], DateTimeFormat::utcNow()];
|
||||
if (DBA::update('workerqueue', ['done' => true], $condition)) {
|
||||
Config::set('system', 'last_worker_execution', DateTimeFormat::utcNow());
|
||||
DI::config()->set('system', 'last_worker_execution', DateTimeFormat::utcNow());
|
||||
}
|
||||
self::$db_duration = (microtime(true) - $stamp);
|
||||
self::$db_duration_write += (microtime(true) - $stamp);
|
||||
|
|
@ -343,7 +343,7 @@ class Worker
|
|||
|
||||
$stamp = (float)microtime(true);
|
||||
if (DBA::update('workerqueue', ['done' => true], ['id' => $queue["id"]])) {
|
||||
Config::set('system', 'last_worker_execution', DateTimeFormat::utcNow());
|
||||
DI::config()->set('system', 'last_worker_execution', DateTimeFormat::utcNow());
|
||||
}
|
||||
self::$db_duration = (microtime(true) - $stamp);
|
||||
self::$db_duration_write += (microtime(true) - $stamp);
|
||||
|
|
@ -441,7 +441,7 @@ class Worker
|
|||
|
||||
DI::profiler()->saveLog(DI::logger(), "ID " . $queue["id"] . ": " . $funcname);
|
||||
|
||||
$cooldown = Config::get("system", "worker_cooldown", 0);
|
||||
$cooldown = DI::config()->get("system", "worker_cooldown", 0);
|
||||
|
||||
if ($cooldown > 0) {
|
||||
Logger::info('Cooldown.', ['priority' => $queue["priority"], 'id' => $queue["id"], 'cooldown' => $cooldown]);
|
||||
|
|
@ -458,10 +458,10 @@ class Worker
|
|||
private static function maxConnectionsReached()
|
||||
{
|
||||
// Fetch the max value from the config. This is needed when the system cannot detect the correct value by itself.
|
||||
$max = Config::get("system", "max_connections");
|
||||
$max = DI::config()->get("system", "max_connections");
|
||||
|
||||
// Fetch the percentage level where the worker will get active
|
||||
$maxlevel = Config::get("system", "max_connections_level", 75);
|
||||
$maxlevel = DI::config()->get("system", "max_connections_level", 75);
|
||||
|
||||
if ($max == 0) {
|
||||
// the maximum number of possible user connections can be a system variable
|
||||
|
|
@ -613,7 +613,7 @@ class Worker
|
|||
*/
|
||||
private static function tooMuchWorkers()
|
||||
{
|
||||
$queues = Config::get("system", "worker_queues", 10);
|
||||
$queues = DI::config()->get("system", "worker_queues", 10);
|
||||
|
||||
$maxqueues = $queues;
|
||||
|
||||
|
|
@ -622,21 +622,21 @@ class Worker
|
|||
// Decrease the number of workers at higher load
|
||||
$load = System::currentLoad();
|
||||
if ($load) {
|
||||
$maxsysload = intval(Config::get("system", "maxloadavg", 20));
|
||||
$maxsysload = intval(DI::config()->get("system", "maxloadavg", 20));
|
||||
|
||||
/* Default exponent 3 causes queues to rapidly decrease as load increases.
|
||||
* If you have 20 max queues at idle, then you get only 5 queues at 37.1% of $maxsysload.
|
||||
* For some environments, this rapid decrease is not needed.
|
||||
* With exponent 1, you could have 20 max queues at idle and 13 at 37% of $maxsysload.
|
||||
*/
|
||||
$exponent = intval(Config::get('system', 'worker_load_exponent', 3));
|
||||
$exponent = intval(DI::config()->get('system', 'worker_load_exponent', 3));
|
||||
$slope = pow(max(0, $maxsysload - $load) / $maxsysload, $exponent);
|
||||
$queues = intval(ceil($slope * $maxqueues));
|
||||
|
||||
$processlist = '';
|
||||
|
||||
if (Config::get('system', 'worker_jpm')) {
|
||||
$intervals = explode(',', Config::get('system', 'worker_jpm_range'));
|
||||
if (DI::config()->get('system', 'worker_jpm')) {
|
||||
$intervals = explode(',', DI::config()->get('system', 'worker_jpm_range'));
|
||||
$jobs_per_minute = [];
|
||||
foreach ($intervals as $interval) {
|
||||
if ($interval == 0) {
|
||||
|
|
@ -664,7 +664,7 @@ class Worker
|
|||
|
||||
$deferred = self::deferredEntries();
|
||||
|
||||
if (Config::get('system', 'worker_debug')) {
|
||||
if (DI::config()->get('system', 'worker_debug')) {
|
||||
$waiting_processes = 0;
|
||||
// Now adding all processes with workerqueue entries
|
||||
$stamp = (float)microtime(true);
|
||||
|
|
@ -704,7 +704,7 @@ class Worker
|
|||
|
||||
$processlist .= ' ('.implode(', ', $listitem).')';
|
||||
|
||||
if (Config::get("system", "worker_fastlane", false) && ($queues > 0) && ($active >= $queues) && self::entriesExists()) {
|
||||
if (DI::config()->get("system", "worker_fastlane", false) && ($queues > 0) && ($active >= $queues) && self::entriesExists()) {
|
||||
$top_priority = self::highestPriority();
|
||||
$high_running = self::processWithPriorityActive($top_priority);
|
||||
|
||||
|
|
@ -717,9 +717,9 @@ class Worker
|
|||
Logger::log("Load: " . $load ."/" . $maxsysload . " - processes: " . $deferred . "/" . $active . "/" . $waiting_processes . $processlist . " - maximum: " . $queues . "/" . $maxqueues, Logger::DEBUG);
|
||||
|
||||
// Are there fewer workers running as possible? Then fork a new one.
|
||||
if (!Config::get("system", "worker_dont_fork", false) && ($queues > ($active + 1)) && self::entriesExists()) {
|
||||
if (!DI::config()->get("system", "worker_dont_fork", false) && ($queues > ($active + 1)) && self::entriesExists()) {
|
||||
Logger::log("Active workers: ".$active."/".$queues." Fork a new worker.", Logger::DEBUG);
|
||||
if (Config::get('system', 'worker_daemon_mode', false)) {
|
||||
if (DI::config()->get('system', 'worker_daemon_mode', false)) {
|
||||
self::IPCSetJobState(true);
|
||||
} else {
|
||||
self::spawnWorker();
|
||||
|
|
@ -728,7 +728,7 @@ class Worker
|
|||
}
|
||||
|
||||
// if there are too much worker, we don't spawn a new one.
|
||||
if (Config::get('system', 'worker_daemon_mode', false) && ($active > $queues)) {
|
||||
if (DI::config()->get('system', 'worker_daemon_mode', false) && ($active > $queues)) {
|
||||
self::IPCSetJobState(false);
|
||||
}
|
||||
|
||||
|
|
@ -782,7 +782,7 @@ class Worker
|
|||
return [];
|
||||
}
|
||||
|
||||
$limit = Config::get('system', 'worker_fetch_limit', 1);
|
||||
$limit = DI::config()->get('system', 'worker_fetch_limit', 1);
|
||||
|
||||
$ids = [];
|
||||
$stamp = (float)microtime(true);
|
||||
|
|
@ -890,7 +890,7 @@ class Worker
|
|||
|
||||
// If there is no result we check without priority limit
|
||||
if (empty($ids)) {
|
||||
$limit = Config::get('system', 'worker_fetch_limit', 1);
|
||||
$limit = DI::config()->get('system', 'worker_fetch_limit', 1);
|
||||
|
||||
$stamp = (float)microtime(true);
|
||||
$condition = ["`pid` = 0 AND NOT `done` AND `next_try` < ?", DateTimeFormat::utcNow()];
|
||||
|
|
@ -976,7 +976,7 @@ class Worker
|
|||
*/
|
||||
public static function callWorker()
|
||||
{
|
||||
if (!Config::get("system", "frontend_worker")) {
|
||||
if (!DI::config()->get("system", "frontend_worker")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -992,7 +992,7 @@ class Worker
|
|||
*/
|
||||
public static function executeIfIdle()
|
||||
{
|
||||
if (!Config::get("system", "frontend_worker")) {
|
||||
if (!DI::config()->get("system", "frontend_worker")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1000,11 +1000,11 @@ class Worker
|
|||
if (function_exists("proc_open")) {
|
||||
// When was the last time that we called the worker?
|
||||
// Less than one minute? Then we quit
|
||||
if ((time() - Config::get("system", "worker_started")) < 60) {
|
||||
if ((time() - DI::config()->get("system", "worker_started")) < 60) {
|
||||
return;
|
||||
}
|
||||
|
||||
Config::set("system", "worker_started", time());
|
||||
DI::config()->set("system", "worker_started", time());
|
||||
|
||||
// Do we have enough running workers? Then we quit here.
|
||||
if (self::tooMuchWorkers()) {
|
||||
|
|
@ -1044,7 +1044,7 @@ class Worker
|
|||
*/
|
||||
public static function clearProcesses()
|
||||
{
|
||||
$timeout = Config::get("system", "frontend_worker_timeout", 10);
|
||||
$timeout = DI::config()->get("system", "frontend_worker_timeout", 10);
|
||||
|
||||
/// @todo We should clean up the corresponding workerqueue entries as well
|
||||
$stamp = (float)microtime(true);
|
||||
|
|
@ -1093,7 +1093,7 @@ class Worker
|
|||
$process->run($command, $args);
|
||||
|
||||
// after spawning we have to remove the flag.
|
||||
if (Config::get('system', 'worker_daemon_mode', false)) {
|
||||
if (DI::config()->get('system', 'worker_daemon_mode', false)) {
|
||||
self::IPCSetJobState(false);
|
||||
}
|
||||
}
|
||||
|
|
@ -1132,7 +1132,7 @@ class Worker
|
|||
|
||||
$priority = PRIORITY_MEDIUM;
|
||||
// Don't fork from frontend tasks by default
|
||||
$dont_fork = Config::get("system", "worker_dont_fork", false) || !DI::mode()->isBackend();
|
||||
$dont_fork = DI::config()->get("system", "worker_dont_fork", false) || !DI::mode()->isBackend();
|
||||
$created = DateTimeFormat::utcNow();
|
||||
$force_priority = false;
|
||||
|
||||
|
|
@ -1192,7 +1192,7 @@ class Worker
|
|||
}
|
||||
|
||||
// We tell the daemon that a new job entry exists
|
||||
if (Config::get('system', 'worker_daemon_mode', false)) {
|
||||
if (DI::config()->get('system', 'worker_daemon_mode', false)) {
|
||||
// We don't have to set the IPC flag - this is done in "tooMuchWorkers"
|
||||
return $added;
|
||||
}
|
||||
|
|
@ -1246,7 +1246,7 @@ class Worker
|
|||
$id = $queue['id'];
|
||||
$priority = $queue['priority'];
|
||||
|
||||
$max_level = Config::get('system', 'worker_defer_limit');
|
||||
$max_level = DI::config()->get('system', 'worker_defer_limit');
|
||||
|
||||
$new_retrial = self::getNextRetrial($queue, $max_level);
|
||||
|
||||
|
|
|
|||
|
|
@ -133,19 +133,19 @@ abstract class DI
|
|||
}
|
||||
|
||||
/**
|
||||
* @return Core\Config\IConfiguration
|
||||
* @return Core\Config\IConfig
|
||||
*/
|
||||
public static function config()
|
||||
{
|
||||
return self::$dice->create(Core\Config\IConfiguration::class);
|
||||
return self::$dice->create(Core\Config\IConfig::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Core\Config\IPConfiguration
|
||||
* @return \Friendica\Core\PConfig\IPConfig
|
||||
*/
|
||||
public static function pConfig()
|
||||
{
|
||||
return self::$dice->create(Core\Config\IPConfiguration::class);
|
||||
return self::$dice->create(Core\PConfig\IPConfig::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
namespace Friendica\Database;
|
||||
|
||||
use Exception;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\DI;
|
||||
|
|
@ -260,8 +259,8 @@ class DBStructure
|
|||
public static function update($basePath, $verbose, $action, $install = false, array $tables = null, array $definition = null)
|
||||
{
|
||||
if ($action && !$install) {
|
||||
Config::set('system', 'maintenance', 1);
|
||||
Config::set('system', 'maintenance_reason', DI::l10n()->t('%s: Database update', DateTimeFormat::utcNow() . ' ' . date('e')));
|
||||
DI::config()->set('system', 'maintenance', 1);
|
||||
DI::config()->set('system', 'maintenance_reason', DI::l10n()->t('%s: Database update', DateTimeFormat::utcNow() . ' ' . date('e')));
|
||||
}
|
||||
|
||||
$errors = '';
|
||||
|
|
@ -522,7 +521,7 @@ class DBStructure
|
|||
|
||||
if ($action) {
|
||||
if (!$install) {
|
||||
Config::set('system', 'maintenance_reason', DI::l10n()->t('%s: updating %s table.', DateTimeFormat::utcNow() . ' ' . date('e'), $name));
|
||||
DI::config()->set('system', 'maintenance_reason', DI::l10n()->t('%s: updating %s table.', DateTimeFormat::utcNow() . ' ' . date('e'), $name));
|
||||
}
|
||||
|
||||
// Ensure index conversion to unique removes duplicates
|
||||
|
|
@ -574,13 +573,13 @@ class DBStructure
|
|||
}
|
||||
|
||||
if ($action && !$install) {
|
||||
Config::set('system', 'maintenance', 0);
|
||||
Config::set('system', 'maintenance_reason', '');
|
||||
DI::config()->set('system', 'maintenance', 0);
|
||||
DI::config()->set('system', 'maintenance_reason', '');
|
||||
|
||||
if ($errors) {
|
||||
Config::set('system', 'dbupdate', self::UPDATE_FAILED);
|
||||
DI::config()->set('system', 'dbupdate', self::UPDATE_FAILED);
|
||||
} else {
|
||||
Config::set('system', 'dbupdate', self::UPDATE_SUCCESSFUL);
|
||||
DI::config()->set('system', 'dbupdate', self::UPDATE_SUCCESSFUL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Friendica\Database;
|
||||
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
|
@ -25,7 +25,7 @@ class Database
|
|||
protected $connected = false;
|
||||
|
||||
/**
|
||||
* @var ConfigCache
|
||||
* @var Cache
|
||||
*/
|
||||
protected $configCache;
|
||||
/**
|
||||
|
|
@ -47,7 +47,7 @@ class Database
|
|||
protected $in_retrial = false;
|
||||
private $relation = [];
|
||||
|
||||
public function __construct(ConfigCache $configCache, Profiler $profiler, LoggerInterface $logger, array $server = [])
|
||||
public function __construct(Cache $configCache, Profiler $profiler, LoggerInterface $logger, array $server = [])
|
||||
{
|
||||
// We are storing these values for being able to perform a reconnect
|
||||
$this->configCache = $configCache;
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
*/
|
||||
namespace Friendica\Database;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\ItemURI;
|
||||
|
|
@ -57,24 +57,24 @@ class PostUpdate
|
|||
private static function update1194()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (Config::get("system", "post_update_version") >= 1194) {
|
||||
if (DI::config()->get("system", "post_update_version") >= 1194) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Logger::log("Start", Logger::DEBUG);
|
||||
|
||||
$end_id = Config::get("system", "post_update_1194_end");
|
||||
$end_id = DI::config()->get("system", "post_update_1194_end");
|
||||
if (!$end_id) {
|
||||
$r = q("SELECT `id` FROM `item` WHERE `uid` != 0 ORDER BY `id` DESC LIMIT 1");
|
||||
if ($r) {
|
||||
Config::set("system", "post_update_1194_end", $r[0]["id"]);
|
||||
$end_id = Config::get("system", "post_update_1194_end");
|
||||
DI::config()->set("system", "post_update_1194_end", $r[0]["id"]);
|
||||
$end_id = DI::config()->get("system", "post_update_1194_end");
|
||||
}
|
||||
}
|
||||
|
||||
Logger::log("End ID: ".$end_id, Logger::DEBUG);
|
||||
|
||||
$start_id = Config::get("system", "post_update_1194_start");
|
||||
$start_id = DI::config()->get("system", "post_update_1194_start");
|
||||
|
||||
$query1 = "SELECT `item`.`id` FROM `item` ";
|
||||
|
||||
|
|
@ -90,12 +90,12 @@ class PostUpdate
|
|||
intval($start_id), intval($end_id),
|
||||
DBA::escape(Protocol::DFRN), DBA::escape(Protocol::DIASPORA), DBA::escape(Protocol::OSTATUS));
|
||||
if (!$r) {
|
||||
Config::set("system", "post_update_version", 1194);
|
||||
DI::config()->set("system", "post_update_version", 1194);
|
||||
Logger::log("Update is done", Logger::DEBUG);
|
||||
return true;
|
||||
} else {
|
||||
Config::set("system", "post_update_1194_start", $r[0]["id"]);
|
||||
$start_id = Config::get("system", "post_update_1194_start");
|
||||
DI::config()->set("system", "post_update_1194_start", $r[0]["id"]);
|
||||
$start_id = DI::config()->get("system", "post_update_1194_start");
|
||||
}
|
||||
|
||||
Logger::log("Start ID: ".$start_id, Logger::DEBUG);
|
||||
|
|
@ -128,7 +128,7 @@ class PostUpdate
|
|||
private static function update1206()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (Config::get("system", "post_update_version") >= 1206) {
|
||||
if (DI::config()->get("system", "post_update_version") >= 1206) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ class PostUpdate
|
|||
}
|
||||
}
|
||||
|
||||
Config::set("system", "post_update_version", 1206);
|
||||
DI::config()->set("system", "post_update_version", 1206);
|
||||
Logger::log("Done", Logger::DEBUG);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -162,11 +162,11 @@ class PostUpdate
|
|||
private static function update1279()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (Config::get("system", "post_update_version") >= 1279) {
|
||||
if (DI::config()->get("system", "post_update_version") >= 1279) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$id = Config::get("system", "post_update_version_1279_id", 0);
|
||||
$id = DI::config()->get("system", "post_update_version_1279_id", 0);
|
||||
|
||||
Logger::log("Start from item " . $id, Logger::DEBUG);
|
||||
|
||||
|
|
@ -235,7 +235,7 @@ class PostUpdate
|
|||
}
|
||||
DBA::close($items);
|
||||
|
||||
Config::set("system", "post_update_version_1279_id", $id);
|
||||
DI::config()->set("system", "post_update_version_1279_id", $id);
|
||||
|
||||
Logger::log("Processed rows: " . $rows . " - last processed item: " . $id, Logger::DEBUG);
|
||||
|
||||
|
|
@ -254,7 +254,7 @@ class PostUpdate
|
|||
DBA::update('item', $fields, $condition);
|
||||
}
|
||||
|
||||
Config::set("system", "post_update_version", 1279);
|
||||
DI::config()->set("system", "post_update_version", 1279);
|
||||
Logger::log("Done", Logger::DEBUG);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -313,11 +313,11 @@ class PostUpdate
|
|||
private static function update1281()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (Config::get("system", "post_update_version") >= 1281) {
|
||||
if (DI::config()->get("system", "post_update_version") >= 1281) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$id = Config::get("system", "post_update_version_1281_id", 0);
|
||||
$id = DI::config()->get("system", "post_update_version_1281_id", 0);
|
||||
|
||||
Logger::log("Start from item " . $id, Logger::DEBUG);
|
||||
|
||||
|
|
@ -369,7 +369,7 @@ class PostUpdate
|
|||
}
|
||||
DBA::close($items);
|
||||
|
||||
Config::set("system", "post_update_version_1281_id", $id);
|
||||
DI::config()->set("system", "post_update_version_1281_id", $id);
|
||||
|
||||
Logger::log("Processed rows: " . $rows . " - last processed item: " . $id, Logger::DEBUG);
|
||||
|
||||
|
|
@ -380,7 +380,7 @@ class PostUpdate
|
|||
Logger::log("Updating item-uri in item-content", Logger::DEBUG);
|
||||
DBA::e("UPDATE `item-content` INNER JOIN `item-uri` ON `item-uri`.`uri` = `item-content`.`uri` SET `item-content`.`uri-id` = `item-uri`.`id` WHERE `item-content`.`uri-id` IS NULL");
|
||||
|
||||
Config::set("system", "post_update_version", 1281);
|
||||
DI::config()->set("system", "post_update_version", 1281);
|
||||
Logger::log("Done", Logger::DEBUG);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -397,7 +397,7 @@ class PostUpdate
|
|||
private static function update1297()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (Config::get('system', 'post_update_version') >= 1297) {
|
||||
if (DI::config()->get('system', 'post_update_version') >= 1297) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -417,7 +417,7 @@ class PostUpdate
|
|||
|
||||
Logger::info('Processed rows: ' . DBA::affectedRows());
|
||||
|
||||
Config::set('system', 'post_update_version', 1297);
|
||||
DI::config()->set('system', 'post_update_version', 1297);
|
||||
|
||||
Logger::info('Done');
|
||||
|
||||
|
|
@ -432,7 +432,7 @@ class PostUpdate
|
|||
private static function update1322()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (Config::get('system', 'post_update_version') >= 1322) {
|
||||
if (DI::config()->get('system', 'post_update_version') >= 1322) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -451,7 +451,7 @@ class PostUpdate
|
|||
}
|
||||
|
||||
DBA::close($contact);
|
||||
Config::set('system', 'post_update_version', 1322);
|
||||
DI::config()->set('system', 'post_update_version', 1322);
|
||||
|
||||
Logger::info('Done');
|
||||
|
||||
|
|
@ -467,11 +467,11 @@ class PostUpdate
|
|||
private static function update1329()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (Config::get('system', 'post_update_version') >= 1329) {
|
||||
if (DI::config()->get('system', 'post_update_version') >= 1329) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$id = Config::get('system', 'post_update_version_1329_id', 0);
|
||||
$id = DI::config()->get('system', 'post_update_version_1329_id', 0);
|
||||
|
||||
Logger::info('Start', ['item' => $id]);
|
||||
|
||||
|
|
@ -495,12 +495,12 @@ class PostUpdate
|
|||
}
|
||||
DBA::close($items);
|
||||
|
||||
Config::set('system', 'post_update_version_1329_id', $id);
|
||||
DI::config()->set('system', 'post_update_version_1329_id', $id);
|
||||
|
||||
Logger::info('Processed', ['rows' => $rows, 'last' => $id]);
|
||||
|
||||
if ($start_id == $id) {
|
||||
Config::set('system', 'post_update_version', 1329);
|
||||
DI::config()->set('system', 'post_update_version', 1329);
|
||||
Logger::info('Done');
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace Friendica\Factory;
|
|||
use Friendica\App\BaseURL;
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Cache\ICache;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Util\Profiler;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
|
@ -25,7 +25,7 @@ class CacheFactory
|
|||
const DEFAULT_TYPE = Cache\Type::DATABASE;
|
||||
|
||||
/**
|
||||
* @var IConfiguration The IConfiguration to read parameters out of the config
|
||||
* @var IConfig The IConfiguration to read parameters out of the config
|
||||
*/
|
||||
private $config;
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ class CacheFactory
|
|||
*/
|
||||
private $logger;
|
||||
|
||||
public function __construct(BaseURL $baseURL, IConfiguration $config, Database $dba, Profiler $profiler, LoggerInterface $logger)
|
||||
public function __construct(BaseURL $baseURL, IConfig $config, Database $dba, Profiler $profiler, LoggerInterface $logger)
|
||||
{
|
||||
$this->hostname = $baseURL->getHostname();
|
||||
$this->config = $config;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Friendica\Factory;
|
||||
|
||||
use Exception;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Model\Config\Config as ConfigModel;
|
||||
|
|
@ -13,28 +14,30 @@ class ConfigFactory
|
|||
/**
|
||||
* @param ConfigFileLoader $loader The Config Cache loader (INI/config/.htconfig)
|
||||
*
|
||||
* @return Cache\ConfigCache
|
||||
* @return Cache
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function createCache(ConfigFileLoader $loader)
|
||||
{
|
||||
$configCache = new Cache\ConfigCache();
|
||||
$configCache = new Cache();
|
||||
$loader->setupCache($configCache);
|
||||
|
||||
return $configCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Cache\ConfigCache $configCache The config cache of this adapter
|
||||
* @param Cache $configCache The config cache of this adapter
|
||||
* @param ConfigModel $configModel The configuration model
|
||||
*
|
||||
* @return Config\IConfiguration
|
||||
* @return Config\IConfig
|
||||
*/
|
||||
public function createConfig(Cache\ConfigCache $configCache, ConfigModel $configModel)
|
||||
public function createConfig(Cache $configCache, ConfigModel $configModel)
|
||||
{
|
||||
if ($configCache->get('system', 'config_adapter') === 'preload') {
|
||||
$configuration = new Config\PreloadConfiguration($configCache, $configModel);
|
||||
$configuration = new Config\PreloadConfig($configCache, $configModel);
|
||||
} else {
|
||||
$configuration = new Config\JitConfiguration($configCache, $configModel);
|
||||
$configuration = new Config\JitConfig($configCache, $configModel);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -42,18 +45,18 @@ class ConfigFactory
|
|||
}
|
||||
|
||||
/**
|
||||
* @param Cache\ConfigCache $configCache The config cache
|
||||
* @param Cache\PConfigCache $pConfigCache The personal config cache
|
||||
* @param Cache $configCache The config cache
|
||||
* @param \Friendica\Core\PConfig\Cache $pConfigCache The personal config cache
|
||||
* @param PConfigModel $configModel The configuration model
|
||||
*
|
||||
* @return Config\IPConfiguration
|
||||
* @return \Friendica\Core\PConfig\IPConfig
|
||||
*/
|
||||
public function createPConfig(Cache\ConfigCache $configCache, Cache\PConfigCache $pConfigCache, PConfigModel $configModel)
|
||||
public function createPConfig(Cache $configCache, \Friendica\Core\PConfig\Cache $pConfigCache, PConfigModel $configModel)
|
||||
{
|
||||
if ($configCache->get('system', 'config_adapter') === 'preload') {
|
||||
$configuration = new Config\PreloadPConfiguration($pConfigCache, $configModel);
|
||||
$configuration = new \Friendica\Core\PConfig\PreloadPConfig($pConfigCache, $configModel);
|
||||
} else {
|
||||
$configuration = new Config\JitPConfiguration($pConfigCache, $configModel);
|
||||
$configuration = new \Friendica\Core\PConfig\JitPConfig($pConfigCache, $configModel);
|
||||
}
|
||||
|
||||
return $configuration;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace Friendica\Factory;
|
|||
|
||||
use Friendica\Core\Cache\IMemoryCache;
|
||||
use Friendica\Core\Cache\Type;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\Lock;
|
||||
use Friendica\Database\Database;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
|
@ -24,7 +24,7 @@ class LockFactory
|
|||
const DEFAULT_DRIVER = 'default';
|
||||
|
||||
/**
|
||||
* @var IConfiguration The configuration to read parameters out of the config
|
||||
* @var IConfig The configuration to read parameters out of the config
|
||||
*/
|
||||
private $config;
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ class LockFactory
|
|||
*/
|
||||
private $logger;
|
||||
|
||||
public function __construct(CacheFactory $cacheFactory, IConfiguration $config, Database $dba, LoggerInterface $logger)
|
||||
public function __construct(CacheFactory $cacheFactory, IConfig $config, Database $dba, LoggerInterface $logger)
|
||||
{
|
||||
$this->cacheFactory = $cacheFactory;
|
||||
$this->config = $config;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Friendica\Factory;
|
||||
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||
|
|
@ -50,13 +50,13 @@ class LoggerFactory
|
|||
* Creates a new PSR-3 compliant logger instances
|
||||
*
|
||||
* @param Database $database The Friendica Database instance
|
||||
* @param IConfiguration $config The config
|
||||
* @param IConfig $config The config
|
||||
* @param Profiler $profiler The profiler of the app
|
||||
* @param FileSystem $fileSystem FileSystem utils
|
||||
*
|
||||
* @return LoggerInterface The PSR-3 compliant logger instance
|
||||
*/
|
||||
public function create(Database $database, IConfiguration $config, Profiler $profiler, FileSystem $fileSystem)
|
||||
public function create(Database $database, IConfig $config, Profiler $profiler, FileSystem $fileSystem)
|
||||
{
|
||||
if (empty($config->get('system', 'debugging', false))) {
|
||||
$logger = new VoidLogger();
|
||||
|
|
@ -137,7 +137,7 @@ class LoggerFactory
|
|||
*
|
||||
* It should never get filled during normal usage of Friendica
|
||||
*
|
||||
* @param IConfiguration $config The config
|
||||
* @param IConfig $config The config
|
||||
* @param Profiler $profiler The profiler of the app
|
||||
* @param FileSystem $fileSystem FileSystem utils
|
||||
*
|
||||
|
|
@ -146,7 +146,7 @@ class LoggerFactory
|
|||
* @throws InternalServerErrorException
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function createDev(IConfiguration $config, Profiler $profiler, FileSystem $fileSystem)
|
||||
public static function createDev(IConfig $config, Profiler $profiler, FileSystem $fileSystem)
|
||||
{
|
||||
$debugging = $config->get('system', 'debugging');
|
||||
$stream = $config->get('system', 'dlogfile');
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace Friendica\Factory;
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Cache\ICache;
|
||||
use Friendica\Core\Cache\Type;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\Database;
|
||||
|
|
@ -29,7 +29,7 @@ class SessionFactory
|
|||
/**
|
||||
* @param App\Mode $mode
|
||||
* @param App\BaseURL $baseURL
|
||||
* @param IConfiguration $config
|
||||
* @param IConfig $config
|
||||
* @param Database $dba
|
||||
* @param ICache $cache
|
||||
* @param LoggerInterface $logger
|
||||
|
|
@ -37,7 +37,7 @@ class SessionFactory
|
|||
*
|
||||
* @return Session\ISession
|
||||
*/
|
||||
public function createSession(App\Mode $mode, App\BaseURL $baseURL, IConfiguration $config, Database $dba, ICache $cache, LoggerInterface $logger, Profiler $profiler, array $server = [])
|
||||
public function createSession(App\Mode $mode, App\BaseURL $baseURL, IConfig $config, Database $dba, ICache $cache, LoggerInterface $logger, Profiler $profiler, array $server = [])
|
||||
{
|
||||
$stamp1 = microtime(true);
|
||||
$session = null;
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ namespace Friendica\Model;
|
|||
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\JsonLD;
|
||||
|
|
@ -33,7 +33,7 @@ class APContact
|
|||
return false;
|
||||
}
|
||||
|
||||
$xrd_timeout = Config::get('system', 'xrd_timeout');
|
||||
$xrd_timeout = DI::config()->get('system', 'xrd_timeout');
|
||||
|
||||
$webfinger = 'https://' . $addr_parts[1] . '/.well-known/webfinger?resource=acct:' . urlencode($addr);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ namespace Friendica\Model;
|
|||
|
||||
use Friendica\App\BaseURL;
|
||||
use Friendica\Content\Pager;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
|
|
@ -919,7 +918,7 @@ class Contact
|
|||
*/
|
||||
|
||||
/// @todo Check for contact vitality via probing
|
||||
$archival_days = Config::get('system', 'archival_days', 32);
|
||||
$archival_days = DI::config()->get('system', 'archival_days', 32);
|
||||
|
||||
$expiry = $contact['term-date'] . ' + ' . $archival_days . ' days ';
|
||||
if (DateTimeFormat::utcNow() > DateTimeFormat::utc($expiry)) {
|
||||
|
|
@ -2322,7 +2321,7 @@ class Contact
|
|||
|
||||
// NOTREACHED
|
||||
}
|
||||
} elseif (Config::get('system', 'dfrn_only') && ($ret['network'] != Protocol::DFRN)) {
|
||||
} elseif (DI::config()->get('system', 'dfrn_only') && ($ret['network'] != Protocol::DFRN)) {
|
||||
$result['message'] = DI::l10n()->t('This site is not configured to allow communications with other networks.') . EOL;
|
||||
$result['message'] .= DI::l10n()->t('No compatible communication protocols or feeds were discovered.') . EOL;
|
||||
return $result;
|
||||
|
|
@ -2352,7 +2351,7 @@ class Contact
|
|||
return $result;
|
||||
}
|
||||
|
||||
if ($protocol === Protocol::OSTATUS && Config::get('system', 'ostatus_disabled')) {
|
||||
if ($protocol === Protocol::OSTATUS && DI::config()->get('system', 'ostatus_disabled')) {
|
||||
$result['message'] .= DI::l10n()->t('The profile address specified belongs to a network which has been disabled on this site.') . EOL;
|
||||
$ret['notify'] = '';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ namespace Friendica\Model;
|
|||
use DOMDocument;
|
||||
use DOMXPath;
|
||||
use Exception;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
|
|
@ -43,13 +42,13 @@ class GContact
|
|||
}
|
||||
|
||||
// check supported networks
|
||||
if (Config::get('system', 'diaspora_enabled')) {
|
||||
if (DI::config()->get('system', 'diaspora_enabled')) {
|
||||
$diaspora = Protocol::DIASPORA;
|
||||
} else {
|
||||
$diaspora = Protocol::DFRN;
|
||||
}
|
||||
|
||||
if (!Config::get('system', 'ostatus_disabled')) {
|
||||
if (!DI::config()->get('system', 'ostatus_disabled')) {
|
||||
$ostatus = Protocol::OSTATUS;
|
||||
} else {
|
||||
$ostatus = Protocol::DFRN;
|
||||
|
|
@ -424,11 +423,11 @@ class GContact
|
|||
|
||||
$network = [Protocol::DFRN, Protocol::ACTIVITYPUB];
|
||||
|
||||
if (Config::get('system', 'diaspora_enabled')) {
|
||||
if (DI::config()->get('system', 'diaspora_enabled')) {
|
||||
$network[] = Protocol::DIASPORA;
|
||||
}
|
||||
|
||||
if (!Config::get('system', 'ostatus_disabled')) {
|
||||
if (!DI::config()->get('system', 'ostatus_disabled')) {
|
||||
$network[] = Protocol::OSTATUS;
|
||||
}
|
||||
|
||||
|
|
@ -508,7 +507,7 @@ class GContact
|
|||
|
||||
$done[] = DI::baseUrl() . '/poco';
|
||||
|
||||
if (strlen(Config::get('system', 'directory'))) {
|
||||
if (strlen(DI::config()->get('system', 'directory'))) {
|
||||
$x = Network::fetchUrl(Search::getGlobalDirectory() . '/pubsites');
|
||||
if (!empty($x)) {
|
||||
$j = json_decode($x);
|
||||
|
|
@ -1235,7 +1234,7 @@ class GContact
|
|||
*/
|
||||
public static function discoverGsUsers()
|
||||
{
|
||||
$requery_days = intval(Config::get('system', 'poco_requery_days'));
|
||||
$requery_days = intval(DI::config()->get('system', 'poco_requery_days'));
|
||||
|
||||
$last_update = date("c", time() - (60 * 60 * 24 * $requery_days));
|
||||
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ namespace Friendica\Model;
|
|||
|
||||
use DOMDocument;
|
||||
use DOMXPath;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\Register;
|
||||
use Friendica\Network\CurlResult;
|
||||
use Friendica\Util\Network;
|
||||
|
|
@ -192,7 +192,7 @@ class GServer
|
|||
}
|
||||
|
||||
// When a nodeinfo is present, we don't need to dig further
|
||||
$xrd_timeout = Config::get('system', 'xrd_timeout');
|
||||
$xrd_timeout = DI::config()->get('system', 'xrd_timeout');
|
||||
$curlResult = Network::curl($url . '/.well-known/nodeinfo', false, ['timeout' => $xrd_timeout]);
|
||||
if ($curlResult->isTimeout()) {
|
||||
DBA::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => Strings::normaliseLink($url)]);
|
||||
|
|
@ -726,7 +726,7 @@ class GServer
|
|||
*/
|
||||
private static function validHostMeta(string $url)
|
||||
{
|
||||
$xrd_timeout = Config::get('system', 'xrd_timeout');
|
||||
$xrd_timeout = DI::config()->get('system', 'xrd_timeout');
|
||||
$curlResult = Network::curl($url . '/.well-known/host-meta', false, ['timeout' => $xrd_timeout]);
|
||||
if (!$curlResult->isSuccess()) {
|
||||
return false;
|
||||
|
|
@ -1348,7 +1348,7 @@ class GServer
|
|||
|
||||
$no_of_queries = 5;
|
||||
|
||||
$requery_days = intval(Config::get('system', 'poco_requery_days'));
|
||||
$requery_days = intval(DI::config()->get('system', 'poco_requery_days'));
|
||||
|
||||
if ($requery_days == 0) {
|
||||
$requery_days = 7;
|
||||
|
|
@ -1388,7 +1388,7 @@ class GServer
|
|||
*/
|
||||
private static function discoverFederation()
|
||||
{
|
||||
$last = Config::get('poco', 'last_federation_discovery');
|
||||
$last = DI::config()->get('poco', 'last_federation_discovery');
|
||||
|
||||
if ($last) {
|
||||
$next = $last + (24 * 60 * 60);
|
||||
|
|
@ -1412,7 +1412,7 @@ class GServer
|
|||
}
|
||||
|
||||
// Disvover Mastodon servers
|
||||
$accesstoken = Config::get('system', 'instances_social_key');
|
||||
$accesstoken = DI::config()->get('system', 'instances_social_key');
|
||||
|
||||
if (!empty($accesstoken)) {
|
||||
$api = 'https://instances.social/api/1.0/instances/list?count=0';
|
||||
|
|
@ -1429,6 +1429,6 @@ class GServer
|
|||
}
|
||||
}
|
||||
|
||||
Config::set('poco', 'last_federation_discovery', time());
|
||||
DI::config()->set('poco', 'last_federation_discovery', time());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ namespace Friendica\Model;
|
|||
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
|
|
@ -104,7 +103,7 @@ class Item
|
|||
public static function isLegacyMode()
|
||||
{
|
||||
if (is_null(self::$legacy_mode)) {
|
||||
self::$legacy_mode = (Config::get("system", "post_update_version") < 1279);
|
||||
self::$legacy_mode = (DI::config()->get("system", "post_update_version") < 1279);
|
||||
}
|
||||
|
||||
return self::$legacy_mode;
|
||||
|
|
@ -1451,7 +1450,7 @@ class Item
|
|||
$uid = intval($item['uid']);
|
||||
|
||||
// check for create date and expire time
|
||||
$expire_interval = Config::get('system', 'dbclean-expire-days', 0);
|
||||
$expire_interval = DI::config()->get('system', 'dbclean-expire-days', 0);
|
||||
|
||||
$user = DBA::selectFirst('user', ['expire'], ['uid' => $uid]);
|
||||
if (DBA::isResult($user) && ($user['expire'] > 0) && (($user['expire'] < $expire_interval) || ($expire_interval == 0))) {
|
||||
|
|
@ -1879,7 +1878,7 @@ class Item
|
|||
unset($item['owner-name']);
|
||||
unset($item['owner-avatar']);
|
||||
|
||||
$like_no_comment = Config::get('system', 'like_no_comment');
|
||||
$like_no_comment = DI::config()->get('system', 'like_no_comment');
|
||||
|
||||
DBA::transaction();
|
||||
$ret = DBA::insert('item', $item);
|
||||
|
|
@ -2585,7 +2584,7 @@ class Item
|
|||
$URLSearchString = "^\[\]";
|
||||
|
||||
// All hashtags should point to the home server if "local_tags" is activated
|
||||
if (Config::get('system', 'local_tags')) {
|
||||
if (DI::config()->get('system', 'local_tags')) {
|
||||
$item["body"] = preg_replace("/#\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
|
||||
"#[url=".DI::baseUrl()."/search?tag=$2]$2[/url]", $item["body"]);
|
||||
|
||||
|
|
@ -2842,7 +2841,7 @@ class Item
|
|||
*/
|
||||
public static function fixPrivatePhotos($s, $uid, $item = null, $cid = 0)
|
||||
{
|
||||
if (Config::get('system', 'disable_embedded')) {
|
||||
if (DI::config()->get('system', 'disable_embedded')) {
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
|
@ -3420,7 +3419,7 @@ class Item
|
|||
if ($rendered_hash == ''
|
||||
|| $rendered_html == ""
|
||||
|| $rendered_hash != hash("md5", $item["body"])
|
||||
|| Config::get("system", "ignore_cache")
|
||||
|| DI::config()->get("system", "ignore_cache")
|
||||
) {
|
||||
self::addRedirToImageTags($item);
|
||||
|
||||
|
|
@ -3439,7 +3438,7 @@ class Item
|
|||
}
|
||||
|
||||
// Only compare the HTML when we forcefully ignore the cache
|
||||
if (Config::get("system", "ignore_cache") && ($rendered_html != $item["rendered-html"])) {
|
||||
if (DI::config()->get("system", "ignore_cache") && ($rendered_html != $item["rendered-html"])) {
|
||||
$update = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use Exception;
|
|||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\Config\IPConfiguration;
|
||||
use Friendica\Core\PConfig\IPConfig;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
|
|
@ -71,13 +71,13 @@ final class Notify
|
|||
private $args;
|
||||
/** @var App\BaseURL */
|
||||
private $baseUrl;
|
||||
/** @var IPConfiguration */
|
||||
/** @var IPConfig */
|
||||
private $pConfig;
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
public function __construct(Database $dba, L10n $l10n, App\Arguments $args, App\BaseURL $baseUrl,
|
||||
IPConfiguration $pConfig, LoggerInterface $logger)
|
||||
IPConfig $pConfig, LoggerInterface $logger)
|
||||
{
|
||||
$this->dba = $dba;
|
||||
$this->l10n = $l10n;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
namespace Friendica\Model;
|
||||
|
||||
use Friendica\Core\Cache\Duration;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
|
|
@ -541,7 +540,7 @@ class Photo
|
|||
$key = "photo_albums:".$uid.":".local_user().":".remote_user();
|
||||
$albums = DI::cache()->get($key);
|
||||
if (is_null($albums) || $update) {
|
||||
if (!Config::get("system", "no_count", false)) {
|
||||
if (!DI::config()->get("system", "no_count", false)) {
|
||||
/// @todo This query needs to be renewed. It is really slow
|
||||
// At this time we just store the data in the cache
|
||||
$albums = q("SELECT COUNT(DISTINCT `resource-id`) AS `total`, `album`, ANY_VALUE(`created`) AS `created`
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Content\Widget\ContactBlock;
|
||||
use Friendica\Core\Cache\Duration;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
|
|
@ -183,7 +182,7 @@ class Profile
|
|||
$a->profile['mobile-theme'] = DI::pConfig()->get($a->profile['profile_uid'], 'system', 'mobile_theme');
|
||||
$a->profile['network'] = Protocol::DFRN;
|
||||
|
||||
DI::page()['title'] = $a->profile['name'] . ' @ ' . Config::get('config', 'sitename');
|
||||
DI::page()['title'] = $a->profile['name'] . ' @ ' . DI::config()->get('config', 'sitename');
|
||||
|
||||
if (!$profiledata && !DI::pConfig()->get(local_user(), 'system', 'always_my_theme')) {
|
||||
$a->setCurrentTheme($a->profile['theme']);
|
||||
|
|
@ -211,7 +210,7 @@ class Profile
|
|||
);
|
||||
}
|
||||
|
||||
$block = ((Config::get('system', 'block_public') && !Session::isAuthenticated()) ? true : false);
|
||||
$block = ((DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) ? true : false);
|
||||
|
||||
/**
|
||||
* @todo
|
||||
|
|
@ -1231,7 +1230,7 @@ class Profile
|
|||
*/
|
||||
public static function searchProfiles($start = 0, $count = 100, $search = null)
|
||||
{
|
||||
$publish = (Config::get('system', 'publish_all') ? '' : " AND `publish` = 1 ");
|
||||
$publish = (DI::config()->get('system', 'publish_all') ? '' : " AND `publish` = 1 ");
|
||||
$total = 0;
|
||||
|
||||
if (!empty($search)) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
namespace Friendica\Model\Storage;
|
||||
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Util\Strings;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
|
@ -28,7 +28,7 @@ class Filesystem extends AbstractStorage
|
|||
// Default base folder
|
||||
const DEFAULT_BASE_FOLDER = 'storage';
|
||||
|
||||
/** @var IConfiguration */
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
/** @var string */
|
||||
|
|
@ -37,11 +37,11 @@ class Filesystem extends AbstractStorage
|
|||
/**
|
||||
* Filesystem constructor.
|
||||
*
|
||||
* @param IConfiguration $config
|
||||
* @param IConfig $config
|
||||
* @param LoggerInterface $logger
|
||||
* @param L10n $l10n
|
||||
*/
|
||||
public function __construct(IConfiguration $config, LoggerInterface $logger, L10n $l10n)
|
||||
public function __construct(IConfig $config, LoggerInterface $logger, L10n $l10n)
|
||||
{
|
||||
parent::__construct($l10n, $logger);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ namespace Friendica\Model;
|
|||
|
||||
use DivineOmega\PasswordExposed;
|
||||
use Exception;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
|
|
@ -501,7 +500,7 @@ class User
|
|||
throw new Exception(DI::l10n()->t('Empty passwords are not allowed.'));
|
||||
}
|
||||
|
||||
if (!Config::get('system', 'disable_password_exposed', false) && self::isPasswordExposed($password)) {
|
||||
if (!DI::config()->get('system', 'disable_password_exposed', false) && self::isPasswordExposed($password)) {
|
||||
throw new Exception(DI::l10n()->t('The new password has been exposed in a public data dump, please choose another.'));
|
||||
}
|
||||
|
||||
|
|
@ -547,7 +546,7 @@ class User
|
|||
*/
|
||||
public static function isNicknameBlocked($nickname)
|
||||
{
|
||||
$forbidden_nicknames = Config::get('system', 'forbidden_nicknames', '');
|
||||
$forbidden_nicknames = DI::config()->get('system', 'forbidden_nicknames', '');
|
||||
|
||||
// if the config variable is empty return false
|
||||
if (empty($forbidden_nicknames)) {
|
||||
|
|
@ -588,7 +587,7 @@ class User
|
|||
{
|
||||
$return = ['user' => null, 'password' => ''];
|
||||
|
||||
$using_invites = Config::get('system', 'invitation_only');
|
||||
$using_invites = DI::config()->get('system', 'invitation_only');
|
||||
|
||||
$invite_id = !empty($data['invite_id']) ? Strings::escapeTags(trim($data['invite_id'])) : '';
|
||||
$username = !empty($data['username']) ? Strings::escapeTags(trim($data['username'])) : '';
|
||||
|
|
@ -604,7 +603,7 @@ class User
|
|||
$language = !empty($data['language']) ? Strings::escapeTags(trim($data['language'])) : 'en';
|
||||
|
||||
$publish = !empty($data['profile_publish_reg']);
|
||||
$netpublish = $publish && Config::get('system', 'directory');
|
||||
$netpublish = $publish && DI::config()->get('system', 'directory');
|
||||
|
||||
if ($password1 != $confirm) {
|
||||
throw new Exception(DI::l10n()->t('Passwords do not match. Password unchanged.'));
|
||||
|
|
@ -655,8 +654,8 @@ class User
|
|||
// collapse multiple spaces in name
|
||||
$username = preg_replace('/ +/', ' ', $username);
|
||||
|
||||
$username_min_length = max(1, min(64, intval(Config::get('system', 'username_min_length', 3))));
|
||||
$username_max_length = max(1, min(64, intval(Config::get('system', 'username_max_length', 48))));
|
||||
$username_min_length = max(1, min(64, intval(DI::config()->get('system', 'username_min_length', 3))));
|
||||
$username_max_length = max(1, min(64, intval(DI::config()->get('system', 'username_max_length', 48))));
|
||||
|
||||
if ($username_min_length > $username_max_length) {
|
||||
Logger::log(DI::l10n()->t('system.username_min_length (%s) and system.username_max_length (%s) are excluding each other, swapping values.', $username_min_length, $username_max_length), Logger::WARNING);
|
||||
|
|
@ -674,7 +673,7 @@ class User
|
|||
}
|
||||
|
||||
// So now we are just looking for a space in the full name.
|
||||
$loose_reg = Config::get('system', 'no_regfullname');
|
||||
$loose_reg = DI::config()->get('system', 'no_regfullname');
|
||||
if (!$loose_reg) {
|
||||
$username = mb_convert_case($username, MB_CASE_TITLE, 'UTF-8');
|
||||
if (strpos($username, ' ') === false) {
|
||||
|
|
@ -693,14 +692,14 @@ class User
|
|||
throw new Exception(DI::l10n()->t('The nickname was blocked from registration by the nodes admin.'));
|
||||
}
|
||||
|
||||
if (Config::get('system', 'block_extended_register', false) && DBA::exists('user', ['email' => $email])) {
|
||||
if (DI::config()->get('system', 'block_extended_register', false) && DBA::exists('user', ['email' => $email])) {
|
||||
throw new Exception(DI::l10n()->t('Cannot use that email.'));
|
||||
}
|
||||
|
||||
// Disallow somebody creating an account using openid that uses the admin email address,
|
||||
// since openid bypasses email verification. We'll allow it if there is not yet an admin account.
|
||||
if (Config::get('config', 'admin_email') && strlen($openid_url)) {
|
||||
$adminlist = explode(',', str_replace(' ', '', strtolower(Config::get('config', 'admin_email'))));
|
||||
if (DI::config()->get('config', 'admin_email') && strlen($openid_url)) {
|
||||
$adminlist = explode(',', str_replace(' ', '', strtolower(DI::config()->get('config', 'admin_email'))));
|
||||
if (in_array(strtolower($email), $adminlist)) {
|
||||
throw new Exception(DI::l10n()->t('Cannot use that email.'));
|
||||
}
|
||||
|
|
@ -810,7 +809,7 @@ class User
|
|||
}
|
||||
|
||||
$fields = ['def_gid' => $def_gid];
|
||||
if (Config::get('system', 'newuser_private') && $def_gid) {
|
||||
if (DI::config()->get('system', 'newuser_private') && $def_gid) {
|
||||
$fields['allow_gid'] = '<' . $def_gid . '>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace Friendica\Model\User;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
|
||||
/**
|
||||
* Interacting with the Friendica Cookie of a user
|
||||
|
|
@ -32,7 +32,7 @@ class Cookie
|
|||
/** @var array The $_COOKIE array */
|
||||
private $cookie;
|
||||
|
||||
public function __construct(IConfiguration $config, App\BaseURL $baseURL, array $server = [], array $cookie = [])
|
||||
public function __construct(IConfig $config, App\BaseURL $baseURL, array $server = [], array $cookie = [])
|
||||
{
|
||||
if (!empty($server['REMOTE_ADDR'])) {
|
||||
$this->remoteAddr = $server['REMOTE_ADDR'];
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Friendica\Module\Admin\Blocklist;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseAdminModule;
|
||||
|
|
@ -22,12 +21,12 @@ class Server extends BaseAdminModule
|
|||
|
||||
if (!empty($_POST['page_blocklist_save'])) {
|
||||
// Add new item to blocklist
|
||||
$blocklist = Config::get('system', 'blocklist');
|
||||
$blocklist = DI::config()->get('system', 'blocklist');
|
||||
$blocklist[] = [
|
||||
'domain' => Strings::escapeTags(trim($_POST['newentry_domain'])),
|
||||
'reason' => Strings::escapeTags(trim($_POST['newentry_reason']))
|
||||
];
|
||||
Config::set('system', 'blocklist', $blocklist);
|
||||
DI::config()->set('system', 'blocklist', $blocklist);
|
||||
info(DI::l10n()->t('Server domain pattern added to blocklist.') . EOL);
|
||||
} else {
|
||||
// Edit the entries from blocklist
|
||||
|
|
@ -43,7 +42,7 @@ class Server extends BaseAdminModule
|
|||
];
|
||||
}
|
||||
}
|
||||
Config::set('system', 'blocklist', $blocklist);
|
||||
DI::config()->set('system', 'blocklist', $blocklist);
|
||||
info(DI::l10n()->t('Site blocklist updated.') . EOL);
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +53,7 @@ class Server extends BaseAdminModule
|
|||
{
|
||||
parent::content($parameters);
|
||||
|
||||
$blocklist = Config::get('system', 'blocklist');
|
||||
$blocklist = DI::config()->get('system', 'blocklist');
|
||||
$blocklistform = [];
|
||||
if (is_array($blocklist)) {
|
||||
foreach ($blocklist as $id => $b) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Friendica\Module\Admin;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Update;
|
||||
use Friendica\Database\DBA;
|
||||
|
|
@ -24,10 +23,10 @@ class DBSync extends BaseAdminModule
|
|||
// @TODO: Replace with parameter from router
|
||||
$update = intval($a->argv[3]);
|
||||
if ($update) {
|
||||
Config::set('database', 'update_' . $update, 'success');
|
||||
$curr = Config::get('system', 'build');
|
||||
DI::config()->set('database', 'update_' . $update, 'success');
|
||||
$curr = DI::config()->get('system', 'build');
|
||||
if (intval($curr) == $update) {
|
||||
Config::set('system', 'build', intval($curr) + 1);
|
||||
DI::config()->set('system', 'build', intval($curr) + 1);
|
||||
}
|
||||
info(DI::l10n()->t('Update has been marked successful') . EOL);
|
||||
}
|
||||
|
|
@ -40,8 +39,8 @@ class DBSync extends BaseAdminModule
|
|||
$retval = DBStructure::update($a->getBasePath(), false, true);
|
||||
if ($retval === '') {
|
||||
$o .= DI::l10n()->t("Database structure update %s was successfully applied.", DB_UPDATE_VERSION) . "<br />";
|
||||
Config::set('database', 'last_successful_update', DB_UPDATE_VERSION);
|
||||
Config::set('database', 'last_successful_update_time', time());
|
||||
DI::config()->set('database', 'last_successful_update', DB_UPDATE_VERSION);
|
||||
DI::config()->set('database', 'last_successful_update_time', time());
|
||||
} else {
|
||||
$o .= DI::l10n()->t("Executing of database structure update %s failed with error: %s", DB_UPDATE_VERSION, $retval) . "<br />";
|
||||
}
|
||||
|
|
@ -63,13 +62,13 @@ class DBSync extends BaseAdminModule
|
|||
$o .= DI::l10n()->t("Executing %s failed with error: %s", $func, $retval);
|
||||
} elseif ($retval === Update::SUCCESS) {
|
||||
$o .= DI::l10n()->t('Update %s was successfully applied.', $func);
|
||||
Config::set('database', $func, 'success');
|
||||
DI::config()->set('database', $func, 'success');
|
||||
} else {
|
||||
$o .= DI::l10n()->t('Update %s did not return a status. Unknown if it succeeded.', $func);
|
||||
}
|
||||
} else {
|
||||
$o .= DI::l10n()->t('There was no additional update function %s that needed to be called.', $func) . "<br />";
|
||||
Config::set('database', $func, 'success');
|
||||
DI::config()->set('database', $func, 'success');
|
||||
}
|
||||
|
||||
return $o;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace Friendica\Module\Admin;
|
||||
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseAdminModule;
|
||||
|
|
@ -29,12 +28,12 @@ class Features extends BaseAdminModule
|
|||
} else {
|
||||
$val = 0;
|
||||
}
|
||||
Config::set('feature', $feature, $val);
|
||||
DI::config()->set('feature', $feature, $val);
|
||||
|
||||
if (!empty($_POST[$featurelock])) {
|
||||
Config::set('feature_lock', $feature, $val);
|
||||
DI::config()->set('feature_lock', $feature, $val);
|
||||
} else {
|
||||
Config::delete('feature_lock', $feature);
|
||||
DI::config()->delete('feature_lock', $feature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -53,7 +52,7 @@ class Features extends BaseAdminModule
|
|||
$arr[$fname] = [];
|
||||
$arr[$fname][0] = $fdata[0];
|
||||
foreach (array_slice($fdata, 1) as $f) {
|
||||
$set = Config::get('feature', $f[0], $f[3]);
|
||||
$set = DI::config()->get('feature', $f[0], $f[3]);
|
||||
$arr[$fname][1][] = [
|
||||
['feature_' . $f[0], $f[1], $set, $f[2], [DI::l10n()->t('Off'), DI::l10n()->t('On')]],
|
||||
['featurelock_' . $f[0], DI::l10n()->t('Lock feature %s', $f[1]), (($f[4] !== false) ? "1" : ''), '', [DI::l10n()->t('Off'), DI::l10n()->t('On')]]
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Friendica\Module\Admin;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
|
@ -123,7 +122,7 @@ class Federation extends BaseAdminModule
|
|||
'$page' => DI::l10n()->t('Federation Statistics'),
|
||||
'$intro' => $intro,
|
||||
'$hint' => $hint,
|
||||
'$autoactive' => Config::get('system', 'poco_completion'),
|
||||
'$autoactive' => DI::config()->get('system', 'poco_completion'),
|
||||
'$counts' => $counts,
|
||||
'$version' => FRIENDICA_VERSION,
|
||||
'$legendtext' => DI::l10n()->t('Currently this node is aware of %d nodes with %d registered users from the following platforms:', $total, $users),
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Friendica\Module\Admin\Logs;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseAdminModule;
|
||||
|
|
@ -28,9 +27,9 @@ class Settings extends BaseAdminModule
|
|||
return;
|
||||
}
|
||||
|
||||
Config::set('system', 'logfile', $logfile);
|
||||
Config::set('system', 'debugging', $debugging);
|
||||
Config::set('system', 'loglevel', $loglevel);
|
||||
DI::config()->set('system', 'logfile', $logfile);
|
||||
DI::config()->set('system', 'debugging', $debugging);
|
||||
DI::config()->set('system', 'loglevel', $loglevel);
|
||||
}
|
||||
|
||||
info(DI::l10n()->t("Log settings updated."));
|
||||
|
|
@ -63,11 +62,11 @@ class Settings extends BaseAdminModule
|
|||
'$submit' => DI::l10n()->t('Save Settings'),
|
||||
'$clear' => DI::l10n()->t('Clear'),
|
||||
'$baseurl' => DI::baseUrl()->get(true),
|
||||
'$logname' => Config::get('system', 'logfile'),
|
||||
'$logname' => DI::config()->get('system', 'logfile'),
|
||||
// see /help/smarty3-templates#1_1 on any Friendica node
|
||||
'$debugging' => ['debugging', DI::l10n()->t("Enable Debugging"), Config::get('system', 'debugging'), ""],
|
||||
'$logfile' => ['logfile', DI::l10n()->t("Log file"), Config::get('system', 'logfile'), DI::l10n()->t("Must be writable by web server. Relative to your Friendica top-level directory.")],
|
||||
'$loglevel' => ['loglevel', DI::l10n()->t("Log level"), Config::get('system', 'loglevel'), "", $log_choices],
|
||||
'$debugging' => ['debugging', DI::l10n()->t("Enable Debugging"), DI::config()->get('system', 'debugging'), ""],
|
||||
'$logfile' => ['logfile', DI::l10n()->t("Log file"), DI::config()->get('system', 'logfile'), DI::l10n()->t("Must be writable by web server. Relative to your Friendica top-level directory.")],
|
||||
'$loglevel' => ['loglevel', DI::l10n()->t("Log level"), DI::config()->get('system', 'loglevel'), "", $log_choices],
|
||||
'$form_security_token' => parent::getFormSecurityToken("admin_logs"),
|
||||
'$phpheader' => DI::l10n()->t("PHP logging"),
|
||||
'$phphint' => DI::l10n()->t("To temporarily enable logging of PHP errors and warnings you can prepend the following to the index.php file of your installation. The filename set in the 'error_log' line is relative to the friendica top-level directory and must be writeable by the web server. The option '1' for 'log_errors' and 'display_errors' is to enable these options, set to '0' to disable them."),
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Friendica\Module\Admin\Logs;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseAdminModule;
|
||||
|
|
@ -15,7 +14,7 @@ class View extends BaseAdminModule
|
|||
parent::content($parameters);
|
||||
|
||||
$t = Renderer::getMarkupTemplate('admin/logs/view.tpl');
|
||||
$f = Config::get('system', 'logfile');
|
||||
$f = DI::config()->get('system', 'logfile');
|
||||
$data = '';
|
||||
|
||||
if (!file_exists($f)) {
|
||||
|
|
@ -46,7 +45,7 @@ class View extends BaseAdminModule
|
|||
'$title' => DI::l10n()->t('Administration'),
|
||||
'$page' => DI::l10n()->t('View Logs'),
|
||||
'$data' => $data,
|
||||
'$logname' => Config::get('system', 'logfile')
|
||||
'$logname' => DI::config()->get('system', 'logfile')
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace Friendica\Module\Admin;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Search;
|
||||
use Friendica\Core\Theme;
|
||||
|
|
@ -93,7 +92,7 @@ class Site extends BaseAdminModule
|
|||
update_table($a, "gcontact", ['connect', 'addr'], $old_host, $new_host);
|
||||
|
||||
// update config
|
||||
Config::set('system', 'url', $new_url);
|
||||
DI::config()->set('system', 'url', $new_url);
|
||||
DI::baseUrl()->saveByURL($new_url);
|
||||
|
||||
// send relocate
|
||||
|
|
@ -231,15 +230,15 @@ class Site extends BaseAdminModule
|
|||
}
|
||||
|
||||
// Has the directory url changed? If yes, then resubmit the existing profiles there
|
||||
if ($global_directory != Config::get('system', 'directory') && ($global_directory != '')) {
|
||||
Config::set('system', 'directory', $global_directory);
|
||||
if ($global_directory != DI::config()->get('system', 'directory') && ($global_directory != '')) {
|
||||
DI::config()->set('system', 'directory', $global_directory);
|
||||
Worker::add(PRIORITY_LOW, 'Directory');
|
||||
}
|
||||
|
||||
if (DI::baseUrl()->getUrlPath() != "") {
|
||||
$diaspora_enabled = false;
|
||||
}
|
||||
if ($ssl_policy != intval(Config::get('system', 'ssl_policy'))) {
|
||||
if ($ssl_policy != intval(DI::config()->get('system', 'ssl_policy'))) {
|
||||
if ($ssl_policy == App\BaseURL::SSL_POLICY_FULL) {
|
||||
DBA::e("UPDATE `contact` SET
|
||||
`url` = REPLACE(`url` , 'http:' , 'https:'),
|
||||
|
|
@ -278,129 +277,129 @@ class Site extends BaseAdminModule
|
|||
);
|
||||
}
|
||||
}
|
||||
Config::set('system', 'ssl_policy' , $ssl_policy);
|
||||
Config::set('system', 'maxloadavg' , $maxloadavg);
|
||||
Config::set('system', 'maxloadavg_frontend' , $maxloadavg_frontend);
|
||||
Config::set('system', 'min_memory' , $min_memory);
|
||||
Config::set('system', 'optimize_max_tablesize', $optimize_max_tablesize);
|
||||
Config::set('system', 'optimize_fragmentation', $optimize_fragmentation);
|
||||
Config::set('system', 'poco_completion' , $poco_completion);
|
||||
Config::set('system', 'poco_requery_days' , $poco_requery_days);
|
||||
Config::set('system', 'poco_discovery' , $poco_discovery);
|
||||
Config::set('system', 'poco_discovery_since' , $poco_discovery_since);
|
||||
Config::set('system', 'poco_local_search' , $poco_local_search);
|
||||
Config::set('system', 'nodeinfo' , $nodeinfo);
|
||||
Config::set('config', 'sitename' , $sitename);
|
||||
Config::set('config', 'sender_email' , $sender_email);
|
||||
Config::set('system', 'suppress_tags' , $suppress_tags);
|
||||
Config::set('system', 'shortcut_icon' , $shortcut_icon);
|
||||
Config::set('system', 'touch_icon' , $touch_icon);
|
||||
DI::config()->set('system', 'ssl_policy' , $ssl_policy);
|
||||
DI::config()->set('system', 'maxloadavg' , $maxloadavg);
|
||||
DI::config()->set('system', 'maxloadavg_frontend' , $maxloadavg_frontend);
|
||||
DI::config()->set('system', 'min_memory' , $min_memory);
|
||||
DI::config()->set('system', 'optimize_max_tablesize', $optimize_max_tablesize);
|
||||
DI::config()->set('system', 'optimize_fragmentation', $optimize_fragmentation);
|
||||
DI::config()->set('system', 'poco_completion' , $poco_completion);
|
||||
DI::config()->set('system', 'poco_requery_days' , $poco_requery_days);
|
||||
DI::config()->set('system', 'poco_discovery' , $poco_discovery);
|
||||
DI::config()->set('system', 'poco_discovery_since' , $poco_discovery_since);
|
||||
DI::config()->set('system', 'poco_local_search' , $poco_local_search);
|
||||
DI::config()->set('system', 'nodeinfo' , $nodeinfo);
|
||||
DI::config()->set('config', 'sitename' , $sitename);
|
||||
DI::config()->set('config', 'sender_email' , $sender_email);
|
||||
DI::config()->set('system', 'suppress_tags' , $suppress_tags);
|
||||
DI::config()->set('system', 'shortcut_icon' , $shortcut_icon);
|
||||
DI::config()->set('system', 'touch_icon' , $touch_icon);
|
||||
|
||||
if ($banner == "") {
|
||||
Config::delete('system', 'banner');
|
||||
DI::config()->delete('system', 'banner');
|
||||
} else {
|
||||
Config::set('system', 'banner', $banner);
|
||||
DI::config()->set('system', 'banner', $banner);
|
||||
}
|
||||
|
||||
if (empty($additional_info)) {
|
||||
Config::delete('config', 'info');
|
||||
DI::config()->delete('config', 'info');
|
||||
} else {
|
||||
Config::set('config', 'info', $additional_info);
|
||||
DI::config()->set('config', 'info', $additional_info);
|
||||
}
|
||||
Config::set('system', 'language', $language);
|
||||
Config::set('system', 'theme', $theme);
|
||||
DI::config()->set('system', 'language', $language);
|
||||
DI::config()->set('system', 'theme', $theme);
|
||||
Theme::install($theme);
|
||||
|
||||
if ($theme_mobile == '---') {
|
||||
Config::delete('system', 'mobile-theme');
|
||||
DI::config()->delete('system', 'mobile-theme');
|
||||
} else {
|
||||
Config::set('system', 'mobile-theme', $theme_mobile);
|
||||
DI::config()->set('system', 'mobile-theme', $theme_mobile);
|
||||
}
|
||||
if ($singleuser == '---') {
|
||||
Config::delete('system', 'singleuser');
|
||||
DI::config()->delete('system', 'singleuser');
|
||||
} else {
|
||||
Config::set('system', 'singleuser', $singleuser);
|
||||
DI::config()->set('system', 'singleuser', $singleuser);
|
||||
}
|
||||
Config::set('system', 'maximagesize' , $maximagesize);
|
||||
Config::set('system', 'max_image_length' , $maximagelength);
|
||||
Config::set('system', 'jpeg_quality' , $jpegimagequality);
|
||||
DI::config()->set('system', 'maximagesize' , $maximagesize);
|
||||
DI::config()->set('system', 'max_image_length' , $maximagelength);
|
||||
DI::config()->set('system', 'jpeg_quality' , $jpegimagequality);
|
||||
|
||||
Config::set('config', 'register_policy' , $register_policy);
|
||||
Config::set('system', 'max_daily_registrations', $daily_registrations);
|
||||
Config::set('system', 'account_abandon_days' , $abandon_days);
|
||||
Config::set('config', 'register_text' , $register_text);
|
||||
Config::set('system', 'allowed_sites' , $allowed_sites);
|
||||
Config::set('system', 'allowed_email' , $allowed_email);
|
||||
Config::set('system', 'forbidden_nicknames' , $forbidden_nicknames);
|
||||
Config::set('system', 'no_oembed_rich_content' , $no_oembed_rich_content);
|
||||
Config::set('system', 'allowed_oembed' , $allowed_oembed);
|
||||
Config::set('system', 'block_public' , $block_public);
|
||||
Config::set('system', 'publish_all' , $force_publish);
|
||||
Config::set('system', 'newuser_private' , $newuser_private);
|
||||
Config::set('system', 'enotify_no_content' , $enotify_no_content);
|
||||
Config::set('system', 'disable_embedded' , $disable_embedded);
|
||||
Config::set('system', 'allow_users_remote_self', $allow_users_remote_self);
|
||||
Config::set('system', 'explicit_content' , $explicit_content);
|
||||
Config::set('system', 'check_new_version_url' , $check_new_version_url);
|
||||
DI::config()->set('config', 'register_policy' , $register_policy);
|
||||
DI::config()->set('system', 'max_daily_registrations', $daily_registrations);
|
||||
DI::config()->set('system', 'account_abandon_days' , $abandon_days);
|
||||
DI::config()->set('config', 'register_text' , $register_text);
|
||||
DI::config()->set('system', 'allowed_sites' , $allowed_sites);
|
||||
DI::config()->set('system', 'allowed_email' , $allowed_email);
|
||||
DI::config()->set('system', 'forbidden_nicknames' , $forbidden_nicknames);
|
||||
DI::config()->set('system', 'no_oembed_rich_content' , $no_oembed_rich_content);
|
||||
DI::config()->set('system', 'allowed_oembed' , $allowed_oembed);
|
||||
DI::config()->set('system', 'block_public' , $block_public);
|
||||
DI::config()->set('system', 'publish_all' , $force_publish);
|
||||
DI::config()->set('system', 'newuser_private' , $newuser_private);
|
||||
DI::config()->set('system', 'enotify_no_content' , $enotify_no_content);
|
||||
DI::config()->set('system', 'disable_embedded' , $disable_embedded);
|
||||
DI::config()->set('system', 'allow_users_remote_self', $allow_users_remote_self);
|
||||
DI::config()->set('system', 'explicit_content' , $explicit_content);
|
||||
DI::config()->set('system', 'check_new_version_url' , $check_new_version_url);
|
||||
|
||||
Config::set('system', 'block_extended_register', $no_multi_reg);
|
||||
Config::set('system', 'no_openid' , $no_openid);
|
||||
Config::set('system', 'no_regfullname' , $no_regfullname);
|
||||
Config::set('system', 'community_page_style' , $community_page_style);
|
||||
Config::set('system', 'max_author_posts_community_page', $max_author_posts_community_page);
|
||||
Config::set('system', 'verifyssl' , $verifyssl);
|
||||
Config::set('system', 'proxyuser' , $proxyuser);
|
||||
Config::set('system', 'proxy' , $proxy);
|
||||
Config::set('system', 'curl_timeout' , $timeout);
|
||||
Config::set('system', 'dfrn_only' , $dfrn_only);
|
||||
Config::set('system', 'ostatus_disabled' , $ostatus_disabled);
|
||||
Config::set('system', 'diaspora_enabled' , $diaspora_enabled);
|
||||
DI::config()->set('system', 'block_extended_register', $no_multi_reg);
|
||||
DI::config()->set('system', 'no_openid' , $no_openid);
|
||||
DI::config()->set('system', 'no_regfullname' , $no_regfullname);
|
||||
DI::config()->set('system', 'community_page_style' , $community_page_style);
|
||||
DI::config()->set('system', 'max_author_posts_community_page', $max_author_posts_community_page);
|
||||
DI::config()->set('system', 'verifyssl' , $verifyssl);
|
||||
DI::config()->set('system', 'proxyuser' , $proxyuser);
|
||||
DI::config()->set('system', 'proxy' , $proxy);
|
||||
DI::config()->set('system', 'curl_timeout' , $timeout);
|
||||
DI::config()->set('system', 'dfrn_only' , $dfrn_only);
|
||||
DI::config()->set('system', 'ostatus_disabled' , $ostatus_disabled);
|
||||
DI::config()->set('system', 'diaspora_enabled' , $diaspora_enabled);
|
||||
|
||||
Config::set('config', 'private_addons' , $private_addons);
|
||||
DI::config()->set('config', 'private_addons' , $private_addons);
|
||||
|
||||
Config::set('system', 'force_ssl' , $force_ssl);
|
||||
Config::set('system', 'hide_help' , $hide_help);
|
||||
DI::config()->set('system', 'force_ssl' , $force_ssl);
|
||||
DI::config()->set('system', 'hide_help' , $hide_help);
|
||||
|
||||
Config::set('system', 'dbclean' , $dbclean);
|
||||
Config::set('system', 'dbclean-expire-days' , $dbclean_expire_days);
|
||||
Config::set('system', 'dbclean_expire_conversation', $dbclean_expire_conv);
|
||||
DI::config()->set('system', 'dbclean' , $dbclean);
|
||||
DI::config()->set('system', 'dbclean-expire-days' , $dbclean_expire_days);
|
||||
DI::config()->set('system', 'dbclean_expire_conversation', $dbclean_expire_conv);
|
||||
|
||||
if ($dbclean_unclaimed == 0) {
|
||||
$dbclean_unclaimed = $dbclean_expire_days;
|
||||
}
|
||||
|
||||
Config::set('system', 'dbclean-expire-unclaimed', $dbclean_unclaimed);
|
||||
DI::config()->set('system', 'dbclean-expire-unclaimed', $dbclean_unclaimed);
|
||||
|
||||
if ($itemcache != '') {
|
||||
$itemcache = BasePath::getRealPath($itemcache);
|
||||
}
|
||||
|
||||
Config::set('system', 'itemcache', $itemcache);
|
||||
Config::set('system', 'itemcache_duration', $itemcache_duration);
|
||||
Config::set('system', 'max_comments', $max_comments);
|
||||
DI::config()->set('system', 'itemcache', $itemcache);
|
||||
DI::config()->set('system', 'itemcache_duration', $itemcache_duration);
|
||||
DI::config()->set('system', 'max_comments', $max_comments);
|
||||
|
||||
if ($temppath != '') {
|
||||
$temppath = BasePath::getRealPath($temppath);
|
||||
}
|
||||
|
||||
Config::set('system', 'temppath', $temppath);
|
||||
DI::config()->set('system', 'temppath', $temppath);
|
||||
|
||||
Config::set('system', 'proxy_disabled' , $proxy_disabled);
|
||||
Config::set('system', 'only_tag_search' , $only_tag_search);
|
||||
DI::config()->set('system', 'proxy_disabled' , $proxy_disabled);
|
||||
DI::config()->set('system', 'only_tag_search' , $only_tag_search);
|
||||
|
||||
Config::set('system', 'worker_queues' , $worker_queues);
|
||||
Config::set('system', 'worker_dont_fork' , $worker_dont_fork);
|
||||
Config::set('system', 'worker_fastlane' , $worker_fastlane);
|
||||
Config::set('system', 'frontend_worker' , $worker_frontend);
|
||||
DI::config()->set('system', 'worker_queues' , $worker_queues);
|
||||
DI::config()->set('system', 'worker_dont_fork' , $worker_dont_fork);
|
||||
DI::config()->set('system', 'worker_fastlane' , $worker_fastlane);
|
||||
DI::config()->set('system', 'frontend_worker' , $worker_frontend);
|
||||
|
||||
Config::set('system', 'relay_directly' , $relay_directly);
|
||||
Config::set('system', 'relay_server' , $relay_server);
|
||||
Config::set('system', 'relay_subscribe' , $relay_subscribe);
|
||||
Config::set('system', 'relay_scope' , $relay_scope);
|
||||
Config::set('system', 'relay_server_tags', $relay_server_tags);
|
||||
Config::set('system', 'relay_user_tags' , $relay_user_tags);
|
||||
DI::config()->set('system', 'relay_directly' , $relay_directly);
|
||||
DI::config()->set('system', 'relay_server' , $relay_server);
|
||||
DI::config()->set('system', 'relay_subscribe' , $relay_subscribe);
|
||||
DI::config()->set('system', 'relay_scope' , $relay_scope);
|
||||
DI::config()->set('system', 'relay_server_tags', $relay_server_tags);
|
||||
DI::config()->set('system', 'relay_user_tags' , $relay_user_tags);
|
||||
|
||||
Config::set('system', 'rino_encrypt' , $rino);
|
||||
DI::config()->set('system', 'rino_encrypt' , $rino);
|
||||
|
||||
info(DI::l10n()->t('Site settings updated.') . EOL);
|
||||
|
||||
|
|
@ -414,10 +413,10 @@ class Site extends BaseAdminModule
|
|||
/* Installed langs */
|
||||
$lang_choices = DI::l10n()->getAvailableLanguages();
|
||||
|
||||
if (strlen(Config::get('system', 'directory_submit_url')) &&
|
||||
!strlen(Config::get('system', 'directory'))) {
|
||||
Config::set('system', 'directory', dirname(Config::get('system', 'directory_submit_url')));
|
||||
Config::delete('system', 'directory_submit_url');
|
||||
if (strlen(DI::config()->get('system', 'directory_submit_url')) &&
|
||||
!strlen(DI::config()->get('system', 'directory'))) {
|
||||
DI::config()->set('system', 'directory', dirname(DI::config()->get('system', 'directory_submit_url')));
|
||||
DI::config()->delete('system', 'directory_submit_url');
|
||||
}
|
||||
|
||||
/* Installed themes */
|
||||
|
|
@ -426,7 +425,7 @@ class Site extends BaseAdminModule
|
|||
$theme_choices_mobile['---'] = DI::l10n()->t('No special theme for mobile devices');
|
||||
$files = glob('view/theme/*');
|
||||
if (is_array($files)) {
|
||||
$allowed_theme_list = Config::get('system', 'allowed_themes');
|
||||
$allowed_theme_list = DI::config()->get('system', 'allowed_themes');
|
||||
|
||||
foreach ($files as $file) {
|
||||
if (intval(file_exists($file . '/unsupported'))) {
|
||||
|
|
@ -484,13 +483,13 @@ class Site extends BaseAdminModule
|
|||
}
|
||||
|
||||
/* Banner */
|
||||
$banner = Config::get('system', 'banner');
|
||||
$banner = DI::config()->get('system', 'banner');
|
||||
|
||||
if ($banner == false) {
|
||||
$banner = '<a href="https://friendi.ca"><img id="logo-img" src="images/friendica-32.png" alt="logo" /></a><span id="logo-text"><a href="https://friendi.ca">Friendica</a></span>';
|
||||
}
|
||||
|
||||
$additional_info = Config::get('config', 'info');
|
||||
$additional_info = DI::config()->get('config', 'info');
|
||||
|
||||
// Automatically create temporary paths
|
||||
get_temppath();
|
||||
|
|
@ -517,7 +516,7 @@ class Site extends BaseAdminModule
|
|||
|
||||
$diaspora_able = (DI::baseUrl()->getUrlPath() == '');
|
||||
|
||||
$optimize_max_tablesize = Config::get('system', 'optimize_max_tablesize', -1);
|
||||
$optimize_max_tablesize = DI::config()->get('system', 'optimize_max_tablesize', -1);
|
||||
|
||||
if ($optimize_max_tablesize <= 0) {
|
||||
$optimize_max_tablesize = -1;
|
||||
|
|
@ -569,101 +568,101 @@ class Site extends BaseAdminModule
|
|||
'$baseurl' => DI::baseUrl()->get(true),
|
||||
|
||||
// name, label, value, help string, extra data...
|
||||
'$sitename' => ['sitename', DI::l10n()->t('Site name'), Config::get('config', 'sitename'), ''],
|
||||
'$sender_email' => ['sender_email', DI::l10n()->t('Sender Email'), Config::get('config', 'sender_email'), DI::l10n()->t('The email address your server shall use to send notification emails from.'), '', '', 'email'],
|
||||
'$sitename' => ['sitename', DI::l10n()->t('Site name'), DI::config()->get('config', 'sitename'), ''],
|
||||
'$sender_email' => ['sender_email', DI::l10n()->t('Sender Email'), DI::config()->get('config', 'sender_email'), DI::l10n()->t('The email address your server shall use to send notification emails from.'), '', '', 'email'],
|
||||
'$banner' => ['banner', DI::l10n()->t('Banner/Logo'), $banner, ''],
|
||||
'$shortcut_icon' => ['shortcut_icon', DI::l10n()->t('Shortcut icon'), Config::get('system', 'shortcut_icon'), DI::l10n()->t('Link to an icon that will be used for browsers.')],
|
||||
'$touch_icon' => ['touch_icon', DI::l10n()->t('Touch icon'), Config::get('system', 'touch_icon'), DI::l10n()->t('Link to an icon that will be used for tablets and mobiles.')],
|
||||
'$shortcut_icon' => ['shortcut_icon', DI::l10n()->t('Shortcut icon'), DI::config()->get('system', 'shortcut_icon'), DI::l10n()->t('Link to an icon that will be used for browsers.')],
|
||||
'$touch_icon' => ['touch_icon', DI::l10n()->t('Touch icon'), DI::config()->get('system', 'touch_icon'), DI::l10n()->t('Link to an icon that will be used for tablets and mobiles.')],
|
||||
'$additional_info' => ['additional_info', DI::l10n()->t('Additional Info'), $additional_info, DI::l10n()->t('For public servers: you can add additional information here that will be listed at %s/servers.', Search::getGlobalDirectory())],
|
||||
'$language' => ['language', DI::l10n()->t('System language'), Config::get('system', 'language'), '', $lang_choices],
|
||||
'$theme' => ['theme', DI::l10n()->t('System theme'), Config::get('system', 'theme'), DI::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', DI::l10n()->t('Mobile system theme'), Config::get('system', 'mobile-theme', '---'), DI::l10n()->t('Theme for mobile devices'), $theme_choices_mobile],
|
||||
'$ssl_policy' => ['ssl_policy', DI::l10n()->t('SSL link policy'), (string)intval(Config::get('system', 'ssl_policy')), DI::l10n()->t('Determines whether generated links should be forced to use SSL'), $ssl_choices],
|
||||
'$force_ssl' => ['force_ssl', DI::l10n()->t('Force SSL'), Config::get('system', 'force_ssl'), DI::l10n()->t('Force all Non-SSL requests to SSL - Attention: on some systems it could lead to endless loops.')],
|
||||
'$hide_help' => ['hide_help', DI::l10n()->t('Hide help entry from navigation menu'), Config::get('system', 'hide_help'), DI::l10n()->t('Hides the menu entry for the Help pages from the navigation menu. You can still access it calling /help directly.')],
|
||||
'$singleuser' => ['singleuser', DI::l10n()->t('Single user instance'), Config::get('system', 'singleuser', '---'), DI::l10n()->t('Make this instance multi-user or single-user for the named user'), $user_names],
|
||||
'$language' => ['language', DI::l10n()->t('System language'), DI::config()->get('system', 'language'), '', $lang_choices],
|
||||
'$theme' => ['theme', DI::l10n()->t('System theme'), DI::config()->get('system', 'theme'), DI::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', DI::l10n()->t('Mobile system theme'), DI::config()->get('system', 'mobile-theme', '---'), DI::l10n()->t('Theme for mobile devices'), $theme_choices_mobile],
|
||||
'$ssl_policy' => ['ssl_policy', DI::l10n()->t('SSL link policy'), (string)intval(DI::config()->get('system', 'ssl_policy')), DI::l10n()->t('Determines whether generated links should be forced to use SSL'), $ssl_choices],
|
||||
'$force_ssl' => ['force_ssl', DI::l10n()->t('Force SSL'), DI::config()->get('system', 'force_ssl'), DI::l10n()->t('Force all Non-SSL requests to SSL - Attention: on some systems it could lead to endless loops.')],
|
||||
'$hide_help' => ['hide_help', DI::l10n()->t('Hide help entry from navigation menu'), DI::config()->get('system', 'hide_help'), DI::l10n()->t('Hides the menu entry for the Help pages from the navigation menu. You can still access it calling /help directly.')],
|
||||
'$singleuser' => ['singleuser', DI::l10n()->t('Single user instance'), DI::config()->get('system', 'singleuser', '---'), DI::l10n()->t('Make this instance multi-user or single-user for the named user'), $user_names],
|
||||
|
||||
'$storagebackend' => ['storagebackend', DI::l10n()->t('File storage backend'), $current_storage_backend, DI::l10n()->t('The backend used to store uploaded data. If you change the storage backend, you can manually move the existing files. If you do not do so, the files uploaded before the change will still be available at the old backend. Please see <a href="/help/Settings#1_2_3_1">the settings documentation</a> for more information about the choices and the moving procedure.'), $available_storage_backends],
|
||||
'$storageform' => $storage_form,
|
||||
'$maximagesize' => ['maximagesize', DI::l10n()->t('Maximum image size'), Config::get('system', 'maximagesize'), DI::l10n()->t('Maximum size in bytes of uploaded images. Default is 0, which means no limits.')],
|
||||
'$maximagelength' => ['maximagelength', DI::l10n()->t('Maximum image length'), Config::get('system', 'max_image_length'), DI::l10n()->t('Maximum length in pixels of the longest side of uploaded images. Default is -1, which means no limits.')],
|
||||
'$jpegimagequality' => ['jpegimagequality', DI::l10n()->t('JPEG image quality'), Config::get('system', 'jpeg_quality'), DI::l10n()->t('Uploaded JPEGS will be saved at this quality setting [0-100]. Default is 100, which is full quality.')],
|
||||
'$maximagesize' => ['maximagesize', DI::l10n()->t('Maximum image size'), DI::config()->get('system', 'maximagesize'), DI::l10n()->t('Maximum size in bytes of uploaded images. Default is 0, which means no limits.')],
|
||||
'$maximagelength' => ['maximagelength', DI::l10n()->t('Maximum image length'), DI::config()->get('system', 'max_image_length'), DI::l10n()->t('Maximum length in pixels of the longest side of uploaded images. Default is -1, which means no limits.')],
|
||||
'$jpegimagequality' => ['jpegimagequality', DI::l10n()->t('JPEG image quality'), DI::config()->get('system', 'jpeg_quality'), DI::l10n()->t('Uploaded JPEGS will be saved at this quality setting [0-100]. Default is 100, which is full quality.')],
|
||||
|
||||
'$register_policy' => ['register_policy', DI::l10n()->t('Register policy'), Config::get('config', 'register_policy'), '', $register_choices],
|
||||
'$daily_registrations' => ['max_daily_registrations', DI::l10n()->t('Maximum Daily Registrations'), Config::get('system', 'max_daily_registrations'), DI::l10n()->t('If registration is permitted above, this sets the maximum number of new user registrations to accept per day. If register is set to closed, this setting has no effect.')],
|
||||
'$register_text' => ['register_text', DI::l10n()->t('Register text'), Config::get('config', 'register_text'), DI::l10n()->t('Will be displayed prominently on the registration page. You can use BBCode here.')],
|
||||
'$forbidden_nicknames' => ['forbidden_nicknames', DI::l10n()->t('Forbidden Nicknames'), Config::get('system', 'forbidden_nicknames'), DI::l10n()->t('Comma separated list of nicknames that are forbidden from registration. Preset is a list of role names according RFC 2142.')],
|
||||
'$abandon_days' => ['abandon_days', DI::l10n()->t('Accounts abandoned after x days'), Config::get('system', 'account_abandon_days'), DI::l10n()->t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.')],
|
||||
'$allowed_sites' => ['allowed_sites', DI::l10n()->t('Allowed friend domains'), Config::get('system', 'allowed_sites'), DI::l10n()->t('Comma separated list of domains which are allowed to establish friendships with this site. Wildcards are accepted. Empty to allow any domains')],
|
||||
'$allowed_email' => ['allowed_email', DI::l10n()->t('Allowed email domains'), Config::get('system', 'allowed_email'), DI::l10n()->t('Comma separated list of domains which are allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains')],
|
||||
'$no_oembed_rich_content' => ['no_oembed_rich_content', DI::l10n()->t('No OEmbed rich content'), Config::get('system', 'no_oembed_rich_content'), DI::l10n()->t('Don\'t show the rich content (e.g. embedded PDF), except from the domains listed below.')],
|
||||
'$allowed_oembed' => ['allowed_oembed', DI::l10n()->t('Allowed OEmbed domains'), Config::get('system', 'allowed_oembed'), DI::l10n()->t('Comma separated list of domains which oembed content is allowed to be displayed. Wildcards are accepted.')],
|
||||
'$block_public' => ['block_public', DI::l10n()->t('Block public'), Config::get('system', 'block_public'), DI::l10n()->t('Check to block public access to all otherwise public personal pages on this site unless you are currently logged in.')],
|
||||
'$force_publish' => ['publish_all', DI::l10n()->t('Force publish'), Config::get('system', 'publish_all'), DI::l10n()->t('Check to force all profiles on this site to be listed in the site directory.') . '<strong>' . DI::l10n()->t('Enabling this may violate privacy laws like the GDPR') . '</strong>'],
|
||||
'$global_directory' => ['directory', DI::l10n()->t('Global directory URL'), Config::get('system', 'directory', 'https://dir.friendica.social'), DI::l10n()->t('URL to the global directory. If this is not set, the global directory is completely unavailable to the application.')],
|
||||
'$newuser_private' => ['newuser_private', DI::l10n()->t('Private posts by default for new users'), Config::get('system', 'newuser_private'), DI::l10n()->t('Set default post permissions for all new members to the default privacy group rather than public.')],
|
||||
'$enotify_no_content' => ['enotify_no_content', DI::l10n()->t('Don\'t include post content in email notifications'), Config::get('system', 'enotify_no_content'), DI::l10n()->t('Don\'t include the content of a post/comment/private message/etc. in the email notifications that are sent out from this site, as a privacy measure.')],
|
||||
'$private_addons' => ['private_addons', DI::l10n()->t('Disallow public access to addons listed in the apps menu.'), Config::get('config', 'private_addons'), DI::l10n()->t('Checking this box will restrict addons listed in the apps menu to members only.')],
|
||||
'$disable_embedded' => ['disable_embedded', DI::l10n()->t('Don\'t embed private images in posts'), Config::get('system', 'disable_embedded'), DI::l10n()->t('Don\'t replace locally-hosted private photos in posts with an embedded copy of the image. This means that contacts who receive posts containing private photos will have to authenticate and load each image, which may take a while.')],
|
||||
'$explicit_content' => ['explicit_content', DI::l10n()->t('Explicit Content'), Config::get('system', 'explicit_content', false), DI::l10n()->t('Set this to announce that your node is used mostly for explicit content that might not be suited for minors. This information will be published in the node information and might be used, e.g. by the global directory, to filter your node from listings of nodes to join. Additionally a note about this will be shown at the user registration page.')],
|
||||
'$allow_users_remote_self'=> ['allow_users_remote_self', DI::l10n()->t('Allow Users to set remote_self'), 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.')],
|
||||
'$no_multi_reg' => ['no_multi_reg', DI::l10n()->t('Block multiple registrations'), Config::get('system', 'block_extended_register'), DI::l10n()->t('Disallow users to register additional accounts for use as pages.')],
|
||||
'$no_openid' => ['no_openid', DI::l10n()->t('Disable OpenID'), Config::get('system', 'no_openid'), DI::l10n()->t('Disable OpenID support for registration and logins.')],
|
||||
'$no_regfullname' => ['no_regfullname', DI::l10n()->t('No Fullname check'), Config::get('system', 'no_regfullname'), DI::l10n()->t('Allow users to register without a space between the first name and the last name in their full name.')],
|
||||
'$community_page_style' => ['community_page_style', DI::l10n()->t('Community pages for visitors'), 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'), 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")')],
|
||||
'$ostatus_disabled' => ['ostatus_disabled', DI::l10n()->t('Disable OStatus support'), Config::get('system', 'ostatus_disabled'), DI::l10n()->t('Disable built-in OStatus (StatusNet, GNU Social etc.) compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed.')],
|
||||
'$register_policy' => ['register_policy', DI::l10n()->t('Register policy'), DI::config()->get('config', 'register_policy'), '', $register_choices],
|
||||
'$daily_registrations' => ['max_daily_registrations', DI::l10n()->t('Maximum Daily Registrations'), DI::config()->get('system', 'max_daily_registrations'), DI::l10n()->t('If registration is permitted above, this sets the maximum number of new user registrations to accept per day. If register is set to closed, this setting has no effect.')],
|
||||
'$register_text' => ['register_text', DI::l10n()->t('Register text'), DI::config()->get('config', 'register_text'), DI::l10n()->t('Will be displayed prominently on the registration page. You can use BBCode here.')],
|
||||
'$forbidden_nicknames' => ['forbidden_nicknames', DI::l10n()->t('Forbidden Nicknames'), DI::config()->get('system', 'forbidden_nicknames'), DI::l10n()->t('Comma separated list of nicknames that are forbidden from registration. Preset is a list of role names according RFC 2142.')],
|
||||
'$abandon_days' => ['abandon_days', DI::l10n()->t('Accounts abandoned after x days'), DI::config()->get('system', 'account_abandon_days'), DI::l10n()->t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.')],
|
||||
'$allowed_sites' => ['allowed_sites', DI::l10n()->t('Allowed friend domains'), DI::config()->get('system', 'allowed_sites'), DI::l10n()->t('Comma separated list of domains which are allowed to establish friendships with this site. Wildcards are accepted. Empty to allow any domains')],
|
||||
'$allowed_email' => ['allowed_email', DI::l10n()->t('Allowed email domains'), DI::config()->get('system', 'allowed_email'), DI::l10n()->t('Comma separated list of domains which are allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains')],
|
||||
'$no_oembed_rich_content' => ['no_oembed_rich_content', DI::l10n()->t('No OEmbed rich content'), DI::config()->get('system', 'no_oembed_rich_content'), DI::l10n()->t('Don\'t show the rich content (e.g. embedded PDF), except from the domains listed below.')],
|
||||
'$allowed_oembed' => ['allowed_oembed', DI::l10n()->t('Allowed OEmbed domains'), DI::config()->get('system', 'allowed_oembed'), DI::l10n()->t('Comma separated list of domains which oembed content is allowed to be displayed. Wildcards are accepted.')],
|
||||
'$block_public' => ['block_public', DI::l10n()->t('Block public'), DI::config()->get('system', 'block_public'), DI::l10n()->t('Check to block public access to all otherwise public personal pages on this site unless you are currently logged in.')],
|
||||
'$force_publish' => ['publish_all', DI::l10n()->t('Force publish'), DI::config()->get('system', 'publish_all'), DI::l10n()->t('Check to force all profiles on this site to be listed in the site directory.') . '<strong>' . DI::l10n()->t('Enabling this may violate privacy laws like the GDPR') . '</strong>'],
|
||||
'$global_directory' => ['directory', DI::l10n()->t('Global directory URL'), DI::config()->get('system', 'directory', 'https://dir.friendica.social'), DI::l10n()->t('URL to the global directory. If this is not set, the global directory is completely unavailable to the application.')],
|
||||
'$newuser_private' => ['newuser_private', DI::l10n()->t('Private posts by default for new users'), DI::config()->get('system', 'newuser_private'), DI::l10n()->t('Set default post permissions for all new members to the default privacy group rather than public.')],
|
||||
'$enotify_no_content' => ['enotify_no_content', DI::l10n()->t('Don\'t include post content in email notifications'), DI::config()->get('system', 'enotify_no_content'), DI::l10n()->t('Don\'t include the content of a post/comment/private message/etc. in the email notifications that are sent out from this site, as a privacy measure.')],
|
||||
'$private_addons' => ['private_addons', DI::l10n()->t('Disallow public access to addons listed in the apps menu.'), DI::config()->get('config', 'private_addons'), DI::l10n()->t('Checking this box will restrict addons listed in the apps menu to members only.')],
|
||||
'$disable_embedded' => ['disable_embedded', DI::l10n()->t('Don\'t embed private images in posts'), DI::config()->get('system', 'disable_embedded'), DI::l10n()->t('Don\'t replace locally-hosted private photos in posts with an embedded copy of the image. This means that contacts who receive posts containing private photos will have to authenticate and load each image, which may take a while.')],
|
||||
'$explicit_content' => ['explicit_content', DI::l10n()->t('Explicit Content'), DI::config()->get('system', 'explicit_content', false), DI::l10n()->t('Set this to announce that your node is used mostly for explicit content that might not be suited for minors. This information will be published in the node information and might be used, e.g. by the global directory, to filter your node from listings of nodes to join. Additionally a note about this will be shown at the user registration page.')],
|
||||
'$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.')],
|
||||
'$no_multi_reg' => ['no_multi_reg', DI::l10n()->t('Block multiple registrations'), DI::config()->get('system', 'block_extended_register'), DI::l10n()->t('Disallow users to register additional accounts for use as pages.')],
|
||||
'$no_openid' => ['no_openid', DI::l10n()->t('Disable OpenID'), DI::config()->get('system', 'no_openid'), DI::l10n()->t('Disable OpenID support for registration and logins.')],
|
||||
'$no_regfullname' => ['no_regfullname', DI::l10n()->t('No Fullname check'), DI::config()->get('system', 'no_regfullname'), DI::l10n()->t('Allow users to register without a space between the first name and the last name in their full name.')],
|
||||
'$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")')],
|
||||
'$ostatus_disabled' => ['ostatus_disabled', DI::l10n()->t('Disable OStatus support'), DI::config()->get('system', 'ostatus_disabled'), DI::l10n()->t('Disable built-in OStatus (StatusNet, GNU Social etc.) compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed.')],
|
||||
'$ostatus_not_able' => DI::l10n()->t('OStatus support can only be enabled if threading is enabled.'),
|
||||
'$diaspora_able' => $diaspora_able,
|
||||
'$diaspora_not_able' => DI::l10n()->t('Diaspora support can\'t be enabled because Friendica was installed into a sub directory.'),
|
||||
'$diaspora_enabled' => ['diaspora_enabled', DI::l10n()->t('Enable Diaspora support'), Config::get('system', 'diaspora_enabled', $diaspora_able), DI::l10n()->t('Provide built-in Diaspora network compatibility.')],
|
||||
'$dfrn_only' => ['dfrn_only', DI::l10n()->t('Only allow Friendica contacts'), Config::get('system', 'dfrn_only'), DI::l10n()->t('All contacts must use Friendica protocols. All other built-in communication protocols disabled.')],
|
||||
'$verifyssl' => ['verifyssl', DI::l10n()->t('Verify SSL'), Config::get('system', 'verifyssl'), DI::l10n()->t('If you wish, you can turn on strict certificate checking. This will mean you cannot connect (at all) to self-signed SSL sites.')],
|
||||
'$proxyuser' => ['proxyuser', DI::l10n()->t('Proxy user'), Config::get('system', 'proxyuser'), ''],
|
||||
'$proxy' => ['proxy', DI::l10n()->t('Proxy URL'), Config::get('system', 'proxy'), ''],
|
||||
'$timeout' => ['timeout', DI::l10n()->t('Network timeout'), Config::get('system', 'curl_timeout', 60), DI::l10n()->t('Value is in seconds. Set to 0 for unlimited (not recommended).')],
|
||||
'$maxloadavg' => ['maxloadavg', DI::l10n()->t('Maximum Load Average'), Config::get('system', 'maxloadavg', 20), DI::l10n()->t('Maximum system load before delivery and poll processes are deferred - default %d.', 20)],
|
||||
'$maxloadavg_frontend' => ['maxloadavg_frontend', DI::l10n()->t('Maximum Load Average (Frontend)'), Config::get('system', 'maxloadavg_frontend', 50), DI::l10n()->t('Maximum system load before the frontend quits service - default 50.')],
|
||||
'$min_memory' => ['min_memory', DI::l10n()->t('Minimal Memory'), Config::get('system', 'min_memory', 0), DI::l10n()->t('Minimal free memory in MB for the worker. Needs access to /proc/meminfo - default 0 (deactivated).')],
|
||||
'$diaspora_enabled' => ['diaspora_enabled', DI::l10n()->t('Enable Diaspora support'), DI::config()->get('system', 'diaspora_enabled', $diaspora_able), DI::l10n()->t('Provide built-in Diaspora network compatibility.')],
|
||||
'$dfrn_only' => ['dfrn_only', DI::l10n()->t('Only allow Friendica contacts'), DI::config()->get('system', 'dfrn_only'), DI::l10n()->t('All contacts must use Friendica protocols. All other built-in communication protocols disabled.')],
|
||||
'$verifyssl' => ['verifyssl', DI::l10n()->t('Verify SSL'), DI::config()->get('system', 'verifyssl'), DI::l10n()->t('If you wish, you can turn on strict certificate checking. This will mean you cannot connect (at all) to self-signed SSL sites.')],
|
||||
'$proxyuser' => ['proxyuser', DI::l10n()->t('Proxy user'), DI::config()->get('system', 'proxyuser'), ''],
|
||||
'$proxy' => ['proxy', DI::l10n()->t('Proxy URL'), DI::config()->get('system', 'proxy'), ''],
|
||||
'$timeout' => ['timeout', DI::l10n()->t('Network timeout'), DI::config()->get('system', 'curl_timeout', 60), DI::l10n()->t('Value is in seconds. Set to 0 for unlimited (not recommended).')],
|
||||
'$maxloadavg' => ['maxloadavg', DI::l10n()->t('Maximum Load Average'), DI::config()->get('system', 'maxloadavg', 20), DI::l10n()->t('Maximum system load before delivery and poll processes are deferred - default %d.', 20)],
|
||||
'$maxloadavg_frontend' => ['maxloadavg_frontend', DI::l10n()->t('Maximum Load Average (Frontend)'), DI::config()->get('system', 'maxloadavg_frontend', 50), DI::l10n()->t('Maximum system load before the frontend quits service - default 50.')],
|
||||
'$min_memory' => ['min_memory', DI::l10n()->t('Minimal Memory'), DI::config()->get('system', 'min_memory', 0), DI::l10n()->t('Minimal free memory in MB for the worker. Needs access to /proc/meminfo - default 0 (deactivated).')],
|
||||
'$optimize_max_tablesize' => ['optimize_max_tablesize', DI::l10n()->t('Maximum table size for optimization'), $optimize_max_tablesize, DI::l10n()->t('Maximum table size (in MB) for the automatic optimization. Enter -1 to disable it.')],
|
||||
'$optimize_fragmentation' => ['optimize_fragmentation', DI::l10n()->t('Minimum level of fragmentation'), Config::get('system', 'optimize_fragmentation', 30), DI::l10n()->t('Minimum fragmenation level to start the automatic optimization - default value is 30%.')],
|
||||
'$optimize_fragmentation' => ['optimize_fragmentation', DI::l10n()->t('Minimum level of fragmentation'), DI::config()->get('system', 'optimize_fragmentation', 30), DI::l10n()->t('Minimum fragmenation level to start the automatic optimization - default value is 30%.')],
|
||||
|
||||
'$poco_completion' => ['poco_completion', DI::l10n()->t('Periodical check of global contacts'), Config::get('system', 'poco_completion'), DI::l10n()->t('If enabled, the global contacts are checked periodically for missing or outdated data and the vitality of the contacts and servers.')],
|
||||
'$poco_requery_days' => ['poco_requery_days', DI::l10n()->t('Days between requery'), Config::get('system', 'poco_requery_days'), DI::l10n()->t('Number of days after which a server is requeried for his contacts.')],
|
||||
'$poco_discovery' => ['poco_discovery', DI::l10n()->t('Discover contacts from other servers'), (string)intval(Config::get('system', 'poco_discovery')), DI::l10n()->t('Periodically query other servers for contacts. You can choose between "Users": the users on the remote system, "Global Contacts": active contacts that are known on the system. The fallback is meant for Redmatrix servers and older friendica servers, where global contacts weren\'t available. The fallback increases the server load, so the recommended setting is "Users, Global Contacts".'), $poco_discovery_choices],
|
||||
'$poco_discovery_since' => ['poco_discovery_since', DI::l10n()->t('Timeframe for fetching global contacts'), (string)intval(Config::get('system', 'poco_discovery_since')), DI::l10n()->t('When the discovery is activated, this value defines the timeframe for the activity of the global contacts that are fetched from other servers.'), $poco_discovery_since_choices],
|
||||
'$poco_local_search' => ['poco_local_search', DI::l10n()->t('Search the local directory'), Config::get('system', 'poco_local_search'), DI::l10n()->t('Search the local directory instead of the global directory. When searching locally, every search will be executed on the global directory in the background. This improves the search results when the search is repeated.')],
|
||||
'$poco_completion' => ['poco_completion', DI::l10n()->t('Periodical check of global contacts'), DI::config()->get('system', 'poco_completion'), DI::l10n()->t('If enabled, the global contacts are checked periodically for missing or outdated data and the vitality of the contacts and servers.')],
|
||||
'$poco_requery_days' => ['poco_requery_days', DI::l10n()->t('Days between requery'), DI::config()->get('system', 'poco_requery_days'), DI::l10n()->t('Number of days after which a server is requeried for his contacts.')],
|
||||
'$poco_discovery' => ['poco_discovery', DI::l10n()->t('Discover contacts from other servers'), (string)intval(DI::config()->get('system', 'poco_discovery')), DI::l10n()->t('Periodically query other servers for contacts. You can choose between "Users": the users on the remote system, "Global Contacts": active contacts that are known on the system. The fallback is meant for Redmatrix servers and older friendica servers, where global contacts weren\'t available. The fallback increases the server load, so the recommended setting is "Users, Global Contacts".'), $poco_discovery_choices],
|
||||
'$poco_discovery_since' => ['poco_discovery_since', DI::l10n()->t('Timeframe for fetching global contacts'), (string)intval(DI::config()->get('system', 'poco_discovery_since')), DI::l10n()->t('When the discovery is activated, this value defines the timeframe for the activity of the global contacts that are fetched from other servers.'), $poco_discovery_since_choices],
|
||||
'$poco_local_search' => ['poco_local_search', DI::l10n()->t('Search the local directory'), DI::config()->get('system', 'poco_local_search'), DI::l10n()->t('Search the local directory instead of the global directory. When searching locally, every search will be executed on the global directory in the background. This improves the search results when the search is repeated.')],
|
||||
|
||||
'$nodeinfo' => ['nodeinfo', DI::l10n()->t('Publish server information'), Config::get('system', 'nodeinfo'), DI::l10n()->t('If enabled, general server and usage data will be published. The data contains the name and version of the server, number of users with public profiles, number of posts and the activated protocols and connectors. See <a href="http://the-federation.info/">the-federation.info</a> for details.')],
|
||||
'$nodeinfo' => ['nodeinfo', DI::l10n()->t('Publish server information'), DI::config()->get('system', 'nodeinfo'), DI::l10n()->t('If enabled, general server and usage data will be published. The data contains the name and version of the server, number of users with public profiles, number of posts and the activated protocols and connectors. See <a href="http://the-federation.info/">the-federation.info</a> for details.')],
|
||||
|
||||
'$check_new_version_url' => ['check_new_version_url', DI::l10n()->t('Check upstream version'), Config::get('system', 'check_new_version_url'), DI::l10n()->t('Enables checking for new Friendica versions at github. If there is a new version, you will be informed in the admin panel overview.'), $check_git_version_choices],
|
||||
'$suppress_tags' => ['suppress_tags', DI::l10n()->t('Suppress Tags'), Config::get('system', 'suppress_tags'), DI::l10n()->t('Suppress showing a list of hashtags at the end of the posting.')],
|
||||
'$dbclean' => ['dbclean', DI::l10n()->t('Clean database'), Config::get('system', 'dbclean', false), DI::l10n()->t('Remove old remote items, orphaned database records and old content from some other helper tables.')],
|
||||
'$dbclean_expire_days' => ['dbclean_expire_days', DI::l10n()->t('Lifespan of remote items'), Config::get('system', 'dbclean-expire-days', 0), DI::l10n()->t('When the database cleanup is enabled, this defines the days after which remote items will be deleted. Own items, and marked or filed items are always kept. 0 disables this behaviour.')],
|
||||
'$dbclean_unclaimed' => ['dbclean_unclaimed', DI::l10n()->t('Lifespan of unclaimed items'), Config::get('system', 'dbclean-expire-unclaimed', 90), DI::l10n()->t('When the database cleanup is enabled, this defines the days after which unclaimed remote items (mostly content from the relay) will be deleted. Default value is 90 days. Defaults to the general lifespan value of remote items if set to 0.')],
|
||||
'$dbclean_expire_conv' => ['dbclean_expire_conv', DI::l10n()->t('Lifespan of raw conversation data'), Config::get('system', 'dbclean_expire_conversation', 90), DI::l10n()->t('The conversation data is used for ActivityPub and OStatus, as well as for debug purposes. It should be safe to remove it after 14 days, default is 90 days.')],
|
||||
'$itemcache' => ['itemcache', DI::l10n()->t('Path to item cache'), Config::get('system', 'itemcache'), DI::l10n()->t('The item caches buffers generated bbcode and external images.')],
|
||||
'$itemcache_duration' => ['itemcache_duration', DI::l10n()->t('Cache duration in seconds'), Config::get('system', 'itemcache_duration'), DI::l10n()->t('How long should the cache files be hold? Default value is 86400 seconds (One day). To disable the item cache, set the value to -1.')],
|
||||
'$max_comments' => ['max_comments', DI::l10n()->t('Maximum numbers of comments per post'), Config::get('system', 'max_comments'), DI::l10n()->t('How much comments should be shown for each post? Default value is 100.')],
|
||||
'$temppath' => ['temppath', DI::l10n()->t('Temp path'), Config::get('system', 'temppath'), DI::l10n()->t('If you have a restricted system where the webserver can\'t access the system temp path, enter another path here.')],
|
||||
'$proxy_disabled' => ['proxy_disabled', DI::l10n()->t('Disable picture proxy'), Config::get('system', 'proxy_disabled'), DI::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', DI::l10n()->t('Only search in tags'), Config::get('system', 'only_tag_search'), DI::l10n()->t('On large systems the text search can slow down the system extremely.')],
|
||||
'$check_new_version_url' => ['check_new_version_url', DI::l10n()->t('Check upstream version'), DI::config()->get('system', 'check_new_version_url'), DI::l10n()->t('Enables checking for new Friendica versions at github. If there is a new version, you will be informed in the admin panel overview.'), $check_git_version_choices],
|
||||
'$suppress_tags' => ['suppress_tags', DI::l10n()->t('Suppress Tags'), DI::config()->get('system', 'suppress_tags'), DI::l10n()->t('Suppress showing a list of hashtags at the end of the posting.')],
|
||||
'$dbclean' => ['dbclean', DI::l10n()->t('Clean database'), DI::config()->get('system', 'dbclean', false), DI::l10n()->t('Remove old remote items, orphaned database records and old content from some other helper tables.')],
|
||||
'$dbclean_expire_days' => ['dbclean_expire_days', DI::l10n()->t('Lifespan of remote items'), DI::config()->get('system', 'dbclean-expire-days', 0), DI::l10n()->t('When the database cleanup is enabled, this defines the days after which remote items will be deleted. Own items, and marked or filed items are always kept. 0 disables this behaviour.')],
|
||||
'$dbclean_unclaimed' => ['dbclean_unclaimed', DI::l10n()->t('Lifespan of unclaimed items'), DI::config()->get('system', 'dbclean-expire-unclaimed', 90), DI::l10n()->t('When the database cleanup is enabled, this defines the days after which unclaimed remote items (mostly content from the relay) will be deleted. Default value is 90 days. Defaults to the general lifespan value of remote items if set to 0.')],
|
||||
'$dbclean_expire_conv' => ['dbclean_expire_conv', DI::l10n()->t('Lifespan of raw conversation data'), DI::config()->get('system', 'dbclean_expire_conversation', 90), DI::l10n()->t('The conversation data is used for ActivityPub and OStatus, as well as for debug purposes. It should be safe to remove it after 14 days, default is 90 days.')],
|
||||
'$itemcache' => ['itemcache', DI::l10n()->t('Path to item cache'), DI::config()->get('system', 'itemcache'), DI::l10n()->t('The item caches buffers generated bbcode and external images.')],
|
||||
'$itemcache_duration' => ['itemcache_duration', DI::l10n()->t('Cache duration in seconds'), DI::config()->get('system', 'itemcache_duration'), DI::l10n()->t('How long should the cache files be hold? Default value is 86400 seconds (One day). To disable the item cache, set the value to -1.')],
|
||||
'$max_comments' => ['max_comments', DI::l10n()->t('Maximum numbers of comments per post'), DI::config()->get('system', 'max_comments'), DI::l10n()->t('How much comments should be shown for each post? Default value is 100.')],
|
||||
'$temppath' => ['temppath', DI::l10n()->t('Temp path'), DI::config()->get('system', 'temppath'), DI::l10n()->t('If you have a restricted system where the webserver can\'t access the system temp path, enter another path here.')],
|
||||
'$proxy_disabled' => ['proxy_disabled', DI::l10n()->t('Disable picture proxy'), DI::config()->get('system', 'proxy_disabled'), DI::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', DI::l10n()->t('Only search in tags'), DI::config()->get('system', 'only_tag_search'), DI::l10n()->t('On large systems the text search can slow down the system extremely.')],
|
||||
|
||||
'$relocate_url' => ['relocate_url', DI::l10n()->t('New base url'), DI::baseUrl()->get(), DI::l10n()->t('Change base url for this server. Sends relocate message to all Friendica and Diaspora* contacts of all users.')],
|
||||
|
||||
'$rino' => ['rino', DI::l10n()->t('RINO Encryption'), intval(Config::get('system', 'rino_encrypt')), DI::l10n()->t('Encryption layer between nodes.'), [0 => DI::l10n()->t('Disabled'), 1 => DI::l10n()->t('Enabled')]],
|
||||
'$rino' => ['rino', DI::l10n()->t('RINO Encryption'), intval(DI::config()->get('system', 'rino_encrypt')), DI::l10n()->t('Encryption layer between nodes.'), [0 => DI::l10n()->t('Disabled'), 1 => DI::l10n()->t('Enabled')]],
|
||||
|
||||
'$worker_queues' => ['worker_queues', DI::l10n()->t('Maximum number of parallel workers'), Config::get('system', 'worker_queues'), DI::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', DI::l10n()->t('Don\'t use "proc_open" with the worker'), Config::get('system', 'worker_dont_fork'), DI::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', DI::l10n()->t('Enable fastlane'), 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.')],
|
||||
'$worker_frontend' => ['worker_frontend', DI::l10n()->t('Enable frontend worker'), Config::get('system', 'frontend_worker'), DI::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())],
|
||||
'$worker_queues' => ['worker_queues', DI::l10n()->t('Maximum number of parallel workers'), DI::config()->get('system', 'worker_queues'), DI::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', DI::l10n()->t('Don\'t use "proc_open" with the worker'), DI::config()->get('system', 'worker_dont_fork'), DI::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', 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.')],
|
||||
'$worker_frontend' => ['worker_frontend', DI::l10n()->t('Enable frontend worker'), DI::config()->get('system', 'frontend_worker'), DI::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', DI::l10n()->t('Subscribe to relay'), Config::get('system', 'relay_subscribe'), DI::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', DI::l10n()->t('Relay server'), Config::get('system', 'relay_server', 'https://relay.diasp.org'), DI::l10n()->t('Address of the relay server where public posts should be send to. For example https://relay.diasp.org')],
|
||||
'$relay_directly' => ['relay_directly', DI::l10n()->t('Direct relay transfer'), 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'), 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.'), ['' => DI::l10n()->t('Disabled'), 'all' => DI::l10n()->t('all'), 'tags' => DI::l10n()->t('tags')]],
|
||||
'$relay_server_tags' => ['relay_server_tags', DI::l10n()->t('Server tags'), Config::get('system', 'relay_server_tags'), DI::l10n()->t('Comma separated list of tags for the "tags" subscription.')],
|
||||
'$relay_user_tags' => ['relay_user_tags', DI::l10n()->t('Allow user tags'), Config::get('system', 'relay_user_tags', true), DI::l10n()->t('If enabled, the tags from the saved searches will used for the "tags" subscription in addition to the "relay_server_tags".')],
|
||||
'$relay_subscribe' => ['relay_subscribe', DI::l10n()->t('Subscribe to relay'), DI::config()->get('system', 'relay_subscribe'), DI::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', DI::l10n()->t('Relay server'), DI::config()->get('system', 'relay_server', 'https://relay.diasp.org'), DI::l10n()->t('Address of the relay server where public posts should be send to. For example https://relay.diasp.org')],
|
||||
'$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.'), ['' => DI::l10n()->t('Disabled'), 'all' => DI::l10n()->t('all'), 'tags' => DI::l10n()->t('tags')]],
|
||||
'$relay_server_tags' => ['relay_server_tags', DI::l10n()->t('Server tags'), DI::config()->get('system', 'relay_server_tags'), DI::l10n()->t('Comma separated list of tags for the "tags" subscription.')],
|
||||
'$relay_user_tags' => ['relay_user_tags', DI::l10n()->t('Allow user tags'), DI::config()->get('system', 'relay_user_tags', true), DI::l10n()->t('If enabled, the tags from the saved searches will used for the "tags" subscription in addition to the "relay_server_tags".')],
|
||||
|
||||
'$form_security_token' => parent::getFormSecurityToken('admin_site'),
|
||||
'$relocate_button' => DI::l10n()->t('Start Relocation'),
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace Friendica\Module\Admin;
|
||||
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Update;
|
||||
|
|
@ -33,26 +33,26 @@ class Summary extends BaseAdminModule
|
|||
|
||||
// Check if github.com/friendica/master/VERSION is higher then
|
||||
// the local version of Friendica. Check is opt-in, source may be master or devel branch
|
||||
if (Config::get('system', 'check_new_version_url', 'none') != 'none') {
|
||||
$gitversion = Config::get('system', 'git_friendica_version');
|
||||
if (DI::config()->get('system', 'check_new_version_url', 'none') != 'none') {
|
||||
$gitversion = DI::config()->get('system', 'git_friendica_version');
|
||||
if (version_compare(FRIENDICA_VERSION, $gitversion) < 0) {
|
||||
$warningtext[] = DI::l10n()->t('There is a new version of Friendica available for download. Your current version is %1$s, upstream version is %2$s', FRIENDICA_VERSION, $gitversion);
|
||||
}
|
||||
}
|
||||
|
||||
if (Config::get('system', 'dbupdate', DBStructure::UPDATE_NOT_CHECKED) == DBStructure::UPDATE_NOT_CHECKED) {
|
||||
if (DI::config()->get('system', 'dbupdate', DBStructure::UPDATE_NOT_CHECKED) == DBStructure::UPDATE_NOT_CHECKED) {
|
||||
DBStructure::update($a->getBasePath(), false, true);
|
||||
}
|
||||
|
||||
if (Config::get('system', 'dbupdate') == DBStructure::UPDATE_FAILED) {
|
||||
if (DI::config()->get('system', 'dbupdate') == DBStructure::UPDATE_FAILED) {
|
||||
$warningtext[] = DI::l10n()->t('The database update failed. Please run "php bin/console.php dbstructure update" from the command line and have a look at the errors that might appear.');
|
||||
}
|
||||
|
||||
if (Config::get('system', 'update') == Update::FAILED) {
|
||||
if (DI::config()->get('system', 'update') == Update::FAILED) {
|
||||
$warningtext[] = DI::l10n()->t('The last update failed. Please run "php bin/console.php dbstructure update" from the command line and have a look at the errors that might appear. (Some of the errors are possibly inside the logfile.)');
|
||||
}
|
||||
|
||||
$last_worker_call = Config::get('system', 'last_worker_execution', false);
|
||||
$last_worker_call = DI::config()->get('system', 'last_worker_execution', false);
|
||||
if (!$last_worker_call) {
|
||||
$warningtext[] = DI::l10n()->t('The worker was never executed. Please check your database structure!');
|
||||
} elseif ((strtotime(DateTimeFormat::utcNow()) - strtotime($last_worker_call)) > 60 * 60) {
|
||||
|
|
@ -76,8 +76,8 @@ class Summary extends BaseAdminModule
|
|||
}
|
||||
|
||||
// Check logfile permission
|
||||
if (Config::get('system', 'debugging')) {
|
||||
$file = Config::get('system', 'logfile');
|
||||
if (DI::config()->get('system', 'debugging')) {
|
||||
$file = DI::config()->get('system', 'logfile');
|
||||
|
||||
$fileSystem = DI::fs();
|
||||
|
||||
|
|
@ -92,7 +92,7 @@ class Summary extends BaseAdminModule
|
|||
$warningtext[] = DI::l10n()->t('The logfile \'%s\' is not usable. No logging possible (error: \'%s\')', $file, $exception->getMessage());
|
||||
}
|
||||
|
||||
$file = Config::get('system', 'dlogfile');
|
||||
$file = DI::config()->get('system', 'dlogfile');
|
||||
|
||||
try {
|
||||
if (!empty($file)) {
|
||||
|
|
@ -110,12 +110,12 @@ class Summary extends BaseAdminModule
|
|||
|
||||
// check legacy basepath settings
|
||||
$configLoader = new ConfigFileLoader($a->getBasePath());
|
||||
$configCache = new Config\Cache\ConfigCache();
|
||||
$configCache = new Cache();
|
||||
$configLoader->setupCache($configCache);
|
||||
$confBasepath = $configCache->get('system', 'basepath');
|
||||
$currBasepath = DI::config()->get('system', 'basepath');
|
||||
if ($confBasepath !== $currBasepath || !is_dir($currBasepath)) {
|
||||
if (is_dir($confBasepath) && Config::set('system', 'basepath', $confBasepath)) {
|
||||
if (is_dir($confBasepath) && DI::config()->set('system', 'basepath', $confBasepath)) {
|
||||
DI::logger()->info('Friendica\'s system.basepath was updated successfully.', [
|
||||
'from' => $currBasepath,
|
||||
'to' => $confBasepath,
|
||||
|
|
@ -196,7 +196,7 @@ class Summary extends BaseAdminModule
|
|||
'$version' => [DI::l10n()->t('Version'), FRIENDICA_VERSION],
|
||||
'$platform' => FRIENDICA_PLATFORM,
|
||||
'$codename' => FRIENDICA_CODENAME,
|
||||
'$build' => Config::get('system', 'build'),
|
||||
'$build' => DI::config()->get('system', 'build'),
|
||||
'$addons' => [DI::l10n()->t('Active addons'), Addon::getEnabledList()],
|
||||
'$serversettings' => $server_settings,
|
||||
'$warningtext' => $warningtext
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Friendica\Module\Admin\Themes;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Theme;
|
||||
use Friendica\DI;
|
||||
|
|
@ -77,7 +76,7 @@ class Index extends BaseAdminModule
|
|||
$is_supported = 1 - (intval(file_exists($file . '/unsupported')));
|
||||
$is_allowed = intval(in_array($theme, $allowed_themes));
|
||||
|
||||
if ($is_allowed || $is_supported || Config::get('system', 'show_unsupported_themes')) {
|
||||
if ($is_allowed || $is_supported || DI::config()->get('system', 'show_unsupported_themes')) {
|
||||
$themes[] = ['name' => $theme, 'experimental' => $is_experimental, 'supported' => $is_supported, 'allowed' => $is_allowed];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Friendica\Module\Admin;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseAdminModule;
|
||||
|
|
@ -23,9 +22,9 @@ class Tos extends BaseAdminModule
|
|||
$displayprivstatement = !empty($_POST['displayprivstatement']);
|
||||
$tostext = (!empty($_POST['tostext']) ? strip_tags(trim($_POST['tostext'])) : '');
|
||||
|
||||
Config::set('system', 'tosdisplay', $displaytos);
|
||||
Config::set('system', 'tosprivstatement', $displayprivstatement);
|
||||
Config::set('system', 'tostext', $tostext);
|
||||
DI::config()->set('system', 'tosdisplay', $displaytos);
|
||||
DI::config()->set('system', 'tosprivstatement', $displayprivstatement);
|
||||
DI::config()->set('system', 'tostext', $tostext);
|
||||
|
||||
info(DI::l10n()->t('The Terms of Service settings have been updated.'));
|
||||
|
||||
|
|
@ -41,11 +40,11 @@ class Tos extends BaseAdminModule
|
|||
return Renderer::replaceMacros($t, [
|
||||
'$title' => DI::l10n()->t('Administration'),
|
||||
'$page' => DI::l10n()->t('Terms of Service'),
|
||||
'$displaytos' => ['displaytos', DI::l10n()->t('Display Terms of Service'), Config::get('system', 'tosdisplay'), DI::l10n()->t('Enable the Terms of Service page. If this is enabled a link to the terms will be added to the registration form and the general information page.')],
|
||||
'$displayprivstatement' => ['displayprivstatement', DI::l10n()->t('Display Privacy Statement'), Config::get('system', 'tosprivstatement'), DI::l10n()->t('Show some informations regarding the needed information to operate the node according e.g. to <a href="%s" target="_blank">EU-GDPR</a>.', 'https://en.wikipedia.org/wiki/General_Data_Protection_Regulation')],
|
||||
'$displaytos' => ['displaytos', DI::l10n()->t('Display Terms of Service'), DI::config()->get('system', 'tosdisplay'), DI::l10n()->t('Enable the Terms of Service page. If this is enabled a link to the terms will be added to the registration form and the general information page.')],
|
||||
'$displayprivstatement' => ['displayprivstatement', DI::l10n()->t('Display Privacy Statement'), DI::config()->get('system', 'tosprivstatement'), DI::l10n()->t('Show some informations regarding the needed information to operate the node according e.g. to <a href="%s" target="_blank">EU-GDPR</a>.', 'https://en.wikipedia.org/wiki/General_Data_Protection_Regulation')],
|
||||
'$preview' => DI::l10n()->t('Privacy Statement Preview'),
|
||||
'$privtext' => $tos->privacy_complete,
|
||||
'$tostext' => ['tostext', DI::l10n()->t('The Terms of Service'), Config::get('system', 'tostext'), DI::l10n()->t('Enter the Terms of Service for your node here. You can use BBCode. Headers of sections should be [h2] and below.')],
|
||||
'$tostext' => ['tostext', DI::l10n()->t('The Terms of Service'), DI::config()->get('system', 'tostext'), DI::l10n()->t('Enter the Terms of Service for your node here. You can use BBCode. Headers of sections should be [h2] and below.')],
|
||||
'$form_security_token' => parent::getFormSecurityToken('admin_tos'),
|
||||
'$submit' => DI::l10n()->t('Save Settings'),
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace Friendica\Module\Admin;
|
||||
|
||||
use Friendica\Content\Pager;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
|
@ -24,7 +23,7 @@ class Users extends BaseAdminModule
|
|||
$nu_name = $_POST['new_user_name'] ?? '';
|
||||
$nu_nickname = $_POST['new_user_nickname'] ?? '';
|
||||
$nu_email = $_POST['new_user_email'] ?? '';
|
||||
$nu_language = Config::get('system', 'language');
|
||||
$nu_language = DI::config()->get('system', 'language');
|
||||
|
||||
parent::checkFormSecurityTokenRedirectOnError('/admin/users', 'admin_users');
|
||||
|
||||
|
|
@ -74,8 +73,8 @@ class Users extends BaseAdminModule
|
|||
|
||||
Thank you and welcome to %4$s.'));
|
||||
|
||||
$preamble = sprintf($preamble, $user['username'], Config::get('config', 'sitename'));
|
||||
$body = sprintf($body, DI::baseUrl()->get(), $user['nickname'], $result['password'], Config::get('config', 'sitename'));
|
||||
$preamble = sprintf($preamble, $user['username'], DI::config()->get('config', 'sitename'));
|
||||
$body = sprintf($body, DI::baseUrl()->get(), $user['nickname'], $result['password'], DI::config()->get('config', 'sitename'));
|
||||
|
||||
notification([
|
||||
'type' => SYSTEM_EMAIL,
|
||||
|
|
@ -83,7 +82,7 @@ class Users extends BaseAdminModule
|
|||
'to_name' => $user['username'],
|
||||
'to_email' => $user['email'],
|
||||
'uid' => $user['uid'],
|
||||
'subject' => DI::l10n()->t('Registration details for %s', Config::get('config', 'sitename')),
|
||||
'subject' => DI::l10n()->t('Registration details for %s', DI::config()->get('config', 'sitename')),
|
||||
'preamble' => $preamble,
|
||||
'body' => $body]);
|
||||
}
|
||||
|
|
@ -214,7 +213,7 @@ class Users extends BaseAdminModule
|
|||
);
|
||||
$users = DBA::toArray($usersStmt);
|
||||
|
||||
$adminlist = explode(',', str_replace(' ', '', Config::get('config', 'admin_email')));
|
||||
$adminlist = explode(',', str_replace(' ', '', DI::config()->get('config', 'admin_email')));
|
||||
$_setup_users = function ($e) use ($adminlist) {
|
||||
$page_types = [
|
||||
User::PAGE_FLAGS_NORMAL => DI::l10n()->t('Normal Account Page'),
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ namespace Friendica\Module;
|
|||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
||||
|
|
@ -15,7 +14,7 @@ class Apps extends BaseModule
|
|||
{
|
||||
public static function init(array $parameters = [])
|
||||
{
|
||||
$privateaddons = Config::get('config', 'private_addons');
|
||||
$privateaddons = DI::config()->get('config', 'private_addons');
|
||||
if ($privateaddons === "1" && !local_user()) {
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
namespace Friendica\Module\Contact;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
|
@ -23,7 +23,7 @@ class Hovercard extends BaseModule
|
|||
$contact_url = $_REQUEST['url'] ?? '';
|
||||
|
||||
// Get out if the system doesn't have public access allowed
|
||||
if (Config::get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
throw new HTTPException\ForbiddenException();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
|
|
@ -146,7 +145,7 @@ class Group extends BaseModule
|
|||
// Switch to text mode interface if we have more than 'n' contacts or group members
|
||||
$switchtotext = DI::pConfig()->get(local_user(), 'system', 'groupedit_image_limit');
|
||||
if (is_null($switchtotext)) {
|
||||
$switchtotext = Config::get('system', 'groupedit_image_limit', 200);
|
||||
$switchtotext = DI::config()->get('system', 'groupedit_image_limit', 200);
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('group_edit.tpl');
|
||||
|
|
|
|||
|
|
@ -6,9 +6,7 @@
|
|||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
|
|
@ -30,7 +28,7 @@ class Inbox extends BaseModule
|
|||
throw new \Friendica\Network\HTTPException\BadRequestException();
|
||||
}
|
||||
|
||||
if (Config::get('debug', 'ap_inbox_log')) {
|
||||
if (DI::config()->get('debug', 'ap_inbox_log')) {
|
||||
if (HTTPSignature::getSigner($postdata, $_SERVER)) {
|
||||
$filename = 'signed-activitypub';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace Friendica\Module;
|
|||
use Friendica\App;
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core;
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
|
@ -332,13 +332,13 @@ class Install extends BaseModule
|
|||
/**
|
||||
* Checks the $_POST settings and updates the config Cache for it
|
||||
*
|
||||
* @param ConfigCache $configCache The current config cache
|
||||
* @param Cache $configCache The current config cache
|
||||
* @param array $post The $_POST data
|
||||
* @param string $cat The category of the setting
|
||||
* @param string $key The key of the setting
|
||||
* @param null|string $default The default value
|
||||
*/
|
||||
private static function checkSetting(ConfigCache $configCache, array $post, $cat, $key, $default = null)
|
||||
private static function checkSetting(Cache $configCache, array $post, $cat, $key, $default = null)
|
||||
{
|
||||
$configCache->set($cat, $key,
|
||||
Strings::escapeTags(
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ use Friendica\Content\Nav;
|
|||
use Friendica\Content\Pager;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
|
|
@ -83,7 +82,7 @@ class Profile extends BaseModule
|
|||
|
||||
$page['htmlhead'] .= "\n";
|
||||
|
||||
$blocked = !local_user() && !Session::getRemoteContactID($a->profile['profile_uid']) && Config::get('system', 'block_public');
|
||||
$blocked = !local_user() && !Session::getRemoteContactID($a->profile['profile_uid']) && DI::config()->get('system', 'block_public');
|
||||
$userblock = !local_user() && !Session::getRemoteContactID($a->profile['profile_uid']) && $a->profile['hidewall'];
|
||||
|
||||
if (!empty($a->profile['page-flags']) && $a->profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY) {
|
||||
|
|
@ -150,7 +149,7 @@ class Profile extends BaseModule
|
|||
|
||||
$hashtags = $_GET['tag'] ?? '';
|
||||
|
||||
if (Config::get('system', 'block_public') && !local_user() && !Session::getRemoteContactID($a->profile['profile_uid'])) {
|
||||
if (DI::config()->get('system', 'block_public') && !local_user() && !Session::getRemoteContactID($a->profile['profile_uid'])) {
|
||||
return Login::form();
|
||||
}
|
||||
|
||||
|
|
@ -331,7 +330,7 @@ class Profile extends BaseModule
|
|||
$last_updated_array[$last_updated_key] = time();
|
||||
Session::set('last_updated', $last_updated_array);
|
||||
|
||||
if ($is_owner && !$update && !Config::get('theme', 'hide_eventlist')) {
|
||||
if ($is_owner && !$update && !DI::config()->get('theme', 'hide_eventlist')) {
|
||||
$o .= ProfileModel::getBirthdays();
|
||||
$o .= ProfileModel::getEventsReminderHTML();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ use Friendica\BaseModule;
|
|||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Pager;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
|
|
@ -20,7 +19,7 @@ class Contacts extends BaseModule
|
|||
{
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
if (Config::get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ namespace Friendica\Module;
|
|||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
|
|
@ -38,7 +37,7 @@ class Register extends BaseModule
|
|||
// logged in users can register others (people/pages/groups)
|
||||
// even with closed registrations, unless specifically prohibited by site policy.
|
||||
// 'block_extended_register' blocks all registrations, period.
|
||||
$block = Config::get('system', 'block_extended_register');
|
||||
$block = DI::config()->get('system', 'block_extended_register');
|
||||
|
||||
if (local_user() && $block) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
|
|
@ -53,12 +52,12 @@ class Register extends BaseModule
|
|||
}
|
||||
}
|
||||
|
||||
if (!local_user() && (intval(Config::get('config', 'register_policy')) === self::CLOSED)) {
|
||||
if (!local_user() && (intval(DI::config()->get('config', 'register_policy')) === self::CLOSED)) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
return '';
|
||||
}
|
||||
|
||||
$max_dailies = intval(Config::get('system', 'max_daily_registrations'));
|
||||
$max_dailies = intval(DI::config()->get('system', 'max_daily_registrations'));
|
||||
if ($max_dailies) {
|
||||
$count = DBA::count('user', ['`register_date` > UTC_TIMESTAMP - INTERVAL 1 day']);
|
||||
if ($count >= $max_dailies) {
|
||||
|
|
@ -75,7 +74,7 @@ class Register extends BaseModule
|
|||
$photo = $_REQUEST['photo'] ?? '';
|
||||
$invite_id = $_REQUEST['invite_id'] ?? '';
|
||||
|
||||
if (local_user() || Config::get('system', 'no_openid')) {
|
||||
if (local_user() || DI::config()->get('system', 'no_openid')) {
|
||||
$fillwith = '';
|
||||
$fillext = '';
|
||||
$oidlabel = '';
|
||||
|
|
@ -85,7 +84,7 @@ class Register extends BaseModule
|
|||
$oidlabel = DI::l10n()->t('Your OpenID (optional): ');
|
||||
}
|
||||
|
||||
if (Config::get('system', 'publish_all')) {
|
||||
if (DI::config()->get('system', 'publish_all')) {
|
||||
$profile_publish = '<input type="hidden" name="profile_publish_reg" value="1" />';
|
||||
} else {
|
||||
$publish_tpl = Renderer::getMarkupTemplate('profile_publish.tpl');
|
||||
|
|
@ -112,14 +111,14 @@ class Register extends BaseModule
|
|||
$tos = new Tos();
|
||||
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$invitations' => Config::get('system', 'invitation_only'),
|
||||
'$permonly' => intval(Config::get('config', 'register_policy')) === self::APPROVE,
|
||||
'$invitations' => DI::config()->get('system', 'invitation_only'),
|
||||
'$permonly' => intval(DI::config()->get('config', 'register_policy')) === self::APPROVE,
|
||||
'$permonlybox' => ['permonlybox', DI::l10n()->t('Note for the admin'), '', DI::l10n()->t('Leave a message for the admin, why you want to join this node'), 'required'],
|
||||
'$invite_desc' => DI::l10n()->t('Membership on this site is by invitation only.'),
|
||||
'$invite_label' => DI::l10n()->t('Your invitation code: '),
|
||||
'$invite_id' => $invite_id,
|
||||
'$regtitle' => DI::l10n()->t('Registration'),
|
||||
'$registertext' => BBCode::convert(Config::get('config', 'register_text', '')),
|
||||
'$registertext' => BBCode::convert(DI::config()->get('config', 'register_text', '')),
|
||||
'$fillwith' => $fillwith,
|
||||
'$fillext' => $fillext,
|
||||
'$oidlabel' => $oidlabel,
|
||||
|
|
@ -141,12 +140,12 @@ class Register extends BaseModule
|
|||
'$sitename' => DI::baseUrl()->getHostname(),
|
||||
'$importh' => DI::l10n()->t('Import'),
|
||||
'$importt' => DI::l10n()->t('Import your profile to this friendica instance'),
|
||||
'$showtoslink' => Config::get('system', 'tosdisplay'),
|
||||
'$showtoslink' => DI::config()->get('system', 'tosdisplay'),
|
||||
'$tostext' => DI::l10n()->t('Terms of Service'),
|
||||
'$showprivstatement' => Config::get('system', 'tosprivstatement'),
|
||||
'$showprivstatement' => DI::config()->get('system', 'tosprivstatement'),
|
||||
'$privstatement'=> $tos->privacy_complete,
|
||||
'$form_security_token' => BaseModule::getFormSecurityToken('register'),
|
||||
'$explicit_content' => Config::get('system', 'explicit_content', false),
|
||||
'$explicit_content' => DI::config()->get('system', 'explicit_content', false),
|
||||
'$explicit_content_note' => DI::l10n()->t('Note: This node explicitly contains adult content'),
|
||||
'$additional' => !empty(local_user()),
|
||||
'$parent_password' => ['parent_password', DI::l10n()->t('Parent Password:'), '', DI::l10n()->t('Please enter the password of the parent account to legitimize your request.')]
|
||||
|
|
@ -191,7 +190,7 @@ class Register extends BaseModule
|
|||
DI::baseUrl()->redirect('register?' . http_build_query($regdata));
|
||||
}
|
||||
|
||||
$max_dailies = intval(Config::get('system', 'max_daily_registrations'));
|
||||
$max_dailies = intval(DI::config()->get('system', 'max_daily_registrations'));
|
||||
if ($max_dailies) {
|
||||
$count = DBA::count('user', ['`register_date` > UTC_TIMESTAMP - INTERVAL 1 day']);
|
||||
if ($count >= $max_dailies) {
|
||||
|
|
@ -199,7 +198,7 @@ class Register extends BaseModule
|
|||
}
|
||||
}
|
||||
|
||||
switch (Config::get('config', 'register_policy')) {
|
||||
switch (DI::config()->get('config', 'register_policy')) {
|
||||
case self::OPEN:
|
||||
$blocked = 0;
|
||||
$verified = 1;
|
||||
|
|
@ -272,7 +271,7 @@ class Register extends BaseModule
|
|||
|
||||
$base_url = DI::baseUrl()->get();
|
||||
|
||||
if ($netpublish && intval(Config::get('config', 'register_policy')) !== self::APPROVE) {
|
||||
if ($netpublish && intval(DI::config()->get('config', 'register_policy')) !== self::APPROVE) {
|
||||
$url = $base_url . '/profile/' . $user['nickname'];
|
||||
Worker::add(PRIORITY_LOW, 'Directory', $url);
|
||||
}
|
||||
|
|
@ -283,11 +282,11 @@ class Register extends BaseModule
|
|||
DI::baseUrl()->redirect('delegation');
|
||||
}
|
||||
|
||||
$using_invites = Config::get('system', 'invitation_only');
|
||||
$num_invites = Config::get('system', 'number_invites');
|
||||
$using_invites = DI::config()->get('system', 'invitation_only');
|
||||
$num_invites = DI::config()->get('system', 'number_invites');
|
||||
$invite_id = (!empty($_POST['invite_id']) ? Strings::escapeTags(trim($_POST['invite_id'])) : '');
|
||||
|
||||
if (intval(Config::get('config', 'register_policy')) === self::OPEN) {
|
||||
if (intval(DI::config()->get('config', 'register_policy')) === self::OPEN) {
|
||||
if ($using_invites && $invite_id) {
|
||||
Model\Register::deleteByHash($invite_id);
|
||||
DI::pConfig()->set($user['uid'], 'system', 'invites_remaining', $num_invites);
|
||||
|
|
@ -298,7 +297,7 @@ class Register extends BaseModule
|
|||
$res = Model\User::sendRegisterOpenEmail(
|
||||
DI::l10n()->withLang($arr['language']),
|
||||
$user,
|
||||
Config::get('config', 'sitename'),
|
||||
DI::config()->get('config', 'sitename'),
|
||||
$base_url,
|
||||
$result['password']
|
||||
);
|
||||
|
|
@ -317,8 +316,8 @@ class Register extends BaseModule
|
|||
info(DI::l10n()->t('Registration successful.'));
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
} elseif (intval(Config::get('config', 'register_policy')) === self::APPROVE) {
|
||||
if (!strlen(Config::get('config', 'admin_email'))) {
|
||||
} elseif (intval(DI::config()->get('config', 'register_policy')) === self::APPROVE) {
|
||||
if (!strlen(DI::config()->get('config', 'admin_email'))) {
|
||||
notice(DI::l10n()->t('Your registration can not be processed.'));
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
|
|
@ -331,7 +330,7 @@ class Register extends BaseModule
|
|||
DI::baseUrl()->redirect('register/');
|
||||
}
|
||||
|
||||
Model\Register::createForApproval($user['uid'], Config::get('system', 'language'), $_POST['permonlybox']);
|
||||
Model\Register::createForApproval($user['uid'], DI::config()->get('system', 'language'), $_POST['permonlybox']);
|
||||
|
||||
// invite system
|
||||
if ($using_invites && $invite_id) {
|
||||
|
|
@ -343,7 +342,7 @@ class Register extends BaseModule
|
|||
$admins_stmt = DBA::select(
|
||||
'user',
|
||||
['uid', 'language', 'email'],
|
||||
['email' => explode(',', str_replace(' ', '', Config::get('config', 'admin_email')))]
|
||||
['email' => explode(',', str_replace(' ', '', DI::config()->get('config', 'admin_email')))]
|
||||
);
|
||||
|
||||
// send notification to admins
|
||||
|
|
@ -368,7 +367,7 @@ class Register extends BaseModule
|
|||
// send notification to the user, that the registration is pending
|
||||
Model\User::sendRegisterPendingEmail(
|
||||
$user,
|
||||
Config::get('config', 'sitename'),
|
||||
DI::config()->get('config', 'sitename'),
|
||||
$base_url,
|
||||
$result['password']
|
||||
);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ use Friendica\Content\Pager;
|
|||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Cache\Duration;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
|
|
@ -26,25 +25,25 @@ class Index extends BaseSearchModule
|
|||
{
|
||||
$search = (!empty($_GET['q']) ? Strings::escapeTags(trim(rawurldecode($_GET['q']))) : '');
|
||||
|
||||
if (Config::get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
throw new HTTPException\ForbiddenException(DI::l10n()->t('Public access denied.'));
|
||||
}
|
||||
|
||||
if (Config::get('system', 'local_search') && !Session::isAuthenticated()) {
|
||||
if (DI::config()->get('system', 'local_search') && !Session::isAuthenticated()) {
|
||||
$e = new HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a search.'));
|
||||
$e->httpdesc = DI::l10n()->t('Public access denied.');
|
||||
throw $e;
|
||||
}
|
||||
|
||||
if (Config::get('system', 'permit_crawling') && !Session::isAuthenticated()) {
|
||||
if (DI::config()->get('system', 'permit_crawling') && !Session::isAuthenticated()) {
|
||||
// Default values:
|
||||
// 10 requests are "free", after the 11th only a call per minute is allowed
|
||||
|
||||
$free_crawls = intval(Config::get('system', 'free_crawls'));
|
||||
$free_crawls = intval(DI::config()->get('system', 'free_crawls'));
|
||||
if ($free_crawls == 0)
|
||||
$free_crawls = 10;
|
||||
|
||||
$crawl_permit_period = intval(Config::get('system', 'crawl_permit_period'));
|
||||
$crawl_permit_period = intval(DI::config()->get('system', 'crawl_permit_period'));
|
||||
if ($crawl_permit_period == 0)
|
||||
$crawl_permit_period = 10;
|
||||
|
||||
|
|
@ -112,7 +111,7 @@ class Index extends BaseSearchModule
|
|||
}
|
||||
}
|
||||
|
||||
$tag = $tag || Config::get('system', 'only_tag_search');
|
||||
$tag = $tag || DI::config()->get('system', 'only_tag_search');
|
||||
|
||||
// Here is the way permissions work in the search module...
|
||||
// Only public posts can be shown
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
namespace Friendica\Module\Security;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
|
|
@ -28,7 +27,7 @@ class Login extends BaseModule
|
|||
DI::baseUrl()->redirect();
|
||||
}
|
||||
|
||||
return self::form(Session::get('return_path'), intval(Config::get('config', 'register_policy')) !== \Friendica\Module\Register::CLOSED);
|
||||
return self::form(Session::get('return_path'), intval(DI::config()->get('config', 'register_policy')) !== \Friendica\Module\Register::CLOSED);
|
||||
}
|
||||
|
||||
public static function post(array $parameters = [])
|
||||
|
|
@ -76,7 +75,7 @@ class Login extends BaseModule
|
|||
{
|
||||
$o = '';
|
||||
|
||||
$noid = Config::get('system', 'no_openid');
|
||||
$noid = DI::config()->get('system', 'no_openid');
|
||||
|
||||
if ($noid) {
|
||||
Session::remove('openid_identity');
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\DI;
|
||||
|
|
@ -48,8 +47,8 @@ class Tos extends BaseModule
|
|||
**/
|
||||
public static function init(array $parameters = [])
|
||||
{
|
||||
if (strlen(Config::get('system','singleuser'))) {
|
||||
DI::baseUrl()->redirect('profile/' . Config::get('system','singleuser'));
|
||||
if (strlen(DI::config()->get('system','singleuser'))) {
|
||||
DI::baseUrl()->redirect('profile/' . DI::config()->get('system','singleuser'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -67,11 +66,11 @@ class Tos extends BaseModule
|
|||
*/
|
||||
public static function content(array $parameters = []) {
|
||||
$tpl = Renderer::getMarkupTemplate('tos.tpl');
|
||||
if (Config::get('system', 'tosdisplay')) {
|
||||
if (DI::config()->get('system', 'tosdisplay')) {
|
||||
return Renderer::replaceMacros($tpl, [
|
||||
'$title' => DI::l10n()->t('Terms of Service'),
|
||||
'$tostext' => BBCode::convert(Config::get('system', 'tostext')),
|
||||
'$displayprivstatement' => Config::get('system', 'tosprivstatement'),
|
||||
'$tostext' => BBCode::convert(DI::config()->get('system', 'tostext')),
|
||||
'$displayprivstatement' => DI::config()->get('system', 'tosprivstatement'),
|
||||
'$privstatementtitle' => DI::l10n()->t('Privacy Statement'),
|
||||
'$privacy_operate' => DI::l10n()->t('At the time of registration, and for providing communications between the user account and their contacts, the user has to provide a display name (pen name), an username (nickname) and a working email address. The names will be accessible on the profile page of the account by any visitor of the page, even if other profile details are not displayed. The email address will only be used to send the user notifications about interactions, but wont be visibly displayed. The listing of an account in the node\'s user directory or the global user directory is optional and can be controlled in the user settings, it is not necessary for communication.'),
|
||||
'$privacy_distribute' => DI::l10n()->t('This data is required for communication and is passed on to the nodes of the communication partners and is stored there. Users can enter additional private data that may be transmitted to the communication partners accounts.'),
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
namespace Friendica\Network;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Strings;
|
||||
use OAuthConsumer;
|
||||
use OAuthDataStore;
|
||||
|
|
@ -151,7 +151,7 @@ class FKOAuthDataStore extends OAuthDataStore
|
|||
$ret = null;
|
||||
|
||||
// get user for this verifier
|
||||
$uverifier = Config::get("oauth", $verifier);
|
||||
$uverifier = DI::config()->get("oauth", $verifier);
|
||||
Logger::log(__function__ . ":" . $verifier . "," . $uverifier);
|
||||
|
||||
if (is_null($verifier) || ($uverifier !== false)) {
|
||||
|
|
@ -177,7 +177,7 @@ class FKOAuthDataStore extends OAuthDataStore
|
|||
DBA::delete('tokens', ['id' => $token->key]);
|
||||
|
||||
if (!is_null($ret) && !is_null($uverifier)) {
|
||||
Config::delete("oauth", $verifier);
|
||||
DI::config()->delete("oauth", $verifier);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ namespace Friendica\Network;
|
|||
use DOMDocument;
|
||||
use DomXPath;
|
||||
use Friendica\Core\Cache\Duration;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Database\DBA;
|
||||
|
|
@ -109,7 +108,7 @@ class Probe
|
|||
$ssl_url = "https://".$host."/.well-known/host-meta";
|
||||
$url = "http://".$host."/.well-known/host-meta";
|
||||
|
||||
$xrd_timeout = Config::get('system', 'xrd_timeout', 20);
|
||||
$xrd_timeout = DI::config()->get('system', 'xrd_timeout', 20);
|
||||
|
||||
Logger::log("Probing for ".$host, Logger::DEBUG);
|
||||
$xrd = null;
|
||||
|
|
@ -859,7 +858,7 @@ class Probe
|
|||
*/
|
||||
private static function webfinger($url, $type)
|
||||
{
|
||||
$xrd_timeout = Config::get('system', 'xrd_timeout', 20);
|
||||
$xrd_timeout = DI::config()->get('system', 'xrd_timeout', 20);
|
||||
|
||||
$curlResult = Network::curl($url, false, ['timeout' => $xrd_timeout, 'accept_content' => $type]);
|
||||
if ($curlResult->isTimeout()) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
namespace Friendica\Object;
|
||||
|
||||
use Exception;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Images;
|
||||
|
|
@ -115,7 +114,7 @@ class Image
|
|||
*/
|
||||
switch ($this->getType()) {
|
||||
case "image/png":
|
||||
$quality = Config::get('system', 'png_quality');
|
||||
$quality = DI::config()->get('system', 'png_quality');
|
||||
if ((! $quality) || ($quality > 9)) {
|
||||
$quality = PNG_QUALITY;
|
||||
}
|
||||
|
|
@ -131,7 +130,7 @@ class Image
|
|||
$this->image->setCompressionQuality($quality);
|
||||
break;
|
||||
case "image/jpeg":
|
||||
$quality = Config::get('system', 'jpeg_quality');
|
||||
$quality = DI::config()->get('system', 'jpeg_quality');
|
||||
if ((! $quality) || ($quality > 100)) {
|
||||
$quality = JPEG_QUALITY;
|
||||
}
|
||||
|
|
@ -652,14 +651,14 @@ class Image
|
|||
|
||||
switch ($this->getType()) {
|
||||
case "image/png":
|
||||
$quality = Config::get('system', 'png_quality');
|
||||
$quality = DI::config()->get('system', 'png_quality');
|
||||
if ((!$quality) || ($quality > 9)) {
|
||||
$quality = PNG_QUALITY;
|
||||
}
|
||||
imagepng($this->image, null, $quality);
|
||||
break;
|
||||
case "image/jpeg":
|
||||
$quality = Config::get('system', 'jpeg_quality');
|
||||
$quality = DI::config()->get('system', 'jpeg_quality');
|
||||
if ((!$quality) || ($quality > 100)) {
|
||||
$quality = JPEG_QUALITY;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ namespace Friendica\Object;
|
|||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
|
|
@ -374,14 +373,14 @@ class Post
|
|||
|
||||
$ago = Temporal::getRelativeDate($item['created']);
|
||||
$ago_received = Temporal::getRelativeDate($item['received']);
|
||||
if (Config::get('system', 'show_received') && (abs(strtotime($item['created']) - strtotime($item['received'])) > Config::get('system', 'show_received_seconds')) && ($ago != $ago_received)) {
|
||||
if (DI::config()->get('system', 'show_received') && (abs(strtotime($item['created']) - strtotime($item['received'])) > DI::config()->get('system', 'show_received_seconds')) && ($ago != $ago_received)) {
|
||||
$ago = DI::l10n()->t('%s (Received %s)', $ago, $ago_received);
|
||||
}
|
||||
|
||||
$tmp_item = [
|
||||
'template' => $this->getTemplate(),
|
||||
'type' => implode("", array_slice(explode("/", $item['verb']), -1)),
|
||||
'suppress_tags' => Config::get('system', 'suppress_tags'),
|
||||
'suppress_tags' => DI::config()->get('system', 'suppress_tags'),
|
||||
'tags' => $tags['tags'],
|
||||
'hashtags' => $tags['hashtags'],
|
||||
'mentions' => $tags['mentions'],
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ namespace Friendica\Protocol\ActivityPub;
|
|||
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Database\DBA;
|
||||
|
|
@ -897,7 +896,7 @@ class Processor
|
|||
*/
|
||||
private static function getImplicitMentionList(array $parent)
|
||||
{
|
||||
if (Config::get('system', 'disable_implicit_mentions')) {
|
||||
if (DI::config()->get('system', 'disable_implicit_mentions')) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
|
@ -939,7 +938,7 @@ class Processor
|
|||
*/
|
||||
private static function removeImplicitMentionsFromBody($body, array $potential_mentions)
|
||||
{
|
||||
if (Config::get('system', 'disable_implicit_mentions')) {
|
||||
if (DI::config()->get('system', 'disable_implicit_mentions')) {
|
||||
return $body;
|
||||
}
|
||||
|
||||
|
|
@ -962,7 +961,7 @@ class Processor
|
|||
|
||||
private static function convertImplicitMentionsInTags($activity_tags, array $potential_mentions)
|
||||
{
|
||||
if (Config::get('system', 'disable_implicit_mentions')) {
|
||||
if (DI::config()->get('system', 'disable_implicit_mentions')) {
|
||||
return $activity_tags;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ use Friendica\Content\Feature;
|
|||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Text\Plaintext;
|
||||
use Friendica\Core\Cache\Duration;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
|
|
@ -363,11 +362,11 @@ class Transmitter
|
|||
}
|
||||
}
|
||||
|
||||
if (Config::get('system', 'ap_always_bcc')) {
|
||||
if (DI::config()->get('system', 'ap_always_bcc')) {
|
||||
$always_bcc = true;
|
||||
}
|
||||
|
||||
if (self::isAnnounce($item) || Config::get('debug', 'total_ap_delivery')) {
|
||||
if (self::isAnnounce($item) || DI::config()->get('debug', 'total_ap_delivery')) {
|
||||
// Will be activated in a later step
|
||||
$networks = Protocol::FEDERATED;
|
||||
} else {
|
||||
|
|
@ -548,7 +547,7 @@ class Transmitter
|
|||
{
|
||||
$inboxes = [];
|
||||
|
||||
if (Config::get('debug', 'total_ap_delivery')) {
|
||||
if (DI::config()->get('debug', 'total_ap_delivery')) {
|
||||
// Will be activated in a later step
|
||||
$networks = Protocol::FEDERATED;
|
||||
} else {
|
||||
|
|
@ -1364,7 +1363,7 @@ class Transmitter
|
|||
}
|
||||
|
||||
// And finally just use the system language
|
||||
return Config::get('system', 'language');
|
||||
return DI::config()->get('system', 'language');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1689,7 +1688,7 @@ class Transmitter
|
|||
|
||||
if (empty($uid)) {
|
||||
// Fetch the list of administrators
|
||||
$admin_mail = explode(',', str_replace(' ', '', Config::get('config', 'admin_email')));
|
||||
$admin_mail = explode(',', str_replace(' ', '', DI::config()->get('config', 'admin_email')));
|
||||
|
||||
// We need to use some user as a sender. It doesn't care who it will send. We will use an administrator account.
|
||||
$condition = ['verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false, 'email' => $admin_mail];
|
||||
|
|
@ -1837,7 +1836,7 @@ class Transmitter
|
|||
|
||||
private static function prependMentions($body, array $permission_block)
|
||||
{
|
||||
if (Config::get('system', 'disable_implicit_mentions')) {
|
||||
if (DI::config()->get('system', 'disable_implicit_mentions')) {
|
||||
return $body;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ use Friendica\App\BaseURL;
|
|||
use Friendica\Content\OEmbed;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
|
|
@ -489,11 +488,11 @@ class DFRN
|
|||
{
|
||||
|
||||
/* get site pubkey. this could be a new installation with no site keys*/
|
||||
$pubkey = Config::get('system', 'site_pubkey');
|
||||
$pubkey = DI::config()->get('system', 'site_pubkey');
|
||||
if (! $pubkey) {
|
||||
$res = Crypto::newKeypair(1024);
|
||||
Config::set('system', 'site_prvkey', $res['prvkey']);
|
||||
Config::set('system', 'site_pubkey', $res['pubkey']);
|
||||
DI::config()->set('system', 'site_prvkey', $res['prvkey']);
|
||||
DI::config()->set('system', 'site_pubkey', $res['pubkey']);
|
||||
}
|
||||
|
||||
$rp = q(
|
||||
|
|
@ -527,7 +526,7 @@ class DFRN
|
|||
XML::addElement($doc, $relocate, "dfrn:confirm", $owner['confirm']);
|
||||
XML::addElement($doc, $relocate, "dfrn:notify", $owner['notify']);
|
||||
XML::addElement($doc, $relocate, "dfrn:poll", $owner['poll']);
|
||||
XML::addElement($doc, $relocate, "dfrn:sitepubkey", Config::get('system', 'site_pubkey'));
|
||||
XML::addElement($doc, $relocate, "dfrn:sitepubkey", DI::config()->get('system', 'site_pubkey'));
|
||||
|
||||
$root->appendChild($relocate);
|
||||
|
||||
|
|
@ -1192,12 +1191,12 @@ class DFRN
|
|||
$idtosend = '1:' . $orig_id;
|
||||
}
|
||||
|
||||
$rino = Config::get('system', 'rino_encrypt');
|
||||
$rino = DI::config()->get('system', 'rino_encrypt');
|
||||
$rino = intval($rino);
|
||||
|
||||
Logger::log("Local rino version: ". $rino, Logger::DEBUG);
|
||||
|
||||
$ssl_val = intval(Config::get('system', 'ssl_policy'));
|
||||
$ssl_val = intval(DI::config()->get('system', 'ssl_policy'));
|
||||
|
||||
switch ($ssl_val) {
|
||||
case BaseURL::SSL_POLICY_FULL:
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ use Friendica\Content\Feature;
|
|||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Text\Markdown;
|
||||
use Friendica\Core\Cache\Duration;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
|
|
@ -91,7 +90,7 @@ class Diaspora
|
|||
$serverlist = [];
|
||||
|
||||
// Fetching relay servers
|
||||
$serverdata = Config::get("system", "relay_server");
|
||||
$serverdata = DI::config()->get("system", "relay_server");
|
||||
|
||||
if (!empty($serverdata)) {
|
||||
$servers = explode(",", $serverdata);
|
||||
|
|
@ -100,7 +99,7 @@ class Diaspora
|
|||
}
|
||||
}
|
||||
|
||||
if (Config::get("system", "relay_directly", false)) {
|
||||
if (DI::config()->get("system", "relay_directly", false)) {
|
||||
// We distribute our stuff based on the parent to ensure that the thread will be complete
|
||||
$parent = Item::selectFirst(['parent'], ['id' => $item_id]);
|
||||
if (!DBA::isResult($parent)) {
|
||||
|
|
@ -668,7 +667,7 @@ class Diaspora
|
|||
*/
|
||||
public static function dispatchPublic($msg)
|
||||
{
|
||||
$enabled = intval(Config::get("system", "diaspora_enabled"));
|
||||
$enabled = intval(DI::config()->get("system", "diaspora_enabled"));
|
||||
if (!$enabled) {
|
||||
Logger::log("diaspora is disabled");
|
||||
return false;
|
||||
|
|
@ -3133,7 +3132,7 @@ class Diaspora
|
|||
*/
|
||||
private static function transmit(array $owner, array $contact, $envelope, $public_batch, $guid = "")
|
||||
{
|
||||
$enabled = intval(Config::get("system", "diaspora_enabled"));
|
||||
$enabled = intval(DI::config()->get("system", "diaspora_enabled"));
|
||||
if (!$enabled) {
|
||||
return 200;
|
||||
}
|
||||
|
|
@ -3160,7 +3159,7 @@ class Diaspora
|
|||
|
||||
Logger::log("transmit: ".$logid."-".$guid." ".$dest_url);
|
||||
|
||||
if (!intval(Config::get("system", "diaspora_test"))) {
|
||||
if (!intval(DI::config()->get("system", "diaspora_test"))) {
|
||||
$content_type = (($public_batch) ? "application/magic-envelope+xml" : "application/json");
|
||||
|
||||
$postResult = Network::post($dest_url."/", $envelope, ["Content-Type: ".$content_type]);
|
||||
|
|
@ -3772,7 +3771,7 @@ class Diaspora
|
|||
if (
|
||||
$item['author-id'] != $thread_parent_item['author-id']
|
||||
&& (empty($item['uid']) || !Feature::isEnabled($item['uid'], 'explicit_mentions'))
|
||||
&& !Config::get('system', 'disable_implicit_mentions')
|
||||
&& !DI::config()->get('system', 'disable_implicit_mentions')
|
||||
) {
|
||||
$body = self::prependParentAuthorMention($body, $thread_parent_item['author-link']);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ use DOMXPath;
|
|||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\Cache\Duration;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Database\DBA;
|
||||
|
|
@ -1289,7 +1288,7 @@ class OStatus
|
|||
XML::addElement($doc, $root, "generator", FRIENDICA_PLATFORM, $attributes);
|
||||
XML::addElement($doc, $root, "id", DI::baseUrl() . "/profile/" . $owner["nick"]);
|
||||
XML::addElement($doc, $root, "title", $title);
|
||||
XML::addElement($doc, $root, "subtitle", sprintf("Updates from %s on %s", $owner["name"], Config::get('config', 'sitename')));
|
||||
XML::addElement($doc, $root, "subtitle", sprintf("Updates from %s on %s", $owner["name"], DI::config()->get('config', 'sitename')));
|
||||
XML::addElement($doc, $root, "logo", $owner["photo"]);
|
||||
XML::addElement($doc, $root, "updated", DateTimeFormat::utcNow(DateTimeFormat::ATOM));
|
||||
|
||||
|
|
@ -1383,7 +1382,7 @@ class OStatus
|
|||
break;
|
||||
}
|
||||
|
||||
if (!Config::get('system', 'ostatus_not_attach_preview') && ($siteinfo["type"] != "photo") && isset($siteinfo["image"])) {
|
||||
if (!DI::config()->get('system', 'ostatus_not_attach_preview') && ($siteinfo["type"] != "photo") && isset($siteinfo["image"])) {
|
||||
$imgdata = Images::getInfoFromURLCached($siteinfo["image"]);
|
||||
if ($imgdata) {
|
||||
$attributes = ["rel" => "enclosure",
|
||||
|
|
@ -2226,7 +2225,7 @@ class OStatus
|
|||
$root = self::addHeader($doc, $owner, $filter, $feed_mode);
|
||||
|
||||
foreach ($items as $item) {
|
||||
if (Config::get('system', 'ostatus_debug')) {
|
||||
if (DI::config()->get('system', 'ostatus_debug')) {
|
||||
$item['body'] .= '🍼';
|
||||
}
|
||||
|
||||
|
|
@ -2263,7 +2262,7 @@ class OStatus
|
|||
$doc = new DOMDocument('1.0', 'utf-8');
|
||||
$doc->formatOutput = true;
|
||||
|
||||
if (Config::get('system', 'ostatus_debug')) {
|
||||
if (DI::config()->get('system', 'ostatus_debug')) {
|
||||
$item['body'] .= '🐟';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,25 +9,18 @@
|
|||
|
||||
namespace Friendica\Protocol;
|
||||
|
||||
use DOMDocument;
|
||||
use DOMXPath;
|
||||
use Exception;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\GServer;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Module\Register;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
class PortableContact
|
||||
{
|
||||
|
|
@ -295,8 +288,8 @@ class PortableContact
|
|||
self::discoverServer($data, 2);
|
||||
}
|
||||
|
||||
if (Config::get('system', 'poco_discovery') >= self::USERS_GCONTACTS) {
|
||||
$timeframe = Config::get('system', 'poco_discovery_since');
|
||||
if (DI::config()->get('system', 'poco_discovery') >= self::USERS_GCONTACTS) {
|
||||
$timeframe = DI::config()->get('system', 'poco_discovery_since');
|
||||
|
||||
if ($timeframe == 0) {
|
||||
$timeframe = 30;
|
||||
|
|
@ -320,7 +313,7 @@ class PortableContact
|
|||
}
|
||||
}
|
||||
|
||||
if (!$success && !empty($data) && Config::get('system', 'poco_discovery') >= self::USERS_GCONTACTS_FALLBACK) {
|
||||
if (!$success && !empty($data) && DI::config()->get('system', 'poco_discovery') >= self::USERS_GCONTACTS_FALLBACK) {
|
||||
Logger::info("Fetch contacts from users of the server " . $server["nurl"]);
|
||||
self::discoverServerUsers($data, $server);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ namespace Friendica\Util;
|
|||
|
||||
use Exception;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\Cache;
|
||||
|
||||
/**
|
||||
* The ConfigFileLoader loads config-files and stores them in a ConfigCache ( @see ConfigCache )
|
||||
* The ConfigFileLoader loads config-files and stores them in a ConfigCache ( @see Cache )
|
||||
*
|
||||
* It is capable of loading the following config files:
|
||||
* - *.config.php (current)
|
||||
|
|
@ -77,12 +77,12 @@ class ConfigFileLoader
|
|||
* First loads the default value for all the configuration keys, then the legacy configuration files, then the
|
||||
* expected local.config.php
|
||||
*
|
||||
* @param ConfigCache $config The config cache to load to
|
||||
* @param Cache $config The config cache to load to
|
||||
* @param bool $raw Setup the raw config format
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function setupCache(ConfigCache $config, $raw = false)
|
||||
public function setupCache(Cache $config, $raw = false)
|
||||
{
|
||||
// Load static config files first, the order is important
|
||||
$config->load($this->loadStaticConfig('defaults'));
|
||||
|
|
@ -128,13 +128,13 @@ class ConfigFileLoader
|
|||
/**
|
||||
* Tries to load the specified core-configuration into the config cache.
|
||||
*
|
||||
* @param ConfigCache $config The Config cache
|
||||
* @param Cache $config The Config cache
|
||||
*
|
||||
* @return array The config array (empty if no config found)
|
||||
*
|
||||
* @throws Exception if the configuration file isn't readable
|
||||
*/
|
||||
private function loadCoreConfig(ConfigCache $config)
|
||||
private function loadCoreConfig(Cache $config)
|
||||
{
|
||||
// try to load legacy ini-files first
|
||||
foreach ($this->getConfigFiles(true) as $configFile) {
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ namespace Friendica\Util;
|
|||
|
||||
use ASN_BASE;
|
||||
use ASNValue;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
|
||||
/**
|
||||
* Crypto class
|
||||
|
|
@ -240,7 +240,7 @@ class Crypto
|
|||
'encrypt_key' => false
|
||||
];
|
||||
|
||||
$conf = Config::get('system', 'openssl_conf_file');
|
||||
$conf = DI::config()->get('system', 'openssl_conf_file');
|
||||
if ($conf) {
|
||||
$openssl_options['config'] = $conf;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
namespace Friendica\Util;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\DI;
|
||||
|
|
@ -81,7 +80,7 @@ class Emailer
|
|||
$multipartMessageBody .=
|
||||
"--" . $mimeBoundary . "--\n"; // message ending
|
||||
|
||||
if (Config::get("system", "sendmail_params", true)) {
|
||||
if (DI::config()->get("system", "sendmail_params", true)) {
|
||||
$sendmail_params = '-f ' . $params['fromEmail'];
|
||||
} else {
|
||||
$sendmail_params = null;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@
|
|||
|
||||
namespace Friendica\Util;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\User;
|
||||
|
|
@ -50,7 +49,7 @@ class ExAuth
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->bDebug = (int) Config::get('jabber', 'debug');
|
||||
$this->bDebug = (int) DI::config()->get('jabber', 'debug');
|
||||
|
||||
openlog('auth_ejabberd', LOG_PID, LOG_USER);
|
||||
|
||||
|
|
@ -305,7 +304,7 @@ class ExAuth
|
|||
|
||||
$this->host = $host;
|
||||
|
||||
$lockpath = Config::get('jabber', 'lockpath');
|
||||
$lockpath = DI::config()->get('jabber', 'lockpath');
|
||||
if (is_null($lockpath)) {
|
||||
$this->writeLog(LOG_INFO, 'No lockpath defined.');
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
namespace Friendica\Util;
|
||||
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Model\APContact;
|
||||
|
||||
|
|
@ -233,7 +233,7 @@ class HTTPSignature
|
|||
$iv = $key = $alg = $data = null;
|
||||
|
||||
if (!$prvkey) {
|
||||
$prvkey = Config::get('system', 'prvkey');
|
||||
$prvkey = DI::config()->get('system', 'prvkey');
|
||||
}
|
||||
|
||||
$matches = [];
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ namespace Friendica\Util;
|
|||
|
||||
use DOMDocument;
|
||||
use DomXPath;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
|
|
@ -151,7 +150,7 @@ class Network
|
|||
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
@curl_setopt($ch, CURLOPT_USERAGENT, $a->getUserAgent());
|
||||
|
||||
$range = intval(Config::get('system', 'curl_range_bytes', 0));
|
||||
$range = intval(DI::config()->get('system', 'curl_range_bytes', 0));
|
||||
|
||||
if ($range > 0) {
|
||||
@curl_setopt($ch, CURLOPT_RANGE, '0-' . $range);
|
||||
|
|
@ -173,33 +172,33 @@ class Network
|
|||
if (!empty($opts['timeout'])) {
|
||||
@curl_setopt($ch, CURLOPT_TIMEOUT, $opts['timeout']);
|
||||
} else {
|
||||
$curl_time = Config::get('system', 'curl_timeout', 60);
|
||||
$curl_time = DI::config()->get('system', 'curl_timeout', 60);
|
||||
@curl_setopt($ch, CURLOPT_TIMEOUT, intval($curl_time));
|
||||
}
|
||||
|
||||
// by default we will allow self-signed certs
|
||||
// but you can override this
|
||||
|
||||
$check_cert = Config::get('system', 'verifyssl');
|
||||
$check_cert = DI::config()->get('system', 'verifyssl');
|
||||
@curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, (($check_cert) ? true : false));
|
||||
|
||||
if ($check_cert) {
|
||||
@curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
||||
}
|
||||
|
||||
$proxy = Config::get('system', 'proxy');
|
||||
$proxy = DI::config()->get('system', 'proxy');
|
||||
|
||||
if (strlen($proxy)) {
|
||||
@curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
|
||||
@curl_setopt($ch, CURLOPT_PROXY, $proxy);
|
||||
$proxyuser = @Config::get('system', 'proxyuser');
|
||||
$proxyuser = @DI::config()->get('system', 'proxyuser');
|
||||
|
||||
if (strlen($proxyuser)) {
|
||||
@curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyuser);
|
||||
}
|
||||
}
|
||||
|
||||
if (Config::get('system', 'ipv4_resolve', false)) {
|
||||
if (DI::config()->get('system', 'ipv4_resolve', false)) {
|
||||
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
|
||||
}
|
||||
|
||||
|
|
@ -273,14 +272,14 @@ class Network
|
|||
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, $a->getUserAgent());
|
||||
|
||||
if (Config::get('system', 'ipv4_resolve', false)) {
|
||||
if (DI::config()->get('system', 'ipv4_resolve', false)) {
|
||||
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
|
||||
}
|
||||
|
||||
if (intval($timeout)) {
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
|
||||
} else {
|
||||
$curl_time = Config::get('system', 'curl_timeout', 60);
|
||||
$curl_time = DI::config()->get('system', 'curl_timeout', 60);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, intval($curl_time));
|
||||
}
|
||||
|
||||
|
|
@ -288,19 +287,19 @@ class Network
|
|||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
}
|
||||
|
||||
$check_cert = Config::get('system', 'verifyssl');
|
||||
$check_cert = DI::config()->get('system', 'verifyssl');
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, (($check_cert) ? true : false));
|
||||
|
||||
if ($check_cert) {
|
||||
@curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
||||
}
|
||||
|
||||
$proxy = Config::get('system', 'proxy');
|
||||
$proxy = DI::config()->get('system', 'proxy');
|
||||
|
||||
if (strlen($proxy)) {
|
||||
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
|
||||
curl_setopt($ch, CURLOPT_PROXY, $proxy);
|
||||
$proxyuser = Config::get('system', 'proxyuser');
|
||||
$proxyuser = DI::config()->get('system', 'proxyuser');
|
||||
if (strlen($proxyuser)) {
|
||||
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyuser);
|
||||
}
|
||||
|
|
@ -368,7 +367,7 @@ class Network
|
|||
*/
|
||||
public static function isUrlValid(string $url)
|
||||
{
|
||||
if (Config::get('system', 'disable_url_validation')) {
|
||||
if (DI::config()->get('system', 'disable_url_validation')) {
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
|
@ -399,7 +398,7 @@ class Network
|
|||
*/
|
||||
public static function isEmailDomainValid(string $addr)
|
||||
{
|
||||
if (Config::get('system', 'disable_email_validation')) {
|
||||
if (DI::config()->get('system', 'disable_email_validation')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -436,7 +435,7 @@ class Network
|
|||
return false;
|
||||
}
|
||||
|
||||
$str_allowed = Config::get('system', 'allowed_sites');
|
||||
$str_allowed = DI::config()->get('system', 'allowed_sites');
|
||||
if (! $str_allowed) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -480,7 +479,7 @@ class Network
|
|||
return false;
|
||||
}
|
||||
|
||||
$domain_blocklist = Config::get('system', 'blocklist', []);
|
||||
$domain_blocklist = DI::config()->get('system', 'blocklist', []);
|
||||
if (!$domain_blocklist) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -511,7 +510,7 @@ class Network
|
|||
return false;
|
||||
}
|
||||
|
||||
$str_allowed = Config::get('system', 'allowed_email', '');
|
||||
$str_allowed = DI::config()->get('system', 'allowed_email', '');
|
||||
if (empty($str_allowed)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace Friendica\Util;
|
||||
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
|
@ -47,18 +47,18 @@ class Profiler implements ContainerInterface
|
|||
/**
|
||||
* Updates the enabling of the current profiler
|
||||
*
|
||||
* @param IConfiguration $config
|
||||
* @param IConfig $config
|
||||
*/
|
||||
public function update(IConfiguration $config)
|
||||
public function update(IConfig $config)
|
||||
{
|
||||
$this->enabled = $config->get('system', 'profiler');
|
||||
$this->rendertime = $config->get('rendertime', 'callstack');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ConfigCache $configCache The configuration cache
|
||||
* @param Cache $configCache The configuration cache
|
||||
*/
|
||||
public function __construct(ConfigCache $configCache)
|
||||
public function __construct(Cache $configCache)
|
||||
{
|
||||
$this->enabled = $configCache->get('system', 'profiler');
|
||||
$this->rendertime = $configCache->get('rendertime', 'callstack');
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Friendica\Util;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\DI;
|
||||
|
||||
/**
|
||||
|
|
@ -80,7 +79,7 @@ class Proxy
|
|||
}
|
||||
|
||||
// Is the proxy disabled?
|
||||
if (Config::get('system', 'proxy_disabled')) {
|
||||
if (DI::config()->get('system', 'proxy_disabled')) {
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@
|
|||
**/
|
||||
namespace Friendica\Worker;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Network;
|
||||
|
||||
/**
|
||||
|
|
@ -24,7 +24,7 @@ class CheckVersion
|
|||
{
|
||||
Logger::log('checkversion: start');
|
||||
|
||||
$checkurl = Config::get('system', 'check_new_version_url', 'none');
|
||||
$checkurl = DI::config()->get('system', 'check_new_version_url', 'none');
|
||||
|
||||
switch ($checkurl) {
|
||||
case 'master':
|
||||
|
|
@ -43,7 +43,7 @@ class CheckVersion
|
|||
$gitversion = DBA::escape(trim(Network::fetchUrl($checked_url)));
|
||||
Logger::log("Upstream VERSION is: ".$gitversion, Logger::DEBUG);
|
||||
|
||||
Config::set('system', 'git_friendica_version', $gitversion);
|
||||
DI::config()->set('system', 'git_friendica_version', $gitversion);
|
||||
|
||||
Logger::log('checkversion: end');
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
namespace Friendica\Worker;
|
||||
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
|
|
@ -21,9 +20,9 @@ class Cron
|
|||
{
|
||||
$a = DI::app();
|
||||
|
||||
$last = Config::get('system', 'last_cron');
|
||||
$last = DI::config()->get('system', 'last_cron');
|
||||
|
||||
$poll_interval = intval(Config::get('system', 'cron_interval'));
|
||||
$poll_interval = intval(DI::config()->get('system', 'cron_interval'));
|
||||
|
||||
if ($last) {
|
||||
$next = $last + ($poll_interval * 60);
|
||||
|
|
@ -60,7 +59,7 @@ class Cron
|
|||
Worker::add(PRIORITY_LOW, "CronJobs", "repair_database");
|
||||
|
||||
// once daily run birthday_updates and then expire in background
|
||||
$d1 = Config::get('system', 'last_expire_day');
|
||||
$d1 = DI::config()->get('system', 'last_expire_day');
|
||||
$d2 = intval(DateTimeFormat::utcNow('d'));
|
||||
|
||||
// Daily cron calls
|
||||
|
|
@ -86,21 +85,21 @@ class Cron
|
|||
|
||||
self::checkdeletedContacts();
|
||||
|
||||
Config::set('system', 'last_expire_day', $d2);
|
||||
DI::config()->set('system', 'last_expire_day', $d2);
|
||||
}
|
||||
|
||||
// Hourly cron calls
|
||||
if (Config::get('system', 'last_cron_hourly', 0) + 3600 < time()) {
|
||||
if (DI::config()->get('system', 'last_cron_hourly', 0) + 3600 < time()) {
|
||||
|
||||
// Delete all done workerqueue entries
|
||||
DBA::delete('workerqueue', ['`done` AND `executed` < UTC_TIMESTAMP() - INTERVAL 1 HOUR']);
|
||||
|
||||
// Optimizing this table only last seconds
|
||||
if (Config::get('system', 'optimize_workerqueue', false)) {
|
||||
if (DI::config()->get('system', 'optimize_workerqueue', false)) {
|
||||
DBA::e("OPTIMIZE TABLE `workerqueue`");
|
||||
}
|
||||
|
||||
Config::set('system', 'last_cron_hourly', time());
|
||||
DI::config()->set('system', 'last_cron_hourly', time());
|
||||
}
|
||||
|
||||
// Ensure to have a .htaccess file.
|
||||
|
|
@ -118,7 +117,7 @@ class Cron
|
|||
|
||||
Logger::log('cron: end');
|
||||
|
||||
Config::set('system', 'last_cron', time());
|
||||
DI::config()->set('system', 'last_cron', time());
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -169,7 +168,7 @@ class Cron
|
|||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
private static function pollContacts() {
|
||||
$min_poll_interval = Config::get('system', 'min_poll_interval', 1);
|
||||
$min_poll_interval = DI::config()->get('system', 'min_poll_interval', 1);
|
||||
|
||||
Addon::reload();
|
||||
|
||||
|
|
@ -188,7 +187,7 @@ class Cron
|
|||
// Only poll from those with suitable relationships,
|
||||
// and which have a polling address and ignore Diaspora since
|
||||
// we are unable to match those posts with a Diaspora GUID and prevent duplicates.
|
||||
$abandon_days = intval(Config::get('system', 'account_abandon_days'));
|
||||
$abandon_days = intval(DI::config()->get('system', 'account_abandon_days'));
|
||||
if ($abandon_days < 1) {
|
||||
$abandon_days = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,10 +5,8 @@
|
|||
namespace Friendica\Worker;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\StorageManager;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\PostUpdate;
|
||||
|
|
@ -139,7 +137,7 @@ class CronJobs
|
|||
*/
|
||||
private static function clearCache(App $a)
|
||||
{
|
||||
$last = Config::get('system', 'cache_last_cleared');
|
||||
$last = DI::config()->get('system', 'cache_last_cleared');
|
||||
|
||||
if ($last) {
|
||||
$next = $last + (3600); // Once per hour
|
||||
|
|
@ -165,10 +163,10 @@ class CronJobs
|
|||
clear_cache($a->getBasePath() . "/view/smarty3/compiled", $a->getBasePath() . "/view/smarty3/compiled");
|
||||
|
||||
// clear cache for image proxy
|
||||
if (!Config::get("system", "proxy_disabled")) {
|
||||
if (!DI::config()->get("system", "proxy_disabled")) {
|
||||
clear_cache($a->getBasePath(), $a->getBasePath() . "/proxy");
|
||||
|
||||
$cachetime = Config::get('system', 'proxy_cache_time');
|
||||
$cachetime = DI::config()->get('system', 'proxy_cache_time');
|
||||
|
||||
if (!$cachetime) {
|
||||
$cachetime = ProxyUtils::DEFAULT_TIME;
|
||||
|
|
@ -185,13 +183,13 @@ class CronJobs
|
|||
DBA::delete('parsed_url', ["`created` < NOW() - INTERVAL 3 MONTH"]);
|
||||
|
||||
// Maximum table size in megabyte
|
||||
$max_tablesize = intval(Config::get('system', 'optimize_max_tablesize')) * 1000000;
|
||||
$max_tablesize = intval(DI::config()->get('system', 'optimize_max_tablesize')) * 1000000;
|
||||
if ($max_tablesize == 0) {
|
||||
$max_tablesize = 100 * 1000000; // Default are 100 MB
|
||||
}
|
||||
if ($max_tablesize > 0) {
|
||||
// Minimum fragmentation level in percent
|
||||
$fragmentation_level = intval(Config::get('system', 'optimize_fragmentation')) / 100;
|
||||
$fragmentation_level = intval(DI::config()->get('system', 'optimize_fragmentation')) / 100;
|
||||
if ($fragmentation_level == 0) {
|
||||
$fragmentation_level = 0.3; // Default value is 30%
|
||||
}
|
||||
|
|
@ -226,7 +224,7 @@ class CronJobs
|
|||
}
|
||||
}
|
||||
|
||||
Config::set('system', 'cache_last_cleared', time());
|
||||
DI::config()->set('system', 'cache_last_cleared', time());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -6,15 +6,15 @@
|
|||
|
||||
namespace Friendica\Worker;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
||||
class DBClean {
|
||||
public static function execute($stage = 0) {
|
||||
|
||||
if (!Config::get('system', 'dbclean', false)) {
|
||||
if (!DI::config()->get('system', 'dbclean', false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -30,12 +30,12 @@ class DBClean {
|
|||
*/
|
||||
private static function forkCleanProcess() {
|
||||
// Get the expire days for step 8 and 9
|
||||
$days = Config::get('system', 'dbclean-expire-days', 0);
|
||||
$days = DI::config()->get('system', 'dbclean-expire-days', 0);
|
||||
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
// Execute the background script for a step when it isn't finished.
|
||||
// Execute step 8 and 9 only when $days is defined.
|
||||
if (!Config::get('system', 'finished-dbclean-'.$i, false) && (($i < 8) || ($i > 9) || ($days > 0))) {
|
||||
if (!DI::config()->get('system', 'finished-dbclean-'.$i, false) && (($i < 8) || ($i > 9) || ($days > 0))) {
|
||||
Worker::add(PRIORITY_LOW, 'DBClean', $i);
|
||||
}
|
||||
}
|
||||
|
|
@ -62,11 +62,11 @@ class DBClean {
|
|||
*/
|
||||
private static function removeOrphans($stage) {
|
||||
// We split the deletion in many small tasks
|
||||
$limit = Config::get('system', 'dbclean-expire-limit', 1000);
|
||||
$limit = DI::config()->get('system', 'dbclean-expire-limit', 1000);
|
||||
|
||||
// Get the expire days for step 8 and 9
|
||||
$days = Config::get('system', 'dbclean-expire-days', 0);
|
||||
$days_unclaimed = Config::get('system', 'dbclean-expire-unclaimed', 90);
|
||||
$days = DI::config()->get('system', 'dbclean-expire-days', 0);
|
||||
$days_unclaimed = DI::config()->get('system', 'dbclean-expire-unclaimed', 90);
|
||||
|
||||
if ($days_unclaimed == 0) {
|
||||
$days_unclaimed = $days;
|
||||
|
|
@ -77,7 +77,7 @@ class DBClean {
|
|||
return;
|
||||
}
|
||||
|
||||
$last_id = Config::get('system', 'dbclean-last-id-1', 0);
|
||||
$last_id = DI::config()->get('system', 'dbclean-last-id-1', 0);
|
||||
|
||||
Logger::log("Deleting old global item entries from item table without user copy. Last ID: ".$last_id);
|
||||
$r = DBA::p("SELECT `id` FROM `item` WHERE `uid` = 0 AND
|
||||
|
|
@ -98,9 +98,9 @@ class DBClean {
|
|||
DBA::close($r);
|
||||
Logger::log("Done deleting ".$count." old global item entries from item table without user copy. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-1', $last_id);
|
||||
DI::config()->set('system', 'dbclean-last-id-1', $last_id);
|
||||
} elseif ($stage == 2) {
|
||||
$last_id = Config::get('system', 'dbclean-last-id-2', 0);
|
||||
$last_id = DI::config()->get('system', 'dbclean-last-id-2', 0);
|
||||
|
||||
Logger::log("Deleting items without parents. Last ID: ".$last_id);
|
||||
$r = DBA::p("SELECT `id` FROM `item`
|
||||
|
|
@ -120,13 +120,13 @@ class DBClean {
|
|||
DBA::close($r);
|
||||
Logger::log("Done deleting ".$count." items without parents. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-2', $last_id);
|
||||
DI::config()->set('system', 'dbclean-last-id-2', $last_id);
|
||||
|
||||
if ($count < $limit) {
|
||||
Config::set('system', 'finished-dbclean-2', true);
|
||||
DI::config()->set('system', 'finished-dbclean-2', true);
|
||||
}
|
||||
} elseif ($stage == 3) {
|
||||
$last_id = Config::get('system', 'dbclean-last-id-3', 0);
|
||||
$last_id = DI::config()->get('system', 'dbclean-last-id-3', 0);
|
||||
|
||||
Logger::log("Deleting orphaned data from thread table. Last ID: ".$last_id);
|
||||
$r = DBA::p("SELECT `iid` FROM `thread`
|
||||
|
|
@ -146,13 +146,13 @@ class DBClean {
|
|||
DBA::close($r);
|
||||
Logger::log("Done deleting ".$count." orphaned data from thread table. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-3', $last_id);
|
||||
DI::config()->set('system', 'dbclean-last-id-3', $last_id);
|
||||
|
||||
if ($count < $limit) {
|
||||
Config::set('system', 'finished-dbclean-3', true);
|
||||
DI::config()->set('system', 'finished-dbclean-3', true);
|
||||
}
|
||||
} elseif ($stage == 4) {
|
||||
$last_id = Config::get('system', 'dbclean-last-id-4', 0);
|
||||
$last_id = DI::config()->get('system', 'dbclean-last-id-4', 0);
|
||||
|
||||
Logger::log("Deleting orphaned data from notify table. Last ID: ".$last_id);
|
||||
$r = DBA::p("SELECT `iid`, `id` FROM `notify`
|
||||
|
|
@ -172,13 +172,13 @@ class DBClean {
|
|||
DBA::close($r);
|
||||
Logger::log("Done deleting ".$count." orphaned data from notify table. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-4', $last_id);
|
||||
DI::config()->set('system', 'dbclean-last-id-4', $last_id);
|
||||
|
||||
if ($count < $limit) {
|
||||
Config::set('system', 'finished-dbclean-4', true);
|
||||
DI::config()->set('system', 'finished-dbclean-4', true);
|
||||
}
|
||||
} elseif ($stage == 5) {
|
||||
$last_id = Config::get('system', 'dbclean-last-id-5', 0);
|
||||
$last_id = DI::config()->get('system', 'dbclean-last-id-5', 0);
|
||||
|
||||
Logger::log("Deleting orphaned data from notify-threads table. Last ID: ".$last_id);
|
||||
$r = DBA::p("SELECT `id` FROM `notify-threads`
|
||||
|
|
@ -198,13 +198,13 @@ class DBClean {
|
|||
DBA::close($r);
|
||||
Logger::log("Done deleting ".$count." orphaned data from notify-threads table. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-5', $last_id);
|
||||
DI::config()->set('system', 'dbclean-last-id-5', $last_id);
|
||||
|
||||
if ($count < $limit) {
|
||||
Config::set('system', 'finished-dbclean-5', true);
|
||||
DI::config()->set('system', 'finished-dbclean-5', true);
|
||||
}
|
||||
} elseif ($stage == 6) {
|
||||
$last_id = Config::get('system', 'dbclean-last-id-6', 0);
|
||||
$last_id = DI::config()->get('system', 'dbclean-last-id-6', 0);
|
||||
|
||||
Logger::log("Deleting orphaned data from sign table. Last ID: ".$last_id);
|
||||
$r = DBA::p("SELECT `iid`, `id` FROM `sign`
|
||||
|
|
@ -224,13 +224,13 @@ class DBClean {
|
|||
DBA::close($r);
|
||||
Logger::log("Done deleting ".$count." orphaned data from sign table. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-6', $last_id);
|
||||
DI::config()->set('system', 'dbclean-last-id-6', $last_id);
|
||||
|
||||
if ($count < $limit) {
|
||||
Config::set('system', 'finished-dbclean-6', true);
|
||||
DI::config()->set('system', 'finished-dbclean-6', true);
|
||||
}
|
||||
} elseif ($stage == 7) {
|
||||
$last_id = Config::get('system', 'dbclean-last-id-7', 0);
|
||||
$last_id = DI::config()->get('system', 'dbclean-last-id-7', 0);
|
||||
|
||||
Logger::log("Deleting orphaned data from term table. Last ID: ".$last_id);
|
||||
$r = DBA::p("SELECT `oid`, `tid` FROM `term`
|
||||
|
|
@ -250,17 +250,17 @@ class DBClean {
|
|||
DBA::close($r);
|
||||
Logger::log("Done deleting ".$count." orphaned data from term table. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-7', $last_id);
|
||||
DI::config()->set('system', 'dbclean-last-id-7', $last_id);
|
||||
|
||||
if ($count < $limit) {
|
||||
Config::set('system', 'finished-dbclean-7', true);
|
||||
DI::config()->set('system', 'finished-dbclean-7', true);
|
||||
}
|
||||
} elseif ($stage == 8) {
|
||||
if ($days <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$last_id = Config::get('system', 'dbclean-last-id-8', 0);
|
||||
$last_id = DI::config()->get('system', 'dbclean-last-id-8', 0);
|
||||
|
||||
Logger::log("Deleting expired threads. Last ID: ".$last_id);
|
||||
$r = DBA::p("SELECT `thread`.`iid` FROM `thread`
|
||||
|
|
@ -289,14 +289,14 @@ class DBClean {
|
|||
DBA::close($r);
|
||||
Logger::log("Done deleting ".$count." expired threads. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-8', $last_id);
|
||||
DI::config()->set('system', 'dbclean-last-id-8', $last_id);
|
||||
} elseif ($stage == 9) {
|
||||
if ($days <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$last_id = Config::get('system', 'dbclean-last-id-9', 0);
|
||||
$till_id = Config::get('system', 'dbclean-last-id-8', 0);
|
||||
$last_id = DI::config()->get('system', 'dbclean-last-id-9', 0);
|
||||
$till_id = DI::config()->get('system', 'dbclean-last-id-8', 0);
|
||||
|
||||
Logger::log("Deleting old global item entries from expired threads from ID ".$last_id." to ID ".$till_id);
|
||||
$r = DBA::p("SELECT `id` FROM `item` WHERE `uid` = 0 AND
|
||||
|
|
@ -317,10 +317,10 @@ class DBClean {
|
|||
DBA::close($r);
|
||||
Logger::log("Done deleting ".$count." old global item entries from expired threads. Last ID: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-9', $last_id);
|
||||
DI::config()->set('system', 'dbclean-last-id-9', $last_id);
|
||||
} elseif ($stage == 10) {
|
||||
$last_id = Config::get('system', 'dbclean-last-id-10', 0);
|
||||
$days = intval(Config::get('system', 'dbclean_expire_conversation', 90));
|
||||
$last_id = DI::config()->get('system', 'dbclean-last-id-10', 0);
|
||||
$days = intval(DI::config()->get('system', 'dbclean_expire_conversation', 90));
|
||||
|
||||
Logger::log("Deleting old conversations. Last created: ".$last_id);
|
||||
$r = DBA::p("SELECT `received`, `item-uri` FROM `conversation`
|
||||
|
|
@ -340,7 +340,7 @@ class DBClean {
|
|||
DBA::close($r);
|
||||
Logger::log("Done deleting ".$count." conversations. Last created: ".$last_id);
|
||||
|
||||
Config::set('system', 'dbclean-last-id-10', $last_id);
|
||||
DI::config()->set('system', 'dbclean-last-id-10', $last_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
namespace Friendica\Worker;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Update;
|
||||
use Friendica\DI;
|
||||
|
||||
|
|
@ -14,7 +13,7 @@ class DBUpdate
|
|||
public static function execute()
|
||||
{
|
||||
// Just in case the last update wasn't failed
|
||||
if (Config::get('system', 'update', Update::SUCCESS, true) != Update::FAILED) {
|
||||
if (DI::config()->get('system', 'update', Update::SUCCESS, true) != Update::FAILED) {
|
||||
Update::run(DI::app()->getBasePath());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
namespace Friendica\Worker;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Database\DBA;
|
||||
|
|
@ -414,7 +413,7 @@ class Delivery
|
|||
|
||||
Logger::notice('Deliver via Diaspora', ['target' => $target_item['id'], 'guid' => $target_item['guid'], 'to' => $loc]);
|
||||
|
||||
if (Config::get('system', 'dfrn_only') || !Config::get('system', 'diaspora_enabled')) {
|
||||
if (DI::config()->get('system', 'dfrn_only') || !DI::config()->get('system', 'diaspora_enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -495,7 +494,7 @@ class Delivery
|
|||
*/
|
||||
private static function deliverMail($cmd, $contact, $owner, $target_item, $thr_parent)
|
||||
{
|
||||
if (Config::get('system','dfrn_only')) {
|
||||
if (DI::config()->get('system','dfrn_only')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,18 +6,18 @@
|
|||
|
||||
namespace Friendica\Worker;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Network;
|
||||
|
||||
class Directory
|
||||
{
|
||||
public static function execute($url = '')
|
||||
{
|
||||
$dir = Config::get('system', 'directory');
|
||||
$dir = DI::config()->get('system', 'directory');
|
||||
|
||||
if (!strlen($dir)) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
namespace Friendica\Worker;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Worker;
|
||||
|
|
@ -45,7 +44,7 @@ class Expire
|
|||
Logger::log('Orphaned item content deleted: ' . DBA::affectedRows(), Logger::DEBUG);
|
||||
|
||||
// make this optional as it could have a performance impact on large sites
|
||||
if (intval(Config::get('system', 'optimize_items'))) {
|
||||
if (intval(DI::config()->get('system', 'optimize_items'))) {
|
||||
DBA::e("OPTIMIZE TABLE `item`");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
namespace Friendica\Worker;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
|
|
@ -24,7 +23,6 @@ use Friendica\Protocol\ActivityPub;
|
|||
use Friendica\Protocol\Diaspora;
|
||||
use Friendica\Protocol\OStatus;
|
||||
use Friendica\Protocol\Salmon;
|
||||
use Friendica\Util\ACLFormatter;
|
||||
|
||||
require_once 'include/items.php';
|
||||
|
||||
|
|
@ -318,7 +316,7 @@ class Notifier
|
|||
// If this is a public message and pubmail is set on the parent, include all your email contacts
|
||||
if (
|
||||
function_exists('imap_open')
|
||||
&& !Config::get('system','imap_disabled')
|
||||
&& !DI::config()->get('system','imap_disabled')
|
||||
&& $public_message
|
||||
&& intval($target_item['pubmail'])
|
||||
) {
|
||||
|
|
@ -551,7 +549,7 @@ class Notifier
|
|||
$url_recipients = array_filter($url_recipients);
|
||||
// send salmon slaps to mentioned remote tags (@foo@example.com) in OStatus posts
|
||||
// They are especially used for notifications to OStatus users that don't follow us.
|
||||
if (!Config::get('system', 'dfrn_only') && count($url_recipients) && ($public_message || $push_notify) && !empty($target_item)) {
|
||||
if (!DI::config()->get('system', 'dfrn_only') && count($url_recipients) && ($public_message || $push_notify) && !empty($target_item)) {
|
||||
$slap = OStatus::salmon($target_item, $owner);
|
||||
foreach ($url_recipients as $url) {
|
||||
Logger::log('Salmon delivery of item ' . $target_id . ' to ' . $url);
|
||||
|
|
@ -640,7 +638,7 @@ class Notifier
|
|||
}
|
||||
|
||||
// Skip DFRN when the item will be (forcefully) delivered via AP
|
||||
if (Config::get('debug', 'total_ap_delivery') && ($contact['network'] == Protocol::DFRN) && !empty(APContact::getByURL($contact['url'], false))) {
|
||||
if (DI::config()->get('debug', 'total_ap_delivery') && ($contact['network'] == Protocol::DFRN) && !empty(APContact::getByURL($contact['url'], false))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
namespace Friendica\Worker;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Database\DBA;
|
||||
|
|
@ -87,7 +86,7 @@ class OnePoll
|
|||
}
|
||||
|
||||
// Don't poll if polling is deactivated (But we poll feeds and mails anyway)
|
||||
if (!in_array($protocol, [Protocol::FEED, Protocol::MAIL]) && Config::get('system', 'disable_polling')) {
|
||||
if (!in_array($protocol, [Protocol::FEED, Protocol::MAIL]) && DI::config()->get('system', 'disable_polling')) {
|
||||
Logger::log('Polling is disabled');
|
||||
|
||||
// set the last-update so we don't keep polling
|
||||
|
|
@ -118,7 +117,7 @@ class OnePoll
|
|||
$xml = false;
|
||||
|
||||
if ($contact['subhub']) {
|
||||
$poll_interval = Config::get('system', 'pushpoll_frequency', 3);
|
||||
$poll_interval = DI::config()->get('system', 'pushpoll_frequency', 3);
|
||||
$contact['priority'] = intval($poll_interval);
|
||||
$hub_update = false;
|
||||
|
||||
|
|
@ -447,7 +446,7 @@ class OnePoll
|
|||
{
|
||||
Logger::log("Mail: Fetching for ".$contact['addr'], Logger::DEBUG);
|
||||
|
||||
$mail_disabled = ((function_exists('imap_open') && !Config::get('system', 'imap_disabled')) ? 0 : 1);
|
||||
$mail_disabled = ((function_exists('imap_open') && !DI::config()->get('system', 'imap_disabled')) ? 0 : 1);
|
||||
if ($mail_disabled) {
|
||||
// set the last-update so we don't keep polling
|
||||
self::updateContact($contact, ['last-update' => $updated]);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
namespace Friendica\Worker;
|
||||
|
||||
use Friendica\Core\Cache\Duration;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Search;
|
||||
|
|
@ -22,7 +21,7 @@ class SearchDirectory
|
|||
// <search pattern>: Searches for "search pattern" in the directory.
|
||||
public static function execute($search)
|
||||
{
|
||||
if (!Config::get('system', 'poco_local_search')) {
|
||||
if (!DI::config()->get('system', 'poco_local_search')) {
|
||||
Logger::info('Local search is not enabled');
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
*/
|
||||
namespace Friendica\Worker;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\GServer;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
|
@ -21,7 +21,7 @@ class UpdateGContacts
|
|||
*/
|
||||
public static function execute()
|
||||
{
|
||||
if (!Config::get('system', 'poco_completion')) {
|
||||
if (!DI::config()->get('system', 'poco_completion')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@
|
|||
*/
|
||||
namespace Friendica\Worker;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\GServer;
|
||||
use Friendica\Protocol\PortableContact;
|
||||
|
|
@ -17,7 +16,7 @@ class UpdateServerDirectories
|
|||
*/
|
||||
public static function execute()
|
||||
{
|
||||
if (Config::get('system', 'poco_discovery') == PortableContact::DISABLED) {
|
||||
if (DI::config()->get('system', 'poco_discovery') == PortableContact::DISABLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -25,7 +24,7 @@ class UpdateServerDirectories
|
|||
GServer::discover();
|
||||
|
||||
// Query GNU Social servers for their users ("statistics" addon has to be enabled on the GS server)
|
||||
if (!Config::get('system', 'ostatus_disabled')) {
|
||||
if (!DI::config()->get('system', 'ostatus_disabled')) {
|
||||
GContact::discoverGsUsers();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ return [
|
|||
[Dice::INSTANCE => '$basepath'],
|
||||
],
|
||||
],
|
||||
Config\Cache\ConfigCache::class => [
|
||||
Config\Cache::class => [
|
||||
'instanceOf' => Factory\ConfigFactory::class,
|
||||
'call' => [
|
||||
['createCache', [], Dice::CHAIN_CALL],
|
||||
|
|
@ -72,13 +72,13 @@ return [
|
|||
['determine', [], Dice::CHAIN_CALL],
|
||||
],
|
||||
],
|
||||
Config\IConfiguration::class => [
|
||||
Config\IConfig::class => [
|
||||
'instanceOf' => Factory\ConfigFactory::class,
|
||||
'call' => [
|
||||
['createConfig', [], Dice::CHAIN_CALL],
|
||||
],
|
||||
],
|
||||
Config\IPConfiguration::class => [
|
||||
\Friendica\Core\PConfig\IPConfig::class => [
|
||||
'instanceOf' => Factory\ConfigFactory::class,
|
||||
'call' => [
|
||||
['createPConfig', [], Dice::CHAIN_CALL],
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ trait AppMockTrait
|
|||
protected $app;
|
||||
|
||||
/**
|
||||
* @var MockInterface|Config\IConfiguration The mocked Config Cache
|
||||
* @var MockInterface|Config\IConfig The mocked Config Cache
|
||||
*/
|
||||
protected $configMock;
|
||||
|
||||
|
|
@ -52,9 +52,9 @@ trait AppMockTrait
|
|||
$this->dice = \Mockery::mock(Dice::class)->makePartial();
|
||||
$this->dice = $this->dice->addRules(include __DIR__ . '/../../static/dependencies.config.php');
|
||||
|
||||
$this->configMock = \Mockery::mock(Config\Cache\ConfigCache::class);
|
||||
$this->configMock = \Mockery::mock(Config\Cache::class);
|
||||
$this->dice->shouldReceive('create')
|
||||
->with(Config\Cache\ConfigCache::class)
|
||||
->with(Config\Cache::class)
|
||||
->andReturn($this->configMock);
|
||||
$this->mode = \Mockery::mock(App\Mode::class);
|
||||
$this->dice->shouldReceive('create')
|
||||
|
|
@ -64,9 +64,9 @@ trait AppMockTrait
|
|||
// Disable the adapter
|
||||
$configModel->shouldReceive('isConnected')->andReturn(false);
|
||||
|
||||
$config = new Config\JitConfiguration($this->configMock, $configModel);
|
||||
$config = new Config\JitConfig($this->configMock, $configModel);
|
||||
$this->dice->shouldReceive('create')
|
||||
->with(Config\IConfiguration::class)
|
||||
->with(Config\IConfig::class)
|
||||
->andReturn($config);
|
||||
|
||||
// Mocking App and most used functions
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ use Dice\Dice;
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Cache\ICache;
|
||||
use Friendica\Core\Cache\IMemoryCache;
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\Lock\ILock;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Test\Util\VFSTrait;
|
||||
|
|
@ -59,7 +59,7 @@ class dependencyCheck extends TestCase
|
|||
|
||||
$this->assertInstanceOf(ConfigFileLoader::class, $configFileLoader);
|
||||
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
$configFileLoader->setupCache($configCache);
|
||||
|
||||
$this->assertNotEmpty($configCache->getAll());
|
||||
|
|
@ -77,7 +77,7 @@ class dependencyCheck extends TestCase
|
|||
|
||||
$this->assertInstanceOf(Profiler::class, $profiler);
|
||||
|
||||
$configCache = new ConfigCache([
|
||||
$configCache = new Cache([
|
||||
'system' => [
|
||||
'profiler' => true,
|
||||
],
|
||||
|
|
@ -115,10 +115,10 @@ class dependencyCheck extends TestCase
|
|||
|
||||
public function testConfiguration()
|
||||
{
|
||||
/** @var IConfiguration $config */
|
||||
$config = $this->dice->create(IConfiguration::class);
|
||||
/** @var IConfig $config */
|
||||
$config = $this->dice->create(IConfig::class);
|
||||
|
||||
$this->assertInstanceOf(IConfiguration::class, $config);
|
||||
$this->assertInstanceOf(IConfig::class, $config);
|
||||
|
||||
$this->assertNotEmpty($config->get('database', 'username'));
|
||||
}
|
||||
|
|
@ -133,8 +133,8 @@ class dependencyCheck extends TestCase
|
|||
|
||||
public function testDevLogger()
|
||||
{
|
||||
/** @var IConfiguration $config */
|
||||
$config = $this->dice->create(IConfiguration::class);
|
||||
/** @var IConfig $config */
|
||||
$config = $this->dice->create(IConfig::class);
|
||||
$config->set('system', 'dlogfile', $this->root->url() . '/friendica.log');
|
||||
|
||||
/** @var LoggerInterface $logger */
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ namespace Friendica\Test;
|
|||
|
||||
use Dice\Dice;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IPConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\PConfig\IPConfig;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\Session\ISession;
|
||||
|
|
@ -47,7 +47,7 @@ class ApiTest extends DatabaseTest
|
|||
/** @var App */
|
||||
protected $app;
|
||||
|
||||
/** @var IConfiguration */
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
|
||||
/** @var Dice */
|
||||
|
|
@ -69,8 +69,8 @@ class ApiTest extends DatabaseTest
|
|||
/** @var Database $dba */
|
||||
$dba = $this->dice->create(Database::class);
|
||||
|
||||
/** @var IConfiguration $config */
|
||||
$this->config = $this->dice->create(IConfiguration::class);
|
||||
/** @var IConfig $config */
|
||||
$this->config = $this->dice->create(IConfig::class);
|
||||
|
||||
$this->config->set('system', 'url', 'http://localhost');
|
||||
$this->config->set('system', 'hostname', 'localhost');
|
||||
|
|
@ -827,7 +827,7 @@ class ApiTest extends DatabaseTest
|
|||
*/
|
||||
public function testApiGetUserWithFrioSchema()
|
||||
{
|
||||
$pConfig = $this->dice->create(IPConfiguration::class);
|
||||
$pConfig = $this->dice->create(IPConfig::class);
|
||||
$pConfig->set($this->selfUser['id'], 'frio', 'schema', 'red');
|
||||
$user = api_get_user($this->app);
|
||||
$this->assertSelfUser($user);
|
||||
|
|
@ -843,7 +843,7 @@ class ApiTest extends DatabaseTest
|
|||
*/
|
||||
public function testApiGetUserWithCustomFrioSchema()
|
||||
{
|
||||
$pConfig = $this->dice->create(IPConfiguration::class);
|
||||
$pConfig = $this->dice->create(IPConfig::class);
|
||||
$pConfig->set($this->selfUser['id'], 'frio', 'schema', '---');
|
||||
$pConfig->set($this->selfUser['id'], 'frio', 'nav_bg', '#123456');
|
||||
$pConfig->set($this->selfUser['id'], 'frio', 'link_color', '#123456');
|
||||
|
|
@ -862,7 +862,7 @@ class ApiTest extends DatabaseTest
|
|||
*/
|
||||
public function testApiGetUserWithEmptyFrioSchema()
|
||||
{
|
||||
$pConfig = $this->dice->create(IPConfiguration::class);
|
||||
$pConfig = $this->dice->create(IPConfig::class);
|
||||
$pConfig->set($this->selfUser['id'], 'frio', 'schema', '---');
|
||||
$user = api_get_user($this->app);
|
||||
$this->assertSelfUser($user);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class ModeTest extends MockedTest
|
|||
private $databaseMock;
|
||||
|
||||
/**
|
||||
* @var Config\Cache\ConfigCache|MockInterface
|
||||
* @var \Friendica\Core\Config\Cache|MockInterface
|
||||
*/
|
||||
private $configCacheMock;
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ class ModeTest extends MockedTest
|
|||
|
||||
$this->basePathMock = \Mockery::mock(BasePath::class);
|
||||
$this->databaseMock = \Mockery::mock(Database::class);
|
||||
$this->configCacheMock = \Mockery::mock(Config\Cache\ConfigCache::class);
|
||||
$this->configCacheMock = \Mockery::mock(Config\Cache::class);
|
||||
}
|
||||
|
||||
public function testItEmpty()
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
namespace Friendica\Test\src\App;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\LegacyModule;
|
||||
use Friendica\Module\HTTPException\PageNotFound;
|
||||
use Friendica\Module\WellKnown\HostMeta;
|
||||
|
|
@ -149,10 +150,13 @@ class ModuleTest extends DatabaseTest
|
|||
*/
|
||||
public function testModuleClass($assert, string $name, string $command, bool $privAdd)
|
||||
{
|
||||
$config = \Mockery::mock(IConfiguration::class);
|
||||
$config = \Mockery::mock(IConfig::class);
|
||||
$config->shouldReceive('get')->with('config', 'private_addons', false)->andReturn($privAdd)->atMost()->once();
|
||||
|
||||
$router = (new App\Router([]))->loadRoutes(include __DIR__ . '/../../../static/routes.config.php');
|
||||
$l10n = \Mockery::mock(L10n::class);
|
||||
$l10n->shouldReceive('t')->andReturnUsing(function ($args) { return $args; });
|
||||
|
||||
$router = (new App\Router([], $l10n))->loadRoutes(include __DIR__ . '/../../../static/routes.config.php');
|
||||
|
||||
$module = (new App\Module($name))->determineClass(new App\Arguments('', $command), $router, $config);
|
||||
|
||||
|
|
|
|||
|
|
@ -3,16 +3,29 @@
|
|||
namespace Friendica\Test\src\App;
|
||||
|
||||
use Friendica\App\Router;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Module;
|
||||
use Friendica\Network\HTTPException\MethodNotAllowedException;
|
||||
use Friendica\Network\HTTPException\NotFoundException;
|
||||
use Mockery\MockInterface;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class RouterTest extends TestCase
|
||||
{
|
||||
/** @var L10n|MockInterface */
|
||||
private $l10n;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->l10n = \Mockery::mock(L10n::class);
|
||||
$this->l10n->shouldReceive('t')->andReturnUsing(function ($args) { return $args; });
|
||||
}
|
||||
|
||||
public function testGetModuleClass()
|
||||
{
|
||||
$router = new Router(['REQUEST_METHOD' => Router::GET]);
|
||||
$router = new Router(['REQUEST_METHOD' => Router::GET], $this->l10n);
|
||||
|
||||
$routeCollector = $router->getRouteCollector();
|
||||
$routeCollector->addRoute([Router::GET], '/', 'IndexModuleClassName');
|
||||
|
|
@ -36,7 +49,7 @@ class RouterTest extends TestCase
|
|||
|
||||
public function testPostModuleClass()
|
||||
{
|
||||
$router = new Router(['REQUEST_METHOD' => Router::POST]);
|
||||
$router = new Router(['REQUEST_METHOD' => Router::POST], $this->l10n);
|
||||
|
||||
$routeCollector = $router->getRouteCollector();
|
||||
$routeCollector->addRoute([Router::POST], '/', 'IndexModuleClassName');
|
||||
|
|
@ -62,7 +75,7 @@ class RouterTest extends TestCase
|
|||
{
|
||||
$this->expectException(NotFoundException::class);
|
||||
|
||||
$router = new Router(['REQUEST_METHOD' => Router::GET]);
|
||||
$router = new Router(['REQUEST_METHOD' => Router::GET], $this->l10n);
|
||||
|
||||
$router->getModuleClass('/unsupported');
|
||||
}
|
||||
|
|
@ -71,7 +84,7 @@ class RouterTest extends TestCase
|
|||
{
|
||||
$this->expectException(NotFoundException::class);
|
||||
|
||||
$router = new Router(['REQUEST_METHOD' => Router::GET]);
|
||||
$router = new Router(['REQUEST_METHOD' => Router::GET], $this->l10n);
|
||||
|
||||
$routeCollector = $router->getRouteCollector();
|
||||
$routeCollector->addRoute([Router::GET], '/test', 'TestModuleClassName');
|
||||
|
|
@ -83,7 +96,7 @@ class RouterTest extends TestCase
|
|||
{
|
||||
$this->expectException(NotFoundException::class);
|
||||
|
||||
$router = new Router(['REQUEST_METHOD' => Router::GET]);
|
||||
$router = new Router(['REQUEST_METHOD' => Router::GET], $this->l10n);
|
||||
|
||||
$routeCollector = $router->getRouteCollector();
|
||||
$routeCollector->addRoute([Router::GET], '/optional[/option]', 'OptionalModuleClassName');
|
||||
|
|
@ -95,7 +108,7 @@ class RouterTest extends TestCase
|
|||
{
|
||||
$this->expectException(NotFoundException::class);
|
||||
|
||||
$router = new Router(['REQUEST_METHOD' => Router::GET]);
|
||||
$router = new Router(['REQUEST_METHOD' => Router::GET], $this->l10n);
|
||||
|
||||
$routeCollector = $router->getRouteCollector();
|
||||
$routeCollector->addRoute([Router::GET], '/variable/{var}', 'VariableModuleClassName');
|
||||
|
|
@ -107,7 +120,7 @@ class RouterTest extends TestCase
|
|||
{
|
||||
$this->expectException(MethodNotAllowedException::class);
|
||||
|
||||
$router = new Router(['REQUEST_METHOD' => Router::POST]);
|
||||
$router = new Router(['REQUEST_METHOD' => Router::POST], $this->l10n);
|
||||
|
||||
$routeCollector = $router->getRouteCollector();
|
||||
$routeCollector->addRoute([Router::GET], '/test', 'TestModuleClassName');
|
||||
|
|
@ -119,7 +132,7 @@ class RouterTest extends TestCase
|
|||
{
|
||||
$this->expectException(MethodNotAllowedException::class);
|
||||
|
||||
$router = new Router(['REQUEST_METHOD' => Router::GET]);
|
||||
$router = new Router(['REQUEST_METHOD' => Router::GET], $this->l10n);
|
||||
|
||||
$routeCollector = $router->getRouteCollector();
|
||||
$routeCollector->addRoute([Router::POST], '/test', 'TestModuleClassName');
|
||||
|
|
@ -159,7 +172,7 @@ class RouterTest extends TestCase
|
|||
{
|
||||
$router = (new Router([
|
||||
'REQUEST_METHOD' => Router::GET
|
||||
]))->loadRoutes($routes);
|
||||
], $this->l10n))->loadRoutes($routes);
|
||||
|
||||
$this->assertEquals(Module\Home::class, $router->getModuleClass('/'));
|
||||
$this->assertEquals(Module\Friendica::class, $router->getModuleClass('/group/route'));
|
||||
|
|
@ -174,7 +187,7 @@ class RouterTest extends TestCase
|
|||
{
|
||||
$router = (new Router([
|
||||
'REQUEST_METHOD' => Router::POST
|
||||
]))->loadRoutes($routes);
|
||||
], $this->l10n))->loadRoutes($routes);
|
||||
|
||||
// Don't find GET
|
||||
$this->assertEquals(Module\NodeInfo::class, $router->getModuleClass('/post/it'));
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace Friendica\Test\src\Console;
|
|||
use Dice\Dice;
|
||||
use Friendica\App;
|
||||
use Friendica\Console\AutomaticInstallation;
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Core\Installer;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
|
|
@ -37,7 +37,7 @@ class AutomaticInstallationConsoleTest extends ConsoleTest
|
|||
private $assertFileDb;
|
||||
|
||||
/**
|
||||
* @var ConfigCache The configuration cache to check after each test
|
||||
* @var Cache The configuration cache to check after each test
|
||||
*/
|
||||
private $configCache;
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ class AutomaticInstallationConsoleTest extends ConsoleTest
|
|||
|
||||
DI::init($this->dice);
|
||||
|
||||
$this->configCache = new ConfigCache();
|
||||
$this->configCache = new Cache();
|
||||
$this->configCache->set('system', 'basepath', $this->root->url());
|
||||
$this->configCache->set('config', 'php_path', trim(shell_exec('which php')));
|
||||
$this->configCache->set('system', 'theme', 'smarty3');
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace Friendica\Test\src\Console;
|
|||
use Friendica\App;
|
||||
use Friendica\App\Mode;
|
||||
use Friendica\Console\Config;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Mockery\MockInterface;
|
||||
|
||||
class ConfigConsoleTest extends ConsoleTest
|
||||
|
|
@ -29,7 +29,7 @@ class ConfigConsoleTest extends ConsoleTest
|
|||
$this->appMode->shouldReceive('has')
|
||||
->andReturn(true);
|
||||
|
||||
$this->configMock = \Mockery::mock(IConfiguration::class);
|
||||
$this->configMock = \Mockery::mock(IConfig::class);
|
||||
}
|
||||
|
||||
function testSetGetKeyValue()
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace Friendica\Test\src\Console;
|
||||
|
||||
use Friendica\Console\ServerBlock;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
|
||||
class ServerBlockConsoleTest extends ConsoleTest
|
||||
{
|
||||
|
|
@ -22,7 +22,7 @@ class ServerBlockConsoleTest extends ConsoleTest
|
|||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->configMock = \Mockery::mock(IConfiguration::class);
|
||||
$this->configMock = \Mockery::mock(IConfig::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace Friendica\Test\src\Core\Cache;
|
||||
|
||||
use Friendica\Core\Cache\MemcacheCache;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
|
||||
/**
|
||||
* @requires extension memcache
|
||||
|
|
@ -13,7 +13,7 @@ class MemcacheCacheTest extends MemoryCacheTest
|
|||
{
|
||||
protected function getInstance()
|
||||
{
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
$configMock = \Mockery::mock(IConfig::class);
|
||||
|
||||
$host = $_SERVER['MEMCACHE_HOST'] ?? 'localhost';
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
namespace Friendica\Test\src\Core\Cache;
|
||||
|
||||
use Friendica\Core\Cache\MemcachedCache;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Psr\Log\NullLogger;
|
||||
|
||||
/**
|
||||
|
|
@ -15,7 +15,7 @@ class MemcachedCacheTest extends MemoryCacheTest
|
|||
{
|
||||
protected function getInstance()
|
||||
{
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
$configMock = \Mockery::mock(IConfig::class);
|
||||
|
||||
$host = $_SERVER['MEMCACHED_HOST'] ?? 'localhost';
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
namespace Friendica\Test\src\Core\Cache;
|
||||
|
||||
use Friendica\Core\Cache\RedisCache;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
|
||||
/**
|
||||
* @requires extension redis
|
||||
|
|
@ -14,7 +14,7 @@ class RedisCacheTest extends MemoryCacheTest
|
|||
{
|
||||
protected function getInstance()
|
||||
{
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
$configMock = \Mockery::mock(IConfig::class);
|
||||
|
||||
$host = $_SERVER['REDIS_HOST'] ?? 'localhost';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Test\src\Core\Config\Cache;
|
||||
namespace Friendica\Test\src\Core\Config;
|
||||
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Test\MockedTest;
|
||||
use ParagonIE\HiddenString\HiddenString;
|
||||
|
||||
class ConfigCacheTest extends MockedTest
|
||||
class CacheTest extends MockedTest
|
||||
{
|
||||
public function dataTests()
|
||||
{
|
||||
|
|
@ -29,7 +29,7 @@ class ConfigCacheTest extends MockedTest
|
|||
];
|
||||
}
|
||||
|
||||
private function assertConfigValues($data, ConfigCache $configCache)
|
||||
private function assertConfigValues($data, Cache $configCache)
|
||||
{
|
||||
foreach ($data as $cat => $values) {
|
||||
foreach ($values as $key => $value) {
|
||||
|
|
@ -44,7 +44,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testLoadConfigArray($data)
|
||||
{
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
$configCache->load($data);
|
||||
|
||||
$this->assertConfigValues($data, $configCache);
|
||||
|
|
@ -63,7 +63,7 @@ class ConfigCacheTest extends MockedTest
|
|||
]
|
||||
];
|
||||
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
$configCache->load($data);
|
||||
$configCache->load($override);
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testLoadConfigArrayWrong()
|
||||
{
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
// empty dataset
|
||||
$configCache->load([]);
|
||||
|
|
@ -102,7 +102,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testGetAll($data)
|
||||
{
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
$configCache->load($data);
|
||||
|
||||
$all = $configCache->getAll();
|
||||
|
|
@ -117,7 +117,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testSetGet($data)
|
||||
{
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
foreach ($data as $cat => $values) {
|
||||
foreach ($values as $key => $value) {
|
||||
|
|
@ -133,7 +133,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testGetEmpty()
|
||||
{
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$this->assertNull($configCache->get('something', 'value'));
|
||||
}
|
||||
|
|
@ -143,7 +143,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testGetCat()
|
||||
{
|
||||
$configCache = new ConfigCache([
|
||||
$configCache = new Cache([
|
||||
'system' => [
|
||||
'key1' => 'value1',
|
||||
'key2' => 'value2',
|
||||
|
|
@ -171,7 +171,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testDelete($data)
|
||||
{
|
||||
$configCache = new ConfigCache($data);
|
||||
$configCache = new Cache($data);
|
||||
|
||||
foreach ($data as $cat => $values) {
|
||||
foreach ($values as $key => $value) {
|
||||
|
|
@ -188,7 +188,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testKeyDiffWithResult($data)
|
||||
{
|
||||
$configCache = new ConfigCache($data);
|
||||
$configCache = new Cache($data);
|
||||
|
||||
$diffConfig = [
|
||||
'fakeCat' => [
|
||||
|
|
@ -205,7 +205,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testKeyDiffWithoutResult($data)
|
||||
{
|
||||
$configCache = new ConfigCache($data);
|
||||
$configCache = new Cache($data);
|
||||
|
||||
$diffConfig = $configCache->getAll();
|
||||
|
||||
|
|
@ -217,7 +217,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testPasswordHide()
|
||||
{
|
||||
$configCache = new ConfigCache([
|
||||
$configCache = new Cache([
|
||||
'database' => [
|
||||
'password' => 'supersecure',
|
||||
'username' => 'notsecured',
|
||||
|
|
@ -234,7 +234,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testPasswordShow()
|
||||
{
|
||||
$configCache = new ConfigCache([
|
||||
$configCache = new Cache([
|
||||
'database' => [
|
||||
'password' => 'supersecure',
|
||||
'username' => 'notsecured',
|
||||
|
|
@ -251,7 +251,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testEmptyPassword()
|
||||
{
|
||||
$configCache = new ConfigCache([
|
||||
$configCache = new Cache([
|
||||
'database' => [
|
||||
'password' => '',
|
||||
'username' => '',
|
||||
|
|
@ -265,7 +265,7 @@ class ConfigCacheTest extends MockedTest
|
|||
|
||||
public function testWrongTypePassword()
|
||||
{
|
||||
$configCache = new ConfigCache([
|
||||
$configCache = new Cache([
|
||||
'database' => [
|
||||
'password' => new \stdClass(),
|
||||
'username' => '',
|
||||
|
|
@ -275,7 +275,7 @@ class ConfigCacheTest extends MockedTest
|
|||
$this->assertNotEmpty($configCache->get('database', 'password'));
|
||||
$this->assertEmpty($configCache->get('database', 'username'));
|
||||
|
||||
$configCache = new ConfigCache([
|
||||
$configCache = new Cache([
|
||||
'database' => [
|
||||
'password' => 23,
|
||||
'username' => '',
|
||||
|
|
@ -2,22 +2,22 @@
|
|||
|
||||
namespace Friendica\Test\src\Core\Config;
|
||||
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Model\Config\Config as ConfigModel;
|
||||
use Friendica\Test\MockedTest;
|
||||
use Mockery\MockInterface;
|
||||
use Mockery;
|
||||
|
||||
abstract class ConfigurationTest extends MockedTest
|
||||
abstract class ConfigTest extends MockedTest
|
||||
{
|
||||
/** @var ConfigModel|MockInterface */
|
||||
protected $configModel;
|
||||
|
||||
/** @var ConfigCache */
|
||||
/** @var Cache */
|
||||
protected $configCache;
|
||||
|
||||
/** @var IConfiguration */
|
||||
/** @var IConfig */
|
||||
protected $testedConfig;
|
||||
|
||||
/**
|
||||
|
|
@ -42,11 +42,11 @@ abstract class ConfigurationTest extends MockedTest
|
|||
|
||||
// Create the config model
|
||||
$this->configModel = Mockery::mock(ConfigModel::class);
|
||||
$this->configCache = new ConfigCache();
|
||||
$this->configCache = new Cache();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return IConfiguration
|
||||
* @return IConfig
|
||||
*/
|
||||
public abstract function getInstance();
|
||||
|
||||
|
|
@ -142,7 +142,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
->once();
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(ConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
// assert config is loaded everytime
|
||||
$this->assertConfig('config', $data['config']);
|
||||
|
|
@ -154,7 +154,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
public function testLoad(array $data, array $possibleCats, array $load)
|
||||
{
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(ConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
foreach ($load as $loadedCats) {
|
||||
$this->testedConfig->load($loadedCats);
|
||||
|
|
@ -235,7 +235,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
public function testCacheLoadDouble(array $data1, array $data2, array $expect)
|
||||
{
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(ConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
foreach ($data1 as $cat => $data) {
|
||||
$this->testedConfig->load($cat);
|
||||
|
|
@ -260,7 +260,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
$this->configModel->shouldReceive('load')->withAnyArgs()->andReturn([])->once();
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(ConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
$this->assertEmpty($this->testedConfig->getCache()->getAll());
|
||||
}
|
||||
|
|
@ -277,7 +277,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
->times(3);
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(ConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
$this->assertTrue($this->testedConfig->set('test', 'it', $data));
|
||||
|
||||
|
|
@ -295,7 +295,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
$this->configModel->shouldReceive('set')->with('test', 'it', $data)->andReturn(true)->once();
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(ConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
$this->assertTrue($this->testedConfig->set('test', 'it', $data));
|
||||
|
||||
|
|
@ -309,7 +309,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
public function testGetWrongWithoutDB()
|
||||
{
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(ConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
// without refresh
|
||||
$this->assertNull($this->testedConfig->get('test', 'it'));
|
||||
|
|
@ -334,7 +334,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
$this->configCache->load(['test' => ['it' => 'now']]);
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(ConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
// without refresh
|
||||
$this->assertEquals('now', $this->testedConfig->get('test', 'it'));
|
||||
|
|
@ -359,7 +359,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
$this->configCache->load(['test' => ['it' => $data]]);
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(ConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
$this->assertEquals($data, $this->testedConfig->get('test', 'it'));
|
||||
$this->assertEquals($data, $this->testedConfig->getCache()->get('test', 'it'));
|
||||
|
|
@ -396,7 +396,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
->once();
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(ConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
// directly set the value to the cache
|
||||
$this->testedConfig->getCache()->set('test', 'it', 'now');
|
||||
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
namespace Friendica\Test\src\Core\Config;
|
||||
|
||||
use Friendica\Core\Config\JitConfiguration;
|
||||
use Friendica\Core\Config\JitConfig;
|
||||
|
||||
class JitConfigurationTest extends ConfigurationTest
|
||||
class JitConfigTest extends ConfigTest
|
||||
{
|
||||
public function getInstance()
|
||||
{
|
||||
return new JitConfiguration($this->configCache, $this->configModel);
|
||||
return new JitConfig($this->configCache, $this->configModel);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
namespace Friendica\Test\src\Core\Config;
|
||||
|
||||
use Friendica\Core\Config\PreloadConfiguration;
|
||||
use Friendica\Core\Config\PreloadConfig;
|
||||
|
||||
class PreloadConfigurationTest extends ConfigurationTest
|
||||
class PreloadConfigTest extends ConfigTest
|
||||
{
|
||||
public function getInstance()
|
||||
{
|
||||
return new PreloadConfiguration($this->configCache, $this->configModel);
|
||||
return new PreloadConfig($this->configCache, $this->configModel);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
namespace Friendica\Core;
|
||||
|
||||
use Dice\Dice;
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\CurlResult;
|
||||
use Friendica\Test\MockedTest;
|
||||
|
|
@ -419,7 +419,7 @@ class InstallerTest extends MockedTest
|
|||
$this->l10nMock->shouldReceive('t')->andReturnUsing(function ($args) { return $args; });
|
||||
|
||||
$install = new Installer();
|
||||
$configCache = \Mockery::mock(ConfigCache::class);
|
||||
$configCache = \Mockery::mock(Cache::class);
|
||||
$configCache->shouldReceive('set')->with('config', 'php_path', \Mockery::any())->once();
|
||||
$configCache->shouldReceive('set')->with('system', 'basepath', '/test/')->once();
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
namespace Friendica\Test\src\Core\Lock;
|
||||
|
||||
use Friendica\Core\Cache\MemcacheCache;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\Lock\CacheLock;
|
||||
|
||||
/**
|
||||
|
|
@ -15,7 +15,7 @@ class MemcacheCacheLockTest extends LockTest
|
|||
{
|
||||
protected function getInstance()
|
||||
{
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
$configMock = \Mockery::mock(IConfig::class);
|
||||
|
||||
$host = $_SERVER['MEMCACHE_HOST'] ?? 'localhost';
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
namespace Friendica\Test\src\Core\Lock;
|
||||
|
||||
use Friendica\Core\Cache\MemcachedCache;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\Lock\CacheLock;
|
||||
use Psr\Log\NullLogger;
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ class MemcachedCacheLockTest extends LockTest
|
|||
{
|
||||
protected function getInstance()
|
||||
{
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
$configMock = \Mockery::mock(IConfig::class);
|
||||
|
||||
$host = $_SERVER['MEMCACHED_HOST'] ?? 'localhost';
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
namespace Friendica\Test\src\Core\Lock;
|
||||
|
||||
use Friendica\Core\Cache\RedisCache;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\Lock\CacheLock;
|
||||
|
||||
/**
|
||||
|
|
@ -15,7 +15,7 @@ class RedisCacheLockTest extends LockTest
|
|||
{
|
||||
protected function getInstance()
|
||||
{
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
$configMock = \Mockery::mock(IConfig::class);
|
||||
|
||||
$host = $_SERVER['REDIS_HOST'] ?? 'localhost';
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ namespace Friendica\Test\src\Core\Lock;
|
|||
|
||||
use Dice\Dice;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\JitConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\Config\JitConfig;
|
||||
use Friendica\Core\Lock\SemaphoreLock;
|
||||
use Friendica\DI;
|
||||
use Mockery\MockInterface;
|
||||
|
|
@ -21,12 +21,12 @@ class SemaphoreLockTest extends LockTest
|
|||
$app->shouldReceive('getHostname')->andReturn('friendica.local');
|
||||
$dice->shouldReceive('create')->with(App::class)->andReturn($app);
|
||||
|
||||
$configMock = \Mockery::mock(JitConfiguration::class);
|
||||
$configMock = \Mockery::mock(JitConfig::class);
|
||||
$configMock
|
||||
->shouldReceive('get')
|
||||
->with('system', 'temppath', NULL, false)
|
||||
->with('system', 'temppath')
|
||||
->andReturn('/tmp/');
|
||||
$dice->shouldReceive('create')->with(IConfiguration::class)->andReturn($configMock);
|
||||
$dice->shouldReceive('create')->with(IConfig::class)->andReturn($configMock);
|
||||
|
||||
// @todo Because "get_temppath()" is using static methods, we have to initialize the BaseObject
|
||||
DI::init($dice);
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Test\src\Core\Config\Cache;
|
||||
namespace Friendica\Test\src\Core\PConfig;
|
||||
|
||||
use Friendica\Core\Config\Cache\PConfigCache;
|
||||
use Friendica\Core\PConfig\Cache;
|
||||
use Friendica\Test\MockedTest;
|
||||
|
||||
class PConfigCacheTest extends MockedTest
|
||||
class CacheTest extends MockedTest
|
||||
{
|
||||
public function dataTests()
|
||||
{
|
||||
|
|
@ -28,7 +28,7 @@ class PConfigCacheTest extends MockedTest
|
|||
];
|
||||
}
|
||||
|
||||
private function assertConfigValues($data, PConfigCache $configCache, $uid)
|
||||
private function assertConfigValues($data, Cache $configCache, $uid)
|
||||
{
|
||||
foreach ($data as $cat => $values) {
|
||||
foreach ($values as $key => $value) {
|
||||
|
|
@ -44,7 +44,7 @@ class PConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testSetGet($data)
|
||||
{
|
||||
$configCache = new PConfigCache();
|
||||
$configCache = new Cache();
|
||||
$uid = 345;
|
||||
|
||||
foreach ($data as $cat => $values) {
|
||||
|
|
@ -62,7 +62,7 @@ class PConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testGetCat()
|
||||
{
|
||||
$configCache = new PConfigCache();
|
||||
$configCache = new Cache();
|
||||
$uid = 345;
|
||||
|
||||
$configCache->load($uid, [
|
||||
|
|
@ -94,7 +94,7 @@ class PConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testDelete($data)
|
||||
{
|
||||
$configCache = new PConfigCache();
|
||||
$configCache = new Cache();
|
||||
$uid = 345;
|
||||
|
||||
foreach ($data as $cat => $values) {
|
||||
|
|
@ -119,7 +119,7 @@ class PConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testKeyDiffWithResult($data)
|
||||
{
|
||||
$configCache = new PConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$diffConfig = [
|
||||
'fakeCat' => [
|
||||
|
|
@ -137,7 +137,7 @@ class PConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testKeyDiffWithoutResult($data)
|
||||
{
|
||||
$configCache = new PConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configCache->load(1, $data);
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ class PConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testPasswordHide()
|
||||
{
|
||||
$configCache = new PConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configCache->load(1, [
|
||||
'database' => [
|
||||
|
|
@ -170,7 +170,7 @@ class PConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testPasswordShow()
|
||||
{
|
||||
$configCache = new PConfigCache(false);
|
||||
$configCache = new Cache(false);
|
||||
|
||||
$configCache->load(1, [
|
||||
'database' => [
|
||||
|
|
@ -189,7 +189,7 @@ class PConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testEmptyPassword()
|
||||
{
|
||||
$configCache = new PConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configCache->load(1, [
|
||||
'database' => [
|
||||
|
|
@ -204,7 +204,7 @@ class PConfigCacheTest extends MockedTest
|
|||
|
||||
public function testWrongTypePassword()
|
||||
{
|
||||
$configCache = new PConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configCache->load(1, [
|
||||
'database' => [
|
||||
|
|
@ -216,7 +216,7 @@ class PConfigCacheTest extends MockedTest
|
|||
$this->assertNotEmpty($configCache->get(1, 'database', 'password'));
|
||||
$this->assertEmpty($configCache->get(1, 'database', 'username'));
|
||||
|
||||
$configCache = new PConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configCache->load(1, [
|
||||
'database' => [
|
||||
|
|
@ -234,7 +234,7 @@ class PConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testTwoUid()
|
||||
{
|
||||
$configCache = new PConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configCache->load(1, [
|
||||
'cat1' => [
|
||||
|
|
@ -265,7 +265,7 @@ class PConfigCacheTest extends MockedTest
|
|||
// bad UID!
|
||||
$uid = null;
|
||||
|
||||
$configCache = new PConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$this->assertNull($configCache->get($uid, 'cat1', 'cat2'));
|
||||
|
||||
|
|
@ -1,14 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Test\src\Core\Config;
|
||||
namespace Friendica\Test\src\Core\PConfig;
|
||||
|
||||
use Friendica\Core\Config\JitPConfiguration;
|
||||
use Friendica\Core\PConfig\JitPConfig;
|
||||
use Friendica\Test\src\Core\PConfig\PConfigTest;
|
||||
|
||||
class JitPConfigurationTest extends PConfigurationTest
|
||||
class JitPConfigTest extends PConfigTest
|
||||
{
|
||||
public function getInstance()
|
||||
{
|
||||
return new JitPConfiguration($this->configCache, $this->configModel);
|
||||
return new JitPConfig($this->configCache, $this->configModel);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1,23 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Test\src\Core\Config;
|
||||
namespace Friendica\Test\src\Core\PConfig;
|
||||
|
||||
use Friendica\Core\Config\Cache\PConfigCache;
|
||||
use Friendica\Core\Config\PConfiguration;
|
||||
use Friendica\Core\PConfig\Cache;
|
||||
use Friendica\Core\BasePConfig;
|
||||
use Friendica\Model\Config\PConfig as PConfigModel;
|
||||
use Friendica\Test\MockedTest;
|
||||
use Mockery;
|
||||
use Mockery\MockInterface;
|
||||
|
||||
abstract class PConfigurationTest extends MockedTest
|
||||
abstract class PConfigTest extends MockedTest
|
||||
{
|
||||
/** @var PConfigModel|MockInterface */
|
||||
protected $configModel;
|
||||
|
||||
/** @var PConfigCache */
|
||||
/** @var Cache */
|
||||
protected $configCache;
|
||||
|
||||
/** @var PConfiguration */
|
||||
/** @var BasePConfig */
|
||||
protected $testedConfig;
|
||||
|
||||
/**
|
||||
|
|
@ -44,11 +44,11 @@ abstract class PConfigurationTest extends MockedTest
|
|||
|
||||
// Create the config model
|
||||
$this->configModel = Mockery::mock(PConfigModel::class);
|
||||
$this->configCache = new PConfigCache();
|
||||
$this->configCache = new Cache();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PConfiguration
|
||||
* @return BasePConfig
|
||||
*/
|
||||
public abstract function getInstance();
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ abstract class PConfigurationTest extends MockedTest
|
|||
public function testSetUp(int $uid, array $data)
|
||||
{
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(PConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
$this->assertEmpty($this->testedConfig->getCache()->getAll());
|
||||
}
|
||||
|
|
@ -156,7 +156,7 @@ abstract class PConfigurationTest extends MockedTest
|
|||
public function testLoad(int $uid, array $data, array $possibleCats, array $load)
|
||||
{
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(PConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
foreach ($load as $loadedCats) {
|
||||
$this->testedConfig->load($uid, $loadedCats);
|
||||
|
|
@ -239,7 +239,7 @@ abstract class PConfigurationTest extends MockedTest
|
|||
public function testCacheLoadDouble(int $uid, array $data1, array $data2, array $expect)
|
||||
{
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(PConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
foreach ($data1 as $cat => $data) {
|
||||
$this->testedConfig->load($uid, $cat);
|
||||
|
|
@ -263,7 +263,7 @@ abstract class PConfigurationTest extends MockedTest
|
|||
public function testSetGetWithoutDB(int $uid, $data)
|
||||
{
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(PConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
$this->assertTrue($this->testedConfig->set($uid, 'test', 'it', $data));
|
||||
|
||||
|
|
@ -284,7 +284,7 @@ abstract class PConfigurationTest extends MockedTest
|
|||
->once();
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(PConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
$this->assertTrue($this->testedConfig->set($uid, 'test', 'it', $data));
|
||||
|
||||
|
|
@ -298,7 +298,7 @@ abstract class PConfigurationTest extends MockedTest
|
|||
public function testGetWrongWithoutDB()
|
||||
{
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(PConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
// without refresh
|
||||
$this->assertNull($this->testedConfig->get(0, 'test', 'it'));
|
||||
|
|
@ -323,7 +323,7 @@ abstract class PConfigurationTest extends MockedTest
|
|||
$this->configCache->load($uid, ['test' => ['it' => 'now']]);
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(PConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
// without refresh
|
||||
$this->assertEquals('now', $this->testedConfig->get($uid, 'test', 'it'));
|
||||
|
|
@ -348,7 +348,7 @@ abstract class PConfigurationTest extends MockedTest
|
|||
$this->configCache->load($uid, ['test' => ['it' => $data]]);
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(PConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
$this->assertEquals($data, $this->testedConfig->get($uid, 'test', 'it'));
|
||||
$this->assertEquals($data, $this->testedConfig->getCache()->get($uid, 'test', 'it'));
|
||||
|
|
@ -387,7 +387,7 @@ abstract class PConfigurationTest extends MockedTest
|
|||
->once();
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(PConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
// directly set the value to the cache
|
||||
$this->testedConfig->getCache()->set($uid, 'test', 'it', 'now');
|
||||
|
|
@ -447,7 +447,7 @@ abstract class PConfigurationTest extends MockedTest
|
|||
$this->configCache->load($data2['uid'], $data2['data']);
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(PConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
$this->assertConfig($data1['uid'], 'cat1', $data1['data']['cat1']);
|
||||
$this->assertConfig($data1['uid'], 'cat2', $data1['data']['cat2']);
|
||||
|
|
@ -1,14 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Test\src\Core\Config;
|
||||
namespace Friendica\Test\src\Core\PConfig;
|
||||
|
||||
use Friendica\Core\Config\PreloadPConfiguration;
|
||||
use Friendica\Core\PConfig\PreloadPConfig;
|
||||
use Friendica\Test\src\Core\PConfig\PConfigTest;
|
||||
|
||||
class PreloadPConfigurationTest extends PConfigurationTest
|
||||
class PreloadPConfigTest extends PConfigTest
|
||||
{
|
||||
public function getInstance()
|
||||
{
|
||||
return new PreloadPConfiguration($this->configCache, $this->configModel);
|
||||
return new PreloadPConfig($this->configCache, $this->configModel);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -3,8 +3,8 @@
|
|||
namespace Friendica\Test\src\Core;
|
||||
|
||||
use Dice\Dice;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\PreloadConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\Config\PreloadConfig;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Session\ISession;
|
||||
|
|
@ -28,7 +28,7 @@ class StorageManagerTest extends DatabaseTest
|
|||
{
|
||||
/** @var Database */
|
||||
private $dba;
|
||||
/** @var IConfiguration */
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
|
@ -56,7 +56,7 @@ class StorageManagerTest extends DatabaseTest
|
|||
$this->dba = new StaticDatabase($configCache, $profiler, $this->logger);
|
||||
|
||||
$configModel = new Config($this->dba);
|
||||
$this->config = new PreloadConfiguration($configCache, $configModel);
|
||||
$this->config = new PreloadConfig($configCache, $configModel);
|
||||
|
||||
$this->l10n = \Mockery::mock(L10n::class);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
namespace Friendica\Test\src\Database;
|
||||
|
||||
use Dice\Dice;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
|
@ -21,11 +20,11 @@ class DBATest extends DatabaseTest
|
|||
DI::init($dice);
|
||||
|
||||
// Default config
|
||||
Config::set('config', 'hostname', 'localhost');
|
||||
Config::set('system', 'throttle_limit_day', 100);
|
||||
Config::set('system', 'throttle_limit_week', 100);
|
||||
Config::set('system', 'throttle_limit_month', 100);
|
||||
Config::set('system', 'theme', 'system_theme');
|
||||
DI::config()->set('config', 'hostname', 'localhost');
|
||||
DI::config()->set('system', 'throttle_limit_day', 100);
|
||||
DI::config()->set('system', 'throttle_limit_week', 100);
|
||||
DI::config()->set('system', 'throttle_limit_month', 100);
|
||||
DI::config()->set('system', 'theme', 'system_theme');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Friendica\Test\src\Model\Storage;
|
||||
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Model\Storage\Filesystem;
|
||||
use Friendica\Model\Storage\IStorage;
|
||||
|
|
@ -17,7 +17,7 @@ class FilesystemStorageTest extends StorageTest
|
|||
{
|
||||
use VFSTrait;
|
||||
|
||||
/** @var MockInterface|IConfiguration */
|
||||
/** @var MockInterface|IConfig */
|
||||
protected $config;
|
||||
|
||||
protected function setUp()
|
||||
|
|
@ -37,7 +37,7 @@ class FilesystemStorageTest extends StorageTest
|
|||
|
||||
/** @var MockInterface|L10n $l10n */
|
||||
$l10n = \Mockery::mock(L10n::class)->makePartial();
|
||||
$this->config = \Mockery::mock(IConfiguration::class);
|
||||
$this->config = \Mockery::mock(IConfig::class);
|
||||
$this->config->shouldReceive('get')
|
||||
->with('storage', 'filesystem_path', Filesystem::DEFAULT_BASE_FOLDER)
|
||||
->andReturn($this->root->getChild('storage')->url());
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace Friendica\Testsrc\Model\User;
|
||||
|
||||
use Friendica\App\BaseURL;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Model\User\Cookie;
|
||||
use Friendica\Test\DatabaseTest;
|
||||
use Friendica\Test\Util\StaticCookie;
|
||||
|
|
@ -11,7 +11,7 @@ use Mockery\MockInterface;
|
|||
|
||||
class CookieTest extends DatabaseTest
|
||||
{
|
||||
/** @var MockInterface|IConfiguration */
|
||||
/** @var MockInterface|IConfig */
|
||||
private $config;
|
||||
/** @var MockInterface|BaseURL */
|
||||
private $baseUrl;
|
||||
|
|
@ -22,7 +22,7 @@ class CookieTest extends DatabaseTest
|
|||
|
||||
parent::setUp();
|
||||
|
||||
$this->config = \Mockery::mock(IConfiguration::class);
|
||||
$this->config = \Mockery::mock(IConfig::class);
|
||||
$this->baseUrl = \Mockery::mock(BaseURL::class);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
namespace Friendica\Test\src\Util;
|
||||
|
||||
use Friendica\App\BaseURL;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Test\MockedTest;
|
||||
|
||||
class BaseURLTest extends MockedTest
|
||||
|
|
@ -173,7 +173,7 @@ class BaseURLTest extends MockedTest
|
|||
*/
|
||||
public function testCheck($server, $input, $assert)
|
||||
{
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
$configMock = \Mockery::mock(IConfig::class);
|
||||
$configMock->shouldReceive('get')->with('config', 'hostname')->andReturn($input['hostname']);
|
||||
$configMock->shouldReceive('get')->with('system', 'urlpath')->andReturn($input['urlPath']);
|
||||
$configMock->shouldReceive('get')->with('system', 'ssl_policy')->andReturn($input['sslPolicy']);
|
||||
|
|
@ -295,7 +295,7 @@ class BaseURLTest extends MockedTest
|
|||
*/
|
||||
public function testSave($input, $save, $url)
|
||||
{
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
$configMock = \Mockery::mock(IConfig::class);
|
||||
$configMock->shouldReceive('get')->with('config', 'hostname')->andReturn($input['hostname']);
|
||||
$configMock->shouldReceive('get')->with('system', 'urlpath')->andReturn($input['urlPath']);
|
||||
$configMock->shouldReceive('get')->with('system', 'ssl_policy')->andReturn($input['sslPolicy']);
|
||||
|
|
@ -333,7 +333,7 @@ class BaseURLTest extends MockedTest
|
|||
*/
|
||||
public function testSaveByUrl($input, $save, $url)
|
||||
{
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
$configMock = \Mockery::mock(IConfig::class);
|
||||
$configMock->shouldReceive('get')->with('config', 'hostname')->andReturn($input['hostname']);
|
||||
$configMock->shouldReceive('get')->with('system', 'urlpath')->andReturn($input['urlPath']);
|
||||
$configMock->shouldReceive('get')->with('system', 'ssl_policy')->andReturn($input['sslPolicy']);
|
||||
|
|
@ -409,7 +409,7 @@ class BaseURLTest extends MockedTest
|
|||
*/
|
||||
public function testGetURL($sslPolicy, $ssl, $url, $assert)
|
||||
{
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
$configMock = \Mockery::mock(IConfig::class);
|
||||
$configMock->shouldReceive('get')->with('config', 'hostname')->andReturn('friendica.local');
|
||||
$configMock->shouldReceive('get')->with('system', 'urlpath')->andReturn('new/test');
|
||||
$configMock->shouldReceive('get')->with('system', 'ssl_policy')->andReturn($sslPolicy);
|
||||
|
|
@ -467,7 +467,7 @@ class BaseURLTest extends MockedTest
|
|||
*/
|
||||
public function testCheckRedirectHTTPS($server, $forceSSL, $sslPolicy, $url, $redirect)
|
||||
{
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
$configMock = \Mockery::mock(IConfig::class);
|
||||
$configMock->shouldReceive('get')->with('config', 'hostname')->andReturn('friendica.local');
|
||||
$configMock->shouldReceive('get')->with('system', 'urlpath')->andReturn('new/test');
|
||||
$configMock->shouldReceive('get')->with('system', 'ssl_policy')->andReturn($sslPolicy);
|
||||
|
|
@ -503,7 +503,7 @@ class BaseURLTest extends MockedTest
|
|||
*/
|
||||
public function testWrongSave($fail)
|
||||
{
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
$configMock = \Mockery::mock(IConfig::class);
|
||||
$configMock->shouldReceive('get')->with('config', 'hostname')->andReturn('friendica.local');
|
||||
$configMock->shouldReceive('get')->with('system', 'urlpath')->andReturn('new/test');
|
||||
$configMock->shouldReceive('get')->with('system', 'ssl_policy')->andReturn(BaseURL::DEFAULT_SSL_SCHEME);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Friendica\Test\src\Util\Config;
|
||||
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Test\MockedTest;
|
||||
use Friendica\Test\Util\VFSTrait;
|
||||
use Friendica\Util\ConfigFileLoader;
|
||||
|
|
@ -27,7 +27,7 @@ class ConfigFileLoaderTest extends MockedTest
|
|||
$this->delConfigFile('local.config.php');
|
||||
|
||||
$configFileLoader = new ConfigFileLoader($this->root->url());
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configFileLoader->setupCache($configCache);
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ class ConfigFileLoaderTest extends MockedTest
|
|||
->setContent('<?php return true;');
|
||||
|
||||
$configFileLoader = new ConfigFileLoader($this->root->url());
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configFileLoader->setupCache($configCache);
|
||||
}
|
||||
|
|
@ -72,7 +72,7 @@ class ConfigFileLoaderTest extends MockedTest
|
|||
->setContent(file_get_contents($file));
|
||||
|
||||
$configFileLoader = new ConfigFileLoader($this->root->url());
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configFileLoader->setupCache($configCache);
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ class ConfigFileLoaderTest extends MockedTest
|
|||
->setContent(file_get_contents($file));
|
||||
|
||||
$configFileLoader = new ConfigFileLoader($this->root->url());
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configFileLoader->setupCache($configCache);
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ class ConfigFileLoaderTest extends MockedTest
|
|||
->setContent(file_get_contents($file));
|
||||
|
||||
$configFileLoader = new ConfigFileLoader($this->root->url());
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configFileLoader->setupCache($configCache);
|
||||
|
||||
|
|
@ -216,7 +216,7 @@ class ConfigFileLoaderTest extends MockedTest
|
|||
->setContent(file_get_contents($fileDir . 'B.config.php'));
|
||||
|
||||
$configFileLoader = new ConfigFileLoader($this->root->url());
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configFileLoader->setupCache($configCache);
|
||||
|
||||
|
|
@ -245,7 +245,7 @@ class ConfigFileLoaderTest extends MockedTest
|
|||
->setContent(file_get_contents($fileDir . 'B.ini.php'));
|
||||
|
||||
$configFileLoader = new ConfigFileLoader($this->root->url());
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configFileLoader->setupCache($configCache);
|
||||
|
||||
|
|
@ -274,7 +274,7 @@ class ConfigFileLoaderTest extends MockedTest
|
|||
->setContent(file_get_contents($fileDir . 'B.ini.php'));
|
||||
|
||||
$configFileLoader = new ConfigFileLoader($this->root->url());
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configFileLoader->setupCache($configCache);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace Friendica\Test\src\Util;
|
||||
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Test\MockedTest;
|
||||
use Friendica\Util\Profiler;
|
||||
use Mockery\MockInterface;
|
||||
|
|
@ -28,7 +28,7 @@ class ProfilerTest extends MockedTest
|
|||
*/
|
||||
public function testSetUp()
|
||||
{
|
||||
$configCache = \Mockery::mock(ConfigCache::class);
|
||||
$configCache = \Mockery::mock(Cache::class);
|
||||
$configCache->shouldReceive('get')
|
||||
->withAnyArgs()
|
||||
->andReturn(true)
|
||||
|
|
@ -103,7 +103,7 @@ class ProfilerTest extends MockedTest
|
|||
*/
|
||||
public function testSaveTimestamp($timestamp, $name, array $functions)
|
||||
{
|
||||
$configCache = \Mockery::mock(ConfigCache::class);
|
||||
$configCache = \Mockery::mock(Cache::class);
|
||||
$configCache->shouldReceive('get')
|
||||
->withAnyArgs()
|
||||
->andReturn(true)
|
||||
|
|
@ -124,7 +124,7 @@ class ProfilerTest extends MockedTest
|
|||
*/
|
||||
public function testReset($timestamp, $name, array $functions)
|
||||
{
|
||||
$configCache = \Mockery::mock(ConfigCache::class);
|
||||
$configCache = \Mockery::mock(Cache::class);
|
||||
$configCache->shouldReceive('get')
|
||||
->withAnyArgs()
|
||||
->andReturn(true)
|
||||
|
|
@ -187,7 +187,7 @@ class ProfilerTest extends MockedTest
|
|||
->shouldReceive('info')
|
||||
->once();
|
||||
|
||||
$configCache = \Mockery::mock(ConfigCache::class);
|
||||
$configCache = \Mockery::mock(Cache::class);
|
||||
$configCache->shouldReceive('get')
|
||||
->withAnyArgs()
|
||||
->andReturn(true)
|
||||
|
|
@ -218,7 +218,7 @@ class ProfilerTest extends MockedTest
|
|||
*/
|
||||
public function testEnableDisable()
|
||||
{
|
||||
$configCache = \Mockery::mock(ConfigCache::class);
|
||||
$configCache = \Mockery::mock(Cache::class);
|
||||
$configCache->shouldReceive('get')
|
||||
->with('system', 'profiler')
|
||||
->andReturn(true)
|
||||
|
|
@ -235,7 +235,7 @@ class ProfilerTest extends MockedTest
|
|||
|
||||
$profiler->saveTimestamp(time(), 'network', 'test1');
|
||||
|
||||
$config = \Mockery::mock(IConfiguration::class);
|
||||
$config = \Mockery::mock(IConfig::class);
|
||||
$config->shouldReceive('get')
|
||||
->with('system', 'profiler')
|
||||
->andReturn(false)
|
||||
|
|
|
|||
43
update.php
43
update.php
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Update;
|
||||
use Friendica\Core\Worker;
|
||||
|
|
@ -64,8 +63,8 @@ function update_1178()
|
|||
|
||||
function update_1179()
|
||||
{
|
||||
if (Config::get('system', 'no_community_page')) {
|
||||
Config::set('system', 'community_page_style', CP_NO_COMMUNITY_PAGE);
|
||||
if (DI::config()->get('system', 'no_community_page')) {
|
||||
DI::config()->set('system', 'community_page_style', CP_NO_COMMUNITY_PAGE);
|
||||
}
|
||||
|
||||
// Update the central item storage with uid=0
|
||||
|
|
@ -86,10 +85,10 @@ function update_1181()
|
|||
function update_1189()
|
||||
{
|
||||
|
||||
if (strlen(Config::get('system', 'directory_submit_url')) &&
|
||||
!strlen(Config::get('system', 'directory'))) {
|
||||
Config::set('system', 'directory', dirname(Config::get('system', 'directory_submit_url')));
|
||||
Config::delete('system', 'directory_submit_url');
|
||||
if (strlen(DI::config()->get('system', 'directory_submit_url')) &&
|
||||
!strlen(DI::config()->get('system', 'directory'))) {
|
||||
DI::config()->set('system', 'directory', dirname(DI::config()->get('system', 'directory_submit_url')));
|
||||
DI::config()->delete('system', 'directory_submit_url');
|
||||
}
|
||||
|
||||
return Update::SUCCESS;
|
||||
|
|
@ -97,11 +96,11 @@ function update_1189()
|
|||
|
||||
function update_1191()
|
||||
{
|
||||
Config::set('system', 'maintenance', 1);
|
||||
DI::config()->set('system', 'maintenance', 1);
|
||||
|
||||
if (Addon::isEnabled('forumlist')) {
|
||||
$addon = 'forumlist';
|
||||
$addons = Config::get('system', 'addon');
|
||||
$addons = DI::config()->get('system', 'addon');
|
||||
$addons_arr = [];
|
||||
|
||||
if ($addons) {
|
||||
|
|
@ -114,7 +113,7 @@ function update_1191()
|
|||
// since Addon::uninstall() don't work here
|
||||
q("DELETE FROM `addon` WHERE `name` = 'forumlist' ");
|
||||
q("DELETE FROM `hook` WHERE `file` = 'addon/forumlist/forumlist.php' ");
|
||||
Config::set('system', 'addon', implode(", ", $addons_arr));
|
||||
DI::config()->set('system', 'addon', implode(", ", $addons_arr));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -154,7 +153,7 @@ function update_1191()
|
|||
}
|
||||
}
|
||||
|
||||
Config::set('system', 'maintenance', 0);
|
||||
DI::config()->set('system', 'maintenance', 0);
|
||||
|
||||
return Update::SUCCESS;
|
||||
}
|
||||
|
|
@ -187,13 +186,13 @@ function update_1244()
|
|||
|
||||
function update_1245()
|
||||
{
|
||||
$rino = Config::get('system', 'rino_encrypt');
|
||||
$rino = DI::config()->get('system', 'rino_encrypt');
|
||||
|
||||
if (!$rino) {
|
||||
return Update::SUCCESS;
|
||||
}
|
||||
|
||||
Config::set('system', 'rino_encrypt', 1);
|
||||
DI::config()->set('system', 'rino_encrypt', 1);
|
||||
|
||||
return Update::SUCCESS;
|
||||
}
|
||||
|
|
@ -210,8 +209,8 @@ WHERE `hook` LIKE 'plugin_%'");
|
|||
|
||||
function update_1260()
|
||||
{
|
||||
Config::set('system', 'maintenance', 1);
|
||||
Config::set(
|
||||
DI::config()->set('system', 'maintenance', 1);
|
||||
DI::config()->set(
|
||||
'system',
|
||||
'maintenance_reason',
|
||||
DI::l10n()->t(
|
||||
|
|
@ -252,7 +251,7 @@ function update_1260()
|
|||
DBA::e("UPDATE `thread` INNER JOIN `item` ON `thread`.`iid` = `item`.`id`
|
||||
SET `thread`.`author-id` = `item`.`author-id` WHERE `thread`.`author-id` = 0");
|
||||
|
||||
Config::set('system', 'maintenance', 0);
|
||||
DI::config()->set('system', 'maintenance', 0);
|
||||
return Update::SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -265,8 +264,8 @@ function update_1261()
|
|||
|
||||
function update_1278()
|
||||
{
|
||||
Config::set('system', 'maintenance', 1);
|
||||
Config::set(
|
||||
DI::config()->set('system', 'maintenance', 1);
|
||||
DI::config()->set(
|
||||
'system',
|
||||
'maintenance_reason',
|
||||
DI::l10n()->t(
|
||||
|
|
@ -278,7 +277,7 @@ function update_1278()
|
|||
Item::update(['post-type' => Item::PT_PAGE], ['bookmark' => true]);
|
||||
Item::update(['post-type' => Item::PT_PERSONAL_NOTE], ['type' => 'note']);
|
||||
|
||||
Config::set('system', 'maintenance', 0);
|
||||
DI::config()->set('system', 'maintenance', 0);
|
||||
|
||||
return Update::SUCCESS;
|
||||
}
|
||||
|
|
@ -410,17 +409,17 @@ function update_1327()
|
|||
|
||||
function update_1330()
|
||||
{
|
||||
$currStorage = Config::get('storage', 'class', '');
|
||||
$currStorage = DI::config()->get('storage', 'class', '');
|
||||
|
||||
// set the name of the storage instead of the classpath as config
|
||||
if (!empty($currStorage)) {
|
||||
/** @var Storage\IStorage $currStorage */
|
||||
if (!Config::set('storage', 'name', $currStorage::getName())) {
|
||||
if (!DI::config()->set('storage', 'name', $currStorage::getName())) {
|
||||
return Update::FAILED;
|
||||
}
|
||||
|
||||
// try to delete the class since it isn't needed. This won't work with config files
|
||||
Config::delete('storage', 'class');
|
||||
DI::config()->delete('storage', 'class');
|
||||
}
|
||||
|
||||
// Update attachments and photos
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@
|
|||
|
||||
for (i = 0; i < images.length; i++) {
|
||||
// For small preview images we use a smaller attachment format.
|
||||
///@todo here we need to add a check for !Config::get('system', 'always_show_preview').
|
||||
///@todo here we need to add a check for !DI::config()->get('system', 'always_show_preview').
|
||||
if (images[i].width >= 500 && images[i].width >= images[i].height) {
|
||||
imageClass = 'attachment-image';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
||||
|
|
@ -33,7 +32,7 @@ function theme_post(App $a)
|
|||
|
||||
function theme_admin(App $a)
|
||||
{
|
||||
$colorset = Config::get('duepuntozero', 'colorset');
|
||||
$colorset = DI::config()->get('duepuntozero', 'colorset');
|
||||
$user = false;
|
||||
|
||||
return clean_form($a, $colorset, $user);
|
||||
|
|
@ -42,7 +41,7 @@ function theme_admin(App $a)
|
|||
function theme_admin_post(App $a)
|
||||
{
|
||||
if (isset($_POST['duepuntozero-settings-submit'])) {
|
||||
Config::set('duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
|
||||
DI::config()->set('duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -62,7 +61,7 @@ function clean_form(App $a, &$colorset, $user)
|
|||
if ($user) {
|
||||
$color = DI::pConfig()->get(local_user(), 'duepuntozero', 'colorset');
|
||||
} else {
|
||||
$color = Config::get('duepuntozero', 'colorset');
|
||||
$color = DI::config()->get('duepuntozero', 'colorset');
|
||||
}
|
||||
|
||||
$t = Renderer::getMarkupTemplate("theme_settings.tpl");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
/**
|
||||
* @file view/theme/duepuntozero/style.php
|
||||
*/
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\DI;
|
||||
|
||||
if (file_exists("$THEMEPATH/style.css")) {
|
||||
|
|
@ -11,7 +10,7 @@ if (file_exists("$THEMEPATH/style.css")) {
|
|||
|
||||
$uid = $_REQUEST['puid'] ?? 0;
|
||||
|
||||
$s_colorset = Config::get('duepuntozero', 'colorset');
|
||||
$s_colorset = DI::config()->get('duepuntozero', 'colorset');
|
||||
$colorset = DI::pConfig()->get($uid, 'duepuntozero', 'colorset');
|
||||
|
||||
if (empty($colorset)) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
||||
|
|
@ -11,7 +10,7 @@ Renderer::setActiveTemplateEngine('smarty3');
|
|||
|
||||
$colorset = DI::pConfig()->get( local_user(), 'duepuntozero','colorset');
|
||||
if (!$colorset)
|
||||
$colorset = Config::get('duepuntozero', 'colorset'); // user setting have priority, then node settings
|
||||
$colorset = DI::config()->get('duepuntozero', 'colorset'); // user setting have priority, then node settings
|
||||
if ($colorset) {
|
||||
if ($colorset == 'greenzero')
|
||||
DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/greenzero.css" type="text/css" media="screen" />'."\n";
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
||||
|
|
@ -34,18 +33,18 @@ function theme_admin_post(App $a)
|
|||
}
|
||||
|
||||
if (isset($_POST['frio-settings-submit'])) {
|
||||
Config::set('frio', 'scheme', $_POST['frio_scheme'] ?? '');
|
||||
Config::set('frio', 'nav_bg', $_POST['frio_nav_bg'] ?? '');
|
||||
Config::set('frio', 'nav_icon_color', $_POST['frio_nav_icon_color'] ?? '');
|
||||
Config::set('frio', 'link_color', $_POST['frio_link_color'] ?? '');
|
||||
Config::set('frio', 'background_color', $_POST['frio_background_color'] ?? '');
|
||||
Config::set('frio', 'contentbg_transp', $_POST['frio_contentbg_transp'] ?? '');
|
||||
Config::set('frio', 'background_image', $_POST['frio_background_image'] ?? '');
|
||||
Config::set('frio', 'bg_image_option', $_POST['frio_bg_image_option'] ?? '');
|
||||
Config::set('frio', 'login_bg_image', $_POST['frio_login_bg_image'] ?? '');
|
||||
Config::set('frio', 'login_bg_color', $_POST['frio_login_bg_color'] ?? '');
|
||||
Config::set('frio', 'css_modified', time());
|
||||
Config::set('frio', 'enable_compose', $_POST['frio_enable_compose'] ?? 0);
|
||||
DI::config()->set('frio', 'scheme', $_POST['frio_scheme'] ?? '');
|
||||
DI::config()->set('frio', 'nav_bg', $_POST['frio_nav_bg'] ?? '');
|
||||
DI::config()->set('frio', 'nav_icon_color', $_POST['frio_nav_icon_color'] ?? '');
|
||||
DI::config()->set('frio', 'link_color', $_POST['frio_link_color'] ?? '');
|
||||
DI::config()->set('frio', 'background_color', $_POST['frio_background_color'] ?? '');
|
||||
DI::config()->set('frio', 'contentbg_transp', $_POST['frio_contentbg_transp'] ?? '');
|
||||
DI::config()->set('frio', 'background_image', $_POST['frio_background_image'] ?? '');
|
||||
DI::config()->set('frio', 'bg_image_option', $_POST['frio_bg_image_option'] ?? '');
|
||||
DI::config()->set('frio', 'login_bg_image', $_POST['frio_login_bg_image'] ?? '');
|
||||
DI::config()->set('frio', 'login_bg_color', $_POST['frio_login_bg_color'] ?? '');
|
||||
DI::config()->set('frio', 'css_modified', time());
|
||||
DI::config()->set('frio', 'enable_compose', $_POST['frio_enable_compose'] ?? 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -56,18 +55,18 @@ function theme_content(App $a)
|
|||
}
|
||||
$arr = [];
|
||||
|
||||
$node_scheme = Config::get('frio', 'scheme', Config::get('frio', 'scheme'));
|
||||
$node_scheme = DI::config()->get('frio', 'scheme', DI::config()->get('frio', 'scheme'));
|
||||
|
||||
$arr['scheme'] = DI::pConfig()->get(local_user(), 'frio', 'scheme', DI::pConfig()->get(local_user(), 'frio', 'schema', $node_scheme));
|
||||
$arr['share_string'] = '';
|
||||
$arr['nav_bg'] = DI::pConfig()->get(local_user(), 'frio', 'nav_bg' , Config::get('frio', 'nav_bg'));
|
||||
$arr['nav_icon_color'] = DI::pConfig()->get(local_user(), 'frio', 'nav_icon_color' , Config::get('frio', 'nav_icon_color'));
|
||||
$arr['link_color'] = DI::pConfig()->get(local_user(), 'frio', 'link_color' , Config::get('frio', 'link_color'));
|
||||
$arr['background_color'] = DI::pConfig()->get(local_user(), 'frio', 'background_color', Config::get('frio', 'background_color'));
|
||||
$arr['contentbg_transp'] = DI::pConfig()->get(local_user(), 'frio', 'contentbg_transp', Config::get('frio', 'contentbg_transp'));
|
||||
$arr['background_image'] = DI::pConfig()->get(local_user(), 'frio', 'background_image', Config::get('frio', 'background_image'));
|
||||
$arr['bg_image_option'] = DI::pConfig()->get(local_user(), 'frio', 'bg_image_option' , Config::get('frio', 'bg_image_option'));
|
||||
$arr['enable_compose'] = DI::pConfig()->get(local_user(), 'frio', 'enable_compose' , Config::get('frio', 'enable_compose'));
|
||||
$arr['nav_bg'] = DI::pConfig()->get(local_user(), 'frio', 'nav_bg' , DI::config()->get('frio', 'nav_bg'));
|
||||
$arr['nav_icon_color'] = DI::pConfig()->get(local_user(), 'frio', 'nav_icon_color' , DI::config()->get('frio', 'nav_icon_color'));
|
||||
$arr['link_color'] = DI::pConfig()->get(local_user(), 'frio', 'link_color' , DI::config()->get('frio', 'link_color'));
|
||||
$arr['background_color'] = DI::pConfig()->get(local_user(), 'frio', 'background_color', DI::config()->get('frio', 'background_color'));
|
||||
$arr['contentbg_transp'] = DI::pConfig()->get(local_user(), 'frio', 'contentbg_transp', DI::config()->get('frio', 'contentbg_transp'));
|
||||
$arr['background_image'] = DI::pConfig()->get(local_user(), 'frio', 'background_image', DI::config()->get('frio', 'background_image'));
|
||||
$arr['bg_image_option'] = DI::pConfig()->get(local_user(), 'frio', 'bg_image_option' , DI::config()->get('frio', 'bg_image_option'));
|
||||
$arr['enable_compose'] = DI::pConfig()->get(local_user(), 'frio', 'enable_compose' , DI::config()->get('frio', 'enable_compose'));
|
||||
|
||||
return frio_form($arr);
|
||||
}
|
||||
|
|
@ -79,18 +78,18 @@ function theme_admin(App $a)
|
|||
}
|
||||
$arr = [];
|
||||
|
||||
$arr['scheme'] = Config::get('frio', 'scheme', Config::get('frio', 'schema'));
|
||||
$arr['scheme'] = DI::config()->get('frio', 'scheme', DI::config()->get('frio', 'schema'));
|
||||
$arr['share_string'] = '';
|
||||
$arr['nav_bg'] = Config::get('frio', 'nav_bg');
|
||||
$arr['nav_icon_color'] = Config::get('frio', 'nav_icon_color');
|
||||
$arr['link_color'] = Config::get('frio', 'link_color');
|
||||
$arr['background_color'] = Config::get('frio', 'background_color');
|
||||
$arr['contentbg_transp'] = Config::get('frio', 'contentbg_transp');
|
||||
$arr['background_image'] = Config::get('frio', 'background_image');
|
||||
$arr['bg_image_option'] = Config::get('frio', 'bg_image_option');
|
||||
$arr['login_bg_image'] = Config::get('frio', 'login_bg_image');
|
||||
$arr['login_bg_color'] = Config::get('frio', 'login_bg_color');
|
||||
$arr['enable_compose'] = Config::get('frio', 'enable_compose');
|
||||
$arr['nav_bg'] = DI::config()->get('frio', 'nav_bg');
|
||||
$arr['nav_icon_color'] = DI::config()->get('frio', 'nav_icon_color');
|
||||
$arr['link_color'] = DI::config()->get('frio', 'link_color');
|
||||
$arr['background_color'] = DI::config()->get('frio', 'background_color');
|
||||
$arr['contentbg_transp'] = DI::config()->get('frio', 'contentbg_transp');
|
||||
$arr['background_image'] = DI::config()->get('frio', 'background_image');
|
||||
$arr['bg_image_option'] = DI::config()->get('frio', 'bg_image_option');
|
||||
$arr['login_bg_image'] = DI::config()->get('frio', 'login_bg_image');
|
||||
$arr['login_bg_color'] = DI::config()->get('frio', 'login_bg_color');
|
||||
$arr['enable_compose'] = DI::config()->get('frio', 'enable_compose');
|
||||
|
||||
return frio_form($arr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
<!DOCTYPE html >
|
||||
<?php
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Profile;
|
||||
|
||||
|
|
@ -21,7 +20,7 @@ if (!isset($minimal)) {
|
|||
$basepath = DI::baseUrl()->getUrlPath() ? "/" . DI::baseUrl()->getUrlPath() . "/" : "/";
|
||||
$frio = "view/theme/frio";
|
||||
$view_mode_class = (DI::mode()->isMobile() || DI::mode()->isMobile()) ? 'mobile-view' : 'desktop-view';
|
||||
$is_singleuser = Config::get('system', 'singleuser');
|
||||
$is_singleuser = DI::config()->get('system', 'singleuser');
|
||||
$is_singleuser_class = $is_singleuser ? "is-singleuser" : "is-not-singleuser";
|
||||
?>
|
||||
<html>
|
||||
|
|
@ -53,7 +52,7 @@ $is_singleuser_class = $is_singleuser ? "is-singleuser" : "is-not-singleuser";
|
|||
}
|
||||
|
||||
if (empty($nav_bg)) {
|
||||
$nav_bg = Config::get('frio', 'nav_bg');
|
||||
$nav_bg = DI::config()->get('frio', 'nav_bg');
|
||||
}
|
||||
|
||||
if (empty($nav_bg) || !is_string($nav_bg)) {
|
||||
|
|
@ -70,10 +69,10 @@ $is_singleuser_class = $is_singleuser ? "is-singleuser" : "is-not-singleuser";
|
|||
if (!empty($page['nav']) && !$minimal) {
|
||||
echo str_replace(
|
||||
"~config.sitename~",
|
||||
Config::get('config', 'sitename'),
|
||||
DI::config()->get('config', 'sitename'),
|
||||
str_replace(
|
||||
"~system.banner~",
|
||||
Config::get('system', 'banner'),
|
||||
DI::config()->get('system', 'banner'),
|
||||
$page['nav']
|
||||
)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@
|
|||
<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
|
||||
<?php
|
||||
if(!empty($page['nav'])) {
|
||||
echo str_replace("~config.sitename~",Friendica\Core\Config::get('config','sitename'),
|
||||
str_replace("~system.banner~",Friendica\Core\Config::get('system','banner'),
|
||||
echo str_replace("~config.sitename~",Friendica\DI::config()->get('config','sitename'),
|
||||
str_replace("~system.banner~",Friendica\DI::config()->get('system','banner'),
|
||||
$page['nav']
|
||||
));};
|
||||
?>
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue