aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-03-24 09:58:21 +0000
committerMario <mario@mariovavti.com>2024-03-24 09:58:21 +0000
commita0cfe22501dc9daa7dd8cff86803cf494a1f5ec3 (patch)
treee156db21df2251b8c67e61453c8f4af9f9460d2f /Zotlabs/Lib
parentecdd9a4d6edd769a3e2c3b0604e4637d94fa1a51 (diff)
parent0dc959d9fe40bddce5e99b8162bb0e770fc28ed9 (diff)
downloadvolse-hubzilla-a0cfe22501dc9daa7dd8cff86803cf494a1f5ec3.tar.gz
volse-hubzilla-a0cfe22501dc9daa7dd8cff86803cf494a1f5ec3.tar.bz2
volse-hubzilla-a0cfe22501dc9daa7dd8cff86803cf494a1f5ec3.zip
Merge branch 'deprecate-include-config-in-core' into 'dev'
Deprecate *_config() functions in core. See merge request hubzilla/core!2114
Diffstat (limited to 'Zotlabs/Lib')
-rw-r--r--Zotlabs/Lib/Apps.php9
-rw-r--r--Zotlabs/Lib/Cache.php9
-rw-r--r--Zotlabs/Lib/Connect.php5
-rw-r--r--Zotlabs/Lib/Crypto.php3
-rw-r--r--Zotlabs/Lib/DB_Upgrade.php29
-rw-r--r--Zotlabs/Lib/DReport.php4
-rw-r--r--Zotlabs/Lib/Enotify.php9
-rw-r--r--Zotlabs/Lib/Libsync.php5
-rw-r--r--Zotlabs/Lib/Libzot.php43
-rw-r--r--Zotlabs/Lib/Libzotdir.php27
-rw-r--r--Zotlabs/Lib/QueueWorker.php23
-rw-r--r--Zotlabs/Lib/ThreadItem.php17
-rw-r--r--Zotlabs/Lib/Zotfinger.php3
13 files changed, 99 insertions, 87 deletions
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php
index 1c05d69b1..0dc405ea9 100644
--- a/Zotlabs/Lib/Apps.php
+++ b/Zotlabs/Lib/Apps.php
@@ -3,6 +3,7 @@
namespace Zotlabs\Lib;
use App;
+use Zotlabs\Lib\Config;
require_once('include/plugin.php');
require_once('include/channel.php');
@@ -65,7 +66,7 @@ class Apps {
}
static public function get_base_apps() {
- $x = get_config('system','base_apps',[
+ $x = Config::Get('system','base_apps',[
'Connections',
'Contact Roles',
'Network',
@@ -301,7 +302,7 @@ class Apps {
break;
default:
if($config)
- $unset = ((get_config('system', $require[0]) == $require[1]) ? false : true);
+ $unset = ((Config::Get('system', $require[0]) == $require[1]) ? false : true);
else
$unset = ((local_channel() && feature_enabled(local_channel(),$require)) ? false : true);
if($unset)
@@ -523,7 +524,7 @@ class Apps {
break;
default:
if($config)
- $unset = ((get_config('system', $require[0]) === $require[1]) ? false : true);
+ $unset = ((Config::Get('system', $require[0]) === $require[1]) ? false : true);
else
$unset = ((local_channel() && feature_enabled(local_channel(),$require)) ? false : true);
if($unset)
@@ -960,7 +961,7 @@ class Apps {
$conf = (($menu === 'nav_featured_app') ? 'app_order' : 'app_pin_order');
- $x = (($uid) ? get_pconfig($uid,'system',$conf) : get_config('system',$conf));
+ $x = (($uid) ? get_pconfig($uid,'system',$conf) : Config::Get('system',$conf));
if(($x) && (! is_array($x))) {
$y = explode(',',$x);
$y = array_map('trim',$y);
diff --git a/Zotlabs/Lib/Cache.php b/Zotlabs/Lib/Cache.php
index f3f520496..4b5beb2aa 100644
--- a/Zotlabs/Lib/Cache.php
+++ b/Zotlabs/Lib/Cache.php
@@ -2,10 +2,11 @@
namespace Zotlabs\Lib;
- /**
- * cache api
- */
+use Zotlabs\Lib\Config;
+/**
+ * cache api
+ */
class Cache {
/**
@@ -23,7 +24,7 @@ class Cache {
$r = q("SELECT v FROM cache WHERE k = '%s' AND updated > %s - INTERVAL %s LIMIT 1",
dbesc($hash),
db_utcnow(),
- db_quoteinterval(($age ? $age : get_config('system','object_cache_days', '30') . ' DAY'))
+ db_quoteinterval(($age ? $age : Config::Get('system','object_cache_days', '30') . ' DAY'))
);
if ($r)
diff --git a/Zotlabs/Lib/Connect.php b/Zotlabs/Lib/Connect.php
index 4de41526b..b8e7a5c4e 100644
--- a/Zotlabs/Lib/Connect.php
+++ b/Zotlabs/Lib/Connect.php
@@ -5,8 +5,7 @@ namespace Zotlabs\Lib;
use App;
use Zotlabs\Access\Permissions;
use Zotlabs\Daemon\Master;
-
-
+use Zotlabs\Lib\Config;
class Connect {
@@ -96,7 +95,7 @@ class Connect {
$wf = discover_by_webbie($url,$protocol);
if (! $wf) {
- $feeds = get_config('system','feed_contacts');
+ $feeds = Config::Get('system','feed_contacts');
if (($feeds) && (in_array($protocol, [ '', 'feed', 'rss' ]))) {
$d = discover_by_url($url);
diff --git a/Zotlabs/Lib/Crypto.php b/Zotlabs/Lib/Crypto.php
index 188c6bd81..46a25d3b5 100644
--- a/Zotlabs/Lib/Crypto.php
+++ b/Zotlabs/Lib/Crypto.php
@@ -3,6 +3,7 @@
namespace Zotlabs\Lib;
use Exception;
+use Zotlabs\Lib\Config;
class Crypto {
@@ -44,7 +45,7 @@ class Crypto {
'encrypt_key' => false
];
- $conf = get_config('system', 'openssl_conf_file');
+ $conf = Config::Get('system', 'openssl_conf_file');
if ($conf) {
$openssl_options['config'] = $conf;
diff --git a/Zotlabs/Lib/DB_Upgrade.php b/Zotlabs/Lib/DB_Upgrade.php
index b6e3f7b7b..981c354a4 100644
--- a/Zotlabs/Lib/DB_Upgrade.php
+++ b/Zotlabs/Lib/DB_Upgrade.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Lib;
+use Zotlabs\Lib\Config;
class DB_Upgrade {
@@ -13,9 +14,9 @@ class DB_Upgrade {
$this->config_name = 'db_version';
$this->func_prefix = '_';
- $build = get_config('system', 'db_version', 0);
+ $build = Config::Get('system', 'db_version', 0);
if(! intval($build))
- $build = set_config('system', 'db_version', $db_revision);
+ $build = Config::Set('system', 'db_version', $db_revision);
if($build == $db_revision) {
// Nothing to be done.
@@ -27,7 +28,7 @@ class DB_Upgrade {
logger('Critical: check_config unable to determine database schema version');
return;
}
-
+
$current = intval($db_revision);
if($stored < $current) {
@@ -38,7 +39,7 @@ class DB_Upgrade {
for($x = $stored + 1; $x <= $current; $x ++) {
$s = '_' . $x;
$cls = '\\Zotlabs\Update\\' . $s ;
- if(! class_exists($cls)) {
+ if(! class_exists($cls)) {
return;
}
@@ -52,10 +53,10 @@ class DB_Upgrade {
Config::Load('database');
- if(get_config('database', $s))
+ if(Config::Get('database', $s))
break;
- set_config('database',$s, '1');
-
+ Config::Set('database',$s, '1');
+
$c = new $cls();
@@ -65,10 +66,10 @@ class DB_Upgrade {
$source = t('Source code of failed update: ') . "\n\n" . @file_get_contents('Zotlabs/Update/' . $s . '.php');
-
+
// Prevent sending hundreds of thousands of emails by creating
- // a lockfile.
+ // a lockfile.
$lockfile = 'store/[data]/mailsent';
@@ -77,7 +78,7 @@ class DB_Upgrade {
@unlink($lockfile);
//send the administrator an e-mail
file_put_contents($lockfile, $x);
-
+
$r = q("select account_language from account where account_email = '%s' limit 1",
dbesc(\App::$config['system']['admin_email'])
);
@@ -86,7 +87,7 @@ class DB_Upgrade {
[
'toEmail' => \App::$config['system']['admin_email'],
'messageSubject' => sprintf( t('Update Error at %s'), z_root()),
- 'textVersion' => replace_macros(get_intltext_template('update_fail_eml.tpl'),
+ 'textVersion' => replace_macros(get_intltext_template('update_fail_eml.tpl'),
[
'$sitename' => \App::$config['system']['sitename'],
'$siteurl' => z_root(),
@@ -104,11 +105,11 @@ class DB_Upgrade {
pop_lang();
}
else {
- set_config('database',$s, 'success');
+ Config::Set('database',$s, 'success');
}
}
}
- set_config('system', 'db_version', $db_revision);
+ Config::Set('system', 'db_version', $db_revision);
}
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Lib/DReport.php b/Zotlabs/Lib/DReport.php
index 71e39a9d7..ac8e0d377 100644
--- a/Zotlabs/Lib/DReport.php
+++ b/Zotlabs/Lib/DReport.php
@@ -1,6 +1,8 @@
<?php
namespace Zotlabs\Lib;
+use Zotlabs\Lib\Config;
+
class DReport {
private $location;
@@ -70,7 +72,7 @@ class DReport {
static function is_storable($dr) {
- if(get_config('system', 'disable_dreport'))
+ if(Config::Get('system', 'disable_dreport'))
return false;
/**
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index 48a255e95..121ad9b09 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -6,6 +6,7 @@ namespace Zotlabs\Lib;
* @brief File with functions and a class for generating system and email notifications.
*/
+use Zotlabs\Lib\Config;
class Enotify {
@@ -61,7 +62,7 @@ class Enotify {
$product = t('$projectname'); // PLATFORM_NAME;
$siteurl = z_root();
$thanks = t('Thank You,');
- $sitename = get_config('system','sitename');
+ $sitename = Config::Get('system','sitename');
$site_admin = sprintf( t('%s Administrator'), $sitename);
$opt_out1 = sprintf( t('This email was sent by %1$s at %2$s.'), t('$Projectname'), \App::get_hostname());
$opt_out2 = sprintf( t('To stop receiving these messages, please adjust your Notification Settings at %s'), z_root() . '/settings');
@@ -73,15 +74,15 @@ class Enotify {
// Do not translate 'noreply' as it must be a legal 7-bit email address
- $reply_email = get_config('system', 'reply_address');
+ $reply_email = Config::Get('system', 'reply_address');
if(! $reply_email)
$reply_email = 'noreply' . '@' . $hostname;
- $sender_email = get_config('system', 'from_email');
+ $sender_email = Config::Get('system', 'from_email');
if(! $sender_email)
$sender_email = 'Administrator' . '@' . $hostname;
- $sender_name = get_config('system', 'from_email_name');
+ $sender_name = Config::Get('system', 'from_email_name');
if(! $sender_name)
$sender_name = \Zotlabs\Lib\System::get_site_name();
diff --git a/Zotlabs/Lib/Libsync.php b/Zotlabs/Lib/Libsync.php
index 3130290f7..e68fd53f1 100644
--- a/Zotlabs/Lib/Libsync.php
+++ b/Zotlabs/Lib/Libsync.php
@@ -5,6 +5,7 @@ namespace Zotlabs\Lib;
use App;
use Zotlabs\Daemon\Master;
+use Zotlabs\Lib\Config;
class Libsync {
@@ -135,7 +136,7 @@ class Libsync {
$info['collection_members'] = $r;
}
- $interval = get_config('queueworker', 'queue_interval', 500000);
+ $interval = Config::Get('queueworker', 'queue_interval', 500000);
logger('Packet: ' . print_r($info, true), LOGGER_DATA, LOG_DEBUG);
@@ -157,7 +158,7 @@ class Libsync {
/*
$x = q("select count(outq_hash) as total from outq where outq_delivered = 0");
- if (intval($x[0]['total']) > intval(get_config('system', 'force_queue_threshold', 3000))) {
+ if (intval($x[0]['total']) > intval(Config::Get('system', 'force_queue_threshold', 3000))) {
logger('immediate delivery deferred.', LOGGER_DEBUG, LOG_INFO);
Queue::update($hash);
continue;
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index 3495ede06..89157bf5e 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -3,10 +3,11 @@
namespace Zotlabs\Lib;
use App;
-use Zotlabs\Web\HTTPSig;
-use Zotlabs\Access\Permissions;
use Zotlabs\Access\PermissionLimits;
+use Zotlabs\Access\Permissions;
use Zotlabs\Daemon\Master;
+use Zotlabs\Lib\Config;
+use Zotlabs\Web\HTTPSig;
require_once('include/crypto.php');
@@ -101,12 +102,12 @@ class Libzot {
*/
static function build_packet($channel, $type = 'activity', $recipients = null, $msg = [], $encoding = 'activitystreams', $remote_key = null, $methods = '') {
- $sig_method = get_config('system', 'signature_algorithm', 'sha256');
+ $sig_method = Config::Get('system', 'signature_algorithm', 'sha256');
$data = [
'type' => $type,
'encoding' => $encoding,
'sender' => $channel['channel_hash'],
- 'site_id' => self::make_xchan_hash(z_root(), get_config('system', 'pubkey')),
+ 'site_id' => self::make_xchan_hash(z_root(), Config::Get('system', 'pubkey')),
'version' => System::get_zot_revision(),
];
@@ -661,7 +662,7 @@ class Libzot {
*/
call_hooks('import_xchan', $arr);
- $dirmode = intval(get_config('system', 'directory_mode', DIRECTORY_MODE_NORMAL));
+ $dirmode = intval(Config::Get('system', 'directory_mode', DIRECTORY_MODE_NORMAL));
$changed = false;
$what = '';
@@ -710,7 +711,7 @@ class Libzot {
// if we import an entry from a site that's not ours and either or both of us is off the grid - hide the entry.
/** @TODO: check if we're the same directory realm, which would mean we are allowed to see it */
- $dirmode = get_config('system', 'directory_mode');
+ $dirmode = Config::Get('system', 'directory_mode');
if (((isset($arr['site']['directory_mode']) && $arr['site']['directory_mode'] === 'standalone') || ($dirmode & DIRECTORY_MODE_STANDALONE)) && ($arr['site']['url'] != z_root()))
$arr['searchable'] = false;
@@ -1008,7 +1009,7 @@ class Libzot {
logger('Headers: ' . print_r($arr['header'], true), LOGGER_DATA, LOG_DEBUG);
}
- $x = Crypto::unencapsulate($x, get_config('system', 'prvkey'));
+ $x = Crypto::unencapsulate($x, Config::Get('system', 'prvkey'));
if ($x && !is_array($x)) {
$x = json_decode($x, true);
@@ -1416,7 +1417,7 @@ class Libzot {
$include_sys = false;
if ($msg['type'] === 'activity') {
- $disable_discover_tab = get_config('system', 'disable_discover_tab') || get_config('system', 'disable_discover_tab') === false;
+ $disable_discover_tab = Config::Get('system', 'disable_discover_tab') || Config::Get('system', 'disable_discover_tab') === false;
if (!$disable_discover_tab)
$include_sys = true;
@@ -1632,8 +1633,8 @@ class Libzot {
continue;
}
- $incl = get_config('system','pubstream_incl');
- $excl = get_config('system','pubstream_excl');
+ $incl = Config::Get('system','pubstream_incl');
+ $excl = Config::Get('system','pubstream_excl');
if(($incl || $excl) && !MessageFilter::evaluate($arr, $incl, $excl)) {
$local_public = false;
@@ -2924,8 +2925,8 @@ class Libzot {
*/
static function site_info() {
- $signing_key = get_config('system', 'prvkey');
- $sig_method = get_config('system', 'signature_algorithm', 'sha256');
+ $signing_key = Config::Get('system', 'prvkey');
+ $sig_method = Config::Get('system', 'signature_algorithm', 'sha256');
$ret = [];
$ret['site'] = [];
@@ -2934,10 +2935,10 @@ class Libzot {
$ret['site']['post'] = z_root() . '/zot';
$ret['site']['openWebAuth'] = z_root() . '/owa';
$ret['site']['authRedirect'] = z_root() . '/magic';
- $ret['site']['sitekey'] = get_config('system', 'pubkey');
+ $ret['site']['sitekey'] = Config::Get('system', 'pubkey');
$ret['site']['directory_mode'] = 'normal';
- $dirmode = get_config('system', 'directory_mode');
+ $dirmode = Config::Get('system', 'directory_mode');
if ($dirmode == DIRECTORY_MODE_PRIMARY)
$ret['site']['directory_mode'] = 'primary';
@@ -2956,7 +2957,7 @@ class Libzot {
if ($dirmode != DIRECTORY_MODE_STANDALONE) {
- $register_policy = intval(get_config('system', 'register_policy'));
+ $register_policy = intval(Config::Get('system', 'register_policy'));
if ($register_policy == REGISTER_CLOSED)
$ret['site']['register_policy'] = 'closed';
@@ -2966,7 +2967,7 @@ class Libzot {
$ret['site']['register_policy'] = 'open';
- $access_policy = intval(get_config('system', 'access_policy'));
+ $access_policy = intval(Config::Get('system', 'access_policy'));
if ($access_policy == ACCESS_PRIVATE)
$ret['site']['access_policy'] = 'private';
@@ -2982,7 +2983,7 @@ class Libzot {
require_once('include/channel.php');
$ret['site']['channels'] = channel_total();
- $ret['site']['admin'] = get_config('system', 'admin_email');
+ $ret['site']['admin'] = Config::Get('system', 'admin_email');
$visible_plugins = [];
if (is_array(App::$plugins) && count(App::$plugins)) {
@@ -2993,10 +2994,10 @@ class Libzot {
}
$ret['site']['plugins'] = $visible_plugins;
- $ret['site']['sitehash'] = get_config('system', 'location_hash');
- $ret['site']['sitename'] = get_config('system', 'sitename');
- $ret['site']['sellpage'] = get_config('system', 'sellpage');
- $ret['site']['location'] = get_config('system', 'site_location');
+ $ret['site']['sitehash'] = Config::Get('system', 'location_hash');
+ $ret['site']['sitename'] = Config::Get('system', 'sitename');
+ $ret['site']['sellpage'] = Config::Get('system', 'sellpage');
+ $ret['site']['location'] = Config::Get('system', 'site_location');
$ret['site']['realm'] = get_directory_realm();
$ret['site']['project'] = System::get_platform_name();
$ret['site']['version'] = System::get_project_version();
diff --git a/Zotlabs/Lib/Libzotdir.php b/Zotlabs/Lib/Libzotdir.php
index ca3902a9e..25f308fc2 100644
--- a/Zotlabs/Lib/Libzotdir.php
+++ b/Zotlabs/Lib/Libzotdir.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Lib;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Zotfinger;
use Zotlabs\Lib\Webfinger;
@@ -20,7 +21,7 @@ class Libzotdir {
static function find_upstream_directory($dirmode) {
- $preferred = get_config('system','directory_server');
+ $preferred = Config::Get('system','directory_server');
// Thwart attempts to use a private directory
@@ -47,17 +48,17 @@ class Libzotdir {
$directory_fallback_servers = get_directory_fallback_servers();
- $dirmode = intval(get_config('system','directory_mode'));
+ $dirmode = intval(Config::Get('system','directory_mode'));
if ($dirmode == DIRECTORY_MODE_NORMAL) {
$toss = mt_rand(0,count($directory_fallback_servers));
$preferred = $directory_fallback_servers[$toss];
if(! $preferred) {
$preferred = DIRECTORY_FALLBACK_MASTER;
}
- set_config('system','directory_server',$preferred);
+ Config::Set('system','directory_server',$preferred);
}
else {
- set_config('system','directory_server',z_root());
+ Config::Set('system','directory_server',z_root());
}
}
if($preferred) {
@@ -77,7 +78,7 @@ class Libzotdir {
static function check_upstream_directory() {
- $directory = get_config('system', 'directory_server');
+ $directory = Config::Get('system', 'directory_server');
// it's possible there is no directory server configured and the local hub is being used.
// If so, default to preserving the absence of a specific server setting.
@@ -94,7 +95,7 @@ class Libzotdir {
}
if (! $isadir)
- set_config('system', 'directory_server', '');
+ Config::Set('system', 'directory_server', '');
}
@@ -106,7 +107,7 @@ class Libzotdir {
$ret = ((array_key_exists($setting,$_SESSION)) ? intval($_SESSION[$setting]) : false);
if($ret === false)
- $ret = get_config('directory', $setting);
+ $ret = Config::Get('directory', $setting);
// 'safemode' is the default if there is no observer or no established preference.
@@ -114,7 +115,7 @@ class Libzotdir {
if($setting === 'safemode' && $ret === false)
$ret = 1;
- if($setting === 'globaldir' && intval(get_config('system','localdir_hide')))
+ if($setting === 'globaldir' && intval(Config::Get('system','localdir_hide')))
$ret = 1;
return $ret;
@@ -133,7 +134,7 @@ class Libzotdir {
$globaldir = self::get_directory_setting($observer, 'globaldir');
$pubforums = self::get_directory_setting($observer, 'pubforums');
- $hide_local = intval(get_config('system','localdir_hide'));
+ $hide_local = intval(Config::Get('system','localdir_hide'));
if($hide_local)
$globaldir = 1;
@@ -141,7 +142,7 @@ class Libzotdir {
// Build urls without order and pubforums so it's easy to tack on the changed value
// Probably there's an easier way to do this
- $directory_sort_order = get_config('system','directory_sort_order');
+ $directory_sort_order = Config::Get('system','directory_sort_order');
if(! $directory_sort_order)
$directory_sort_order = 'date';
@@ -232,7 +233,7 @@ class Libzotdir {
if (! $r)
return;
- $dir_trusted_hosts = array_merge(get_directory_fallback_servers(), get_config('system', 'trusted_directory_servers', []));
+ $dir_trusted_hosts = array_merge(get_directory_fallback_servers(), Config::Get('system', 'trusted_directory_servers', []));
foreach ($r as $rr) {
if (! $rr['site_directory'])
@@ -244,7 +245,7 @@ class Libzotdir {
// It will take about a month for a new directory to obtain the full current repertoire of channels.
/** @FIXME Go back and pick up earlier ratings if this is a new directory server. These do not get refreshed. */
- $token = get_config('system','realm_token');
+ $token = Config::Get('system','realm_token');
$syncdate = (($rr['site_sync'] <= NULL_DATE) ? datetime_convert('UTC','UTC','now - 2 days') : $rr['site_sync']);
$x = z_fetch_url($rr['site_directory'] . '?f=&sync=' . urlencode($syncdate) . (($token) ? '&t=' . $token : ''));
@@ -696,7 +697,7 @@ class Libzotdir {
static function update($hash, $addr, $bump_date = true, $flag = null) {
- $dirmode = intval(get_config('system', 'directory_mode'));
+ $dirmode = intval(Config::Get('system', 'directory_mode'));
if($dirmode == DIRECTORY_MODE_NORMAL) {
return;
diff --git a/Zotlabs/Lib/QueueWorker.php b/Zotlabs/Lib/QueueWorker.php
index 68e747b0f..ce239809f 100644
--- a/Zotlabs/Lib/QueueWorker.php
+++ b/Zotlabs/Lib/QueueWorker.php
@@ -4,6 +4,7 @@ namespace Zotlabs\Lib;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\Exception\UnableToBuildUuidException;
+use Zotlabs\Lib\Config;
class QueueWorker {
@@ -84,7 +85,7 @@ class QueueWorker {
$workers = self::GetWorkerCount();
if ($workers < self::$maxworkers) {
logger($workers . '/' . self::$maxworkers . ' workers active', LOGGER_DEBUG);
- $phpbin = get_config('system', 'phpbin', 'php');
+ $phpbin = Config::Get('system', 'phpbin', 'php');
proc_run($phpbin, 'Zotlabs/Daemon/Master.php', ['Queueworker']);
}
}
@@ -132,18 +133,18 @@ class QueueWorker {
public static function GetWorkerCount() {
if (self::$maxworkers == 0) {
- self::$maxworkers = get_config('queueworker', 'max_queueworkers', 4);
+ self::$maxworkers = Config::Get('queueworker', 'max_queueworkers', 4);
self::$maxworkers = self::$maxworkers > 3 ? self::$maxworkers : 4;
}
if (self::$workermaxage == 0) {
- self::$workermaxage = get_config('queueworker', 'max_queueworker_age');
+ self::$workermaxage = Config::Get('queueworker', 'max_queueworker_age');
self::$workermaxage = self::$workermaxage > 120 ? self::$workermaxage : 300;
}
self::qstart();
// skip locked is preferred but is not supported by mariadb < 10.6 which is still used a lot - hence make it optional
- $sql_quirks = ((get_config('system', 'db_skip_locked_supported')) ? 'SKIP LOCKED' : 'NOWAIT');
+ $sql_quirks = ((Config::Get('system', 'db_skip_locked_supported')) ? 'SKIP LOCKED' : 'NOWAIT');
$r = q("SELECT workerq_id FROM workerq WHERE workerq_reservationid IS NOT NULL AND workerq_processtimeout < %s FOR UPDATE $sql_quirks",
db_utcnow()
@@ -199,7 +200,7 @@ class QueueWorker {
self::qstart();
// skip locked is preferred but is not supported by mariadb < 10.6 which is still used a lot - hence make it optional
- $sql_quirks = ((get_config('system', 'db_skip_locked_supported')) ? 'SKIP LOCKED' : 'NOWAIT');
+ $sql_quirks = ((Config::Get('system', 'db_skip_locked_supported')) ? 'SKIP LOCKED' : 'NOWAIT');
$work = dbq("SELECT workerq_id, workerq_cmd FROM workerq WHERE workerq_reservationid IS NULL ORDER BY workerq_priority DESC, workerq_id ASC LIMIT 1 FOR UPDATE $sql_quirks");
@@ -236,12 +237,12 @@ class QueueWorker {
}
public static function Process() {
- $sleep = intval(get_config('queueworker', 'queue_worker_sleep', 100));
- $auto_queue_worker_sleep = get_config('queueworker', 'auto_queue_worker_sleep', 0);
+ $sleep = intval(Config::Get('queueworker', 'queue_worker_sleep', 100));
+ $auto_queue_worker_sleep = Config::Get('queueworker', 'auto_queue_worker_sleep', 0);
if (!self::GetWorkerID()) {
if ($auto_queue_worker_sleep) {
- set_config('queueworker', 'queue_worker_sleep', $sleep + 100);
+ Config::Set('queueworker', 'queue_worker_sleep', $sleep + 100);
}
logger('Unable to get worker ID. Exiting.', LOGGER_DEBUG);
@@ -250,7 +251,7 @@ class QueueWorker {
if ($auto_queue_worker_sleep && $sleep > 100) {
$next_sleep = $sleep - 100;
- set_config('queueworker', 'queue_worker_sleep', (($next_sleep < 100) ? 100 : $next_sleep));
+ Config::Set('queueworker', 'queue_worker_sleep', (($next_sleep < 100) ? 100 : $next_sleep));
}
$jobs = 0;
@@ -259,7 +260,7 @@ class QueueWorker {
self::$workersleep = $sleep;
self::$workersleep = ((intval(self::$workersleep) > 100) ? intval(self::$workersleep) : 100);
- if (function_exists('sys_getloadavg') && get_config('queueworker', 'load_average_sleep')) {
+ if (function_exists('sys_getloadavg') && Config::Get('queueworker', 'load_average_sleep')) {
// very experimental!
$load_average_sleep = true;
}
@@ -287,7 +288,7 @@ class QueueWorker {
if ($workers < self::$maxworkers) {
logger($workers . '/' . self::$maxworkers . ' workers active', LOGGER_DEBUG);
- $phpbin = get_config('system', 'phpbin', 'php');
+ $phpbin = Config::Get('system', 'phpbin', 'php');
proc_run($phpbin, 'Zotlabs/Daemon/Master.php', ['Queueworker']);
}
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index 8f364e945..290a7b0c2 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -3,8 +3,9 @@
namespace Zotlabs\Lib;
use App;
-use Zotlabs\Lib\Apps;
use Zotlabs\Access\AccessList;
+use Zotlabs\Lib\Apps;
+use Zotlabs\Lib\Config;
require_once('include/text.php');
@@ -41,7 +42,7 @@ class ThreadItem {
$this->data = $data;
$this->toplevel = ($this->get_id() == $this->get_data_value('parent'));
- $this->threaded = get_config('system','thread_allow');
+ $this->threaded = Config::Get('system','thread_allow');
$observer = \App::get_observer();
@@ -70,7 +71,7 @@ class ThreadItem {
// allow a site to configure the order and content of the reaction emoji list
if($this->toplevel) {
- $x = get_config('system','reactions');
+ $x = Config::Get('system','reactions');
if($x && is_array($x) && count($x)) {
$this->reactions = $x;
}
@@ -347,12 +348,12 @@ class ThreadItem {
$dreport = '';
- $keep_reports = intval(get_config('system','expire_delivery_reports'));
+ $keep_reports = intval(Config::Get('system','expire_delivery_reports'));
if($keep_reports === 0)
$keep_reports = 10;
$dreport_link = '';
- if((intval($item['item_type']) == ITEM_TYPE_POST) && (! get_config('system','disable_dreport')) && strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC',"now - $keep_reports days")) > 0) {
+ if((intval($item['item_type']) == ITEM_TYPE_POST) && (! Config::Get('system','disable_dreport')) && strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC',"now - $keep_reports days")) > 0) {
$dreport = t('Delivery Report');
$dreport_link = '?mid=' . $item['mid'];
}
@@ -397,7 +398,7 @@ class ThreadItem {
$json_mids = json_encode($mids);
// Pinned item processing
- $allowed_type = (in_array($item['item_type'], get_config('system', 'pin_types', [ ITEM_TYPE_POST ])) ? true : false);
+ $allowed_type = (in_array($item['item_type'], Config::Get('system', 'pin_types', [ ITEM_TYPE_POST ])) ? true : false);
$pinned_items = ($allowed_type ? get_pconfig($item['uid'], 'pinned', $item['item_type'], []) : []);
$pinned = ((!empty($pinned_items) && in_array($midb64, $pinned_items)) ? true : false);
@@ -549,7 +550,7 @@ class ThreadItem {
$result['children'] = array();
$nb_children = count($children);
- $visible_comments = get_config('system','expanded_comments');
+ $visible_comments = Config::Get('system','expanded_comments');
if($visible_comments === false)
$visible_comments = 3;
@@ -826,7 +827,7 @@ class ThreadItem {
*/
private function get_comment_box() {
- if(!$this->is_toplevel() && !get_config('system','thread_allow')) {
+ if(!$this->is_toplevel() && !Config::Get('system','thread_allow')) {
return '';
}
diff --git a/Zotlabs/Lib/Zotfinger.php b/Zotlabs/Lib/Zotfinger.php
index ccf64d6d1..2a16fc8cf 100644
--- a/Zotlabs/Lib/Zotfinger.php
+++ b/Zotlabs/Lib/Zotfinger.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Lib;
+use Zotlabs\Lib\Config;
use Zotlabs\Web\HTTPSig;
class Zotfinger {
@@ -75,7 +76,7 @@ class Zotfinger {
$result['data'] = json_decode($x['body'],true);
if($result['data'] && is_array($result['data']) && array_key_exists('encrypted',$result['data']) && $result['data']['encrypted']) {
- $result['data'] = json_decode(Crypto::unencapsulate($result['data'],get_config('system','prvkey')),true);
+ $result['data'] = json_decode(Crypto::unencapsulate($result['data'],Config::Get('system','prvkey')),true);
}
logger('decrypted: ' . print_r($result,true), LOGGER_DATA);