Merge pull request #8142 from nupplaphil/task/di_config
CleanUp Config namespace
This commit is contained in:
commit
04d620fc2f
|
@ -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;
|
||||
|
|
25
src/App.php
25
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
|
||||
* @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,23 +46,23 @@ class Authentication
|
|||
private $cookie;
|
||||
/** @var Session\ISession */
|
||||
private $session;
|
||||
/** @var IPConfiguration */
|
||||
/** @var IPConfig */
|
||||
private $pConfig;
|
||||
|
||||
/**
|
||||
* Authentication constructor.
|
||||
*
|
||||
* @param IConfiguration $config
|
||||
* @param App\Mode $mode
|
||||
* @param App\BaseURL $baseUrl
|
||||
* @param L10n $l10n
|
||||
* @param Database $dba
|
||||
* @param LoggerInterface $logger
|
||||
* @param User\Cookie $cookie
|
||||
* @param IConfig $config
|
||||
* @param App\Mode $mode
|
||||
* @param App\BaseURL $baseUrl
|
||||
* @param L10n $l10n
|
||||
* @param Database $dba
|
||||
* @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 array $server The $_SERVER array
|
||||
* @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;
|
||||
|
||||
|
|
|
@ -149,15 +149,15 @@ class Module
|
|||
/**
|
||||
* Determine the class of the current module
|
||||
*
|
||||
* @param Arguments $args The Friendica execution arguments
|
||||
* @param Router $router The Friendica routing instance
|
||||
* @param Core\Config\IConfiguration $config The Friendica Configuration
|
||||
* @param Arguments $args The Friendica execution arguments
|
||||
* @param Router $router The Friendica routing instance
|
||||
* @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;
|
||||
|
@ -168,15 +168,15 @@ class Page implements ArrayAccess
|
|||
* - Infinite scroll data
|
||||
* - head.tpl template
|
||||
*
|
||||
* @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 App $app The Friendica App instance
|
||||
* @param Module $module The loaded Friendica module
|
||||
* @param L10n $l10n The l10n language instance
|
||||
* @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);
|
||||
|
||||
|
@ -342,17 +342,17 @@ class Page implements ArrayAccess
|
|||
/**
|
||||
* Executes the creation of the current page and prints it to the screen
|
||||
*
|
||||
* @param App $app The Friendica App
|
||||
* @param BaseURL $baseURL The Friendica Base URL
|
||||
* @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 App $app The Friendica App
|
||||
* @param BaseURL $baseURL The Friendica Base URL
|
||||
* @param Mode $mode The current node mode
|
||||
* @param Module $module The loaded Friendica module
|
||||
* @param L10n $l10n The l10n language class
|
||||
* @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,14 +80,14 @@ 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->config = $config;
|
||||
$this->dba = $dba;
|
||||
$this->appMode = $appMode;
|
||||
$this->configCache = $configCache;
|
||||
$this->config = $config;
|
||||
$this->dba = $dba;
|
||||
}
|
||||
|
||||
protected function doExecute()
|
||||
|
@ -106,9 +97,9 @@ HELP;
|
|||
|
||||
$installer = new Installer();
|
||||
|
||||
$configCache = $this->configCache;
|
||||
$configCache = $this->configCache;
|
||||
$basePathConf = $configCache->get('system', 'basepath');
|
||||
$basepath = new BasePath($basePathConf);
|
||||
$basepath = new BasePath($basePathConf);
|
||||
$installer->setUpCache($configCache, $basepath->getPath());
|
||||
|
||||
$this->out(" Complete!\n\n");
|
||||
|
@ -241,18 +232,18 @@ HELP;
|
|||
}
|
||||
|
||||
/**
|
||||
* @param Installer $installer The Installer instance
|
||||
* @param Config\Cache\ConfigCache $configCache The config cache
|
||||
* @param Installer $installer The Installer instance
|
||||
* @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;
|
||||
|
||||
$installer->resetChecks();
|
||||
if (!$installer->checkFunctions()) {
|
||||
if (!$installer->checkFunctions()) {
|
||||
$checked = false;
|
||||
}
|
||||
if (!$installer->checkImagick()) {
|
||||
|
@ -281,11 +272,12 @@ HELP;
|
|||
|
||||
/**
|
||||
* @param array $results
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function extractErrors($results)
|
||||
{
|
||||
$errorMessage = '';
|
||||
$errorMessage = '';
|
||||
$allChecksRequired = $this->getOption('a') !== null;
|
||||
|
||||
foreach ($results as $result) {
|
||||
|
|
|
@ -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 Model\Config\Config $configModel The configuration model
|
||||
* @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 Model\Config\PConfig $configModel The configuration model
|
||||
* @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 string $basePath The determined basepath
|
||||
* @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 ConfigModel $configModel The configuration model
|
||||
* @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 PConfigModel $configModel The configuration model
|
||||
* @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;
|
||||
|
@ -49,14 +49,14 @@ class LoggerFactory
|
|||
/**
|
||||
* Creates a new PSR-3 compliant logger instances
|
||||
*
|
||||
* @param Database $database The Friendica Database instance
|
||||
* @param IConfiguration $config The config
|
||||
* @param Profiler $profiler The profiler of the app
|
||||
* @param FileSystem $fileSystem FileSystem utils
|
||||
* @param Database $database The Friendica Database instance
|
||||
* @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,16 +137,16 @@ class LoggerFactory
|
|||
*
|
||||
* It should never get filled during normal usage of Friendica
|
||||
*
|
||||
* @param IConfiguration $config The config
|
||||
* @param Profiler $profiler The profiler of the app
|
||||
* @param FileSystem $fileSystem FileSystem utils
|
||||
* @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
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user