From 3411ced83360cc97dc378ba7042720f25ac6bc01 Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Sun, 19 Jan 2020 21:21:53 +0100 Subject: [PATCH] Move Config::set() to DI::config()->set() --- bin/daemon.php | 8 +- boot.php | 6 +- mod/api.php | 2 +- src/Core/Addon.php | 2 +- src/Core/Config.php | 16 --- src/Core/Theme.php | 2 +- src/Core/Update.php | 28 ++--- src/Core/Worker.php | 8 +- src/Database/DBStructure.php | 14 +-- src/Database/PostUpdate.php | 24 ++-- src/Model/GServer.php | 2 +- src/Module/Admin/Blocklist/Server.php | 4 +- src/Module/Admin/DBSync.php | 12 +- src/Module/Admin/Features.php | 4 +- src/Module/Admin/Logs/Settings.php | 6 +- src/Module/Admin/Site.php | 174 +++++++++++++------------- src/Module/Admin/Summary.php | 2 +- src/Module/Admin/Tos.php | 6 +- src/Protocol/DFRN.php | 4 +- src/Worker/CheckVersion.php | 2 +- src/Worker/Cron.php | 6 +- src/Worker/CronJobs.php | 2 +- src/Worker/DBClean.php | 32 ++--- tests/src/Database/DBATest.php | 10 +- update.php | 26 ++-- view/theme/duepuntozero/config.php | 2 +- view/theme/frio/config.php | 24 ++-- view/theme/quattro/config.php | 8 +- view/theme/vier/config.php | 16 +-- 29 files changed, 218 insertions(+), 234 deletions(-) diff --git a/bin/daemon.php b/bin/daemon.php index 8de6e1a4cf..0536814b9a 100755 --- a/bin/daemon.php +++ b/bin/daemon.php @@ -88,7 +88,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 +99,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 +110,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,7 +153,7 @@ 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); diff --git a/boot.php b/boot.php index 92be83ed0e..5f8f3a3be3 100644 --- a/boot.php +++ b/boot.php @@ -470,7 +470,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. @@ -563,7 +563,7 @@ function get_itemcachepath() } if (System::isDirectoryUsable($itemcache)) { - Config::set("system", "itemcache", $itemcache); + DI::config()->set("system", "itemcache", $itemcache); return $itemcache; } } @@ -595,7 +595,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. diff --git a/mod/api.php b/mod/api.php index 3ed19e75bf..48a1e4d46e 100644 --- a/mod/api.php +++ b/mod/api.php @@ -68,7 +68,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(); diff --git a/src/Core/Addon.php b/src/Core/Addon.php index 6451483682..5f1865b554 100644 --- a/src/Core/Addon.php +++ b/src/Core/Addon.php @@ -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)); } /** diff --git a/src/Core/Config.php b/src/Core/Config.php index 13bd8ddaf6..0dd4b22768 100644 --- a/src/Core/Config.php +++ b/src/Core/Config.php @@ -19,22 +19,6 @@ use Friendica\DI; */ class Config { - /** - * 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. * diff --git a/src/Core/Theme.php b/src/Core/Theme.php index 7339157af5..76149b7589 100644 --- a/src/Core/Theme.php +++ b/src/Core/Theme.php @@ -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))); } /** diff --git a/src/Core/Update.php b/src/Core/Update.php index 02a39219a1..5a151b8380 100644 --- a/src/Core/Update.php +++ b/src/Core/Update.php @@ -36,7 +36,7 @@ class Update $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; } @@ -81,7 +81,7 @@ class Update 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) { @@ -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; diff --git a/src/Core/Worker.php b/src/Core/Worker.php index da38cba10a..562a17c0a2 100644 --- a/src/Core/Worker.php +++ b/src/Core/Worker.php @@ -65,7 +65,7 @@ class Worker // Kill stale processes every 5 minutes $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(); } @@ -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); @@ -1004,7 +1004,7 @@ class Worker 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()) { diff --git a/src/Database/DBStructure.php b/src/Database/DBStructure.php index d70f7f4ec6..18832b8e50 100644 --- a/src/Database/DBStructure.php +++ b/src/Database/DBStructure.php @@ -260,8 +260,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 +522,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 +574,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); } } diff --git a/src/Database/PostUpdate.php b/src/Database/PostUpdate.php index ae6dd7605c..863e823a13 100644 --- a/src/Database/PostUpdate.php +++ b/src/Database/PostUpdate.php @@ -67,7 +67,7 @@ class PostUpdate 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"]); + DI::config()->set("system", "post_update_1194_end", $r[0]["id"]); $end_id = DI::config()->get("system", "post_update_1194_end"); } } @@ -90,11 +90,11 @@ 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"]); + DI::config()->set("system", "post_update_1194_start", $r[0]["id"]); $start_id = DI::config()->get("system", "post_update_1194_start"); } @@ -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; } @@ -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; } @@ -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; } @@ -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'); @@ -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'); @@ -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; } diff --git a/src/Model/GServer.php b/src/Model/GServer.php index 97d679b7e4..7bb9efaffc 100644 --- a/src/Model/GServer.php +++ b/src/Model/GServer.php @@ -1429,6 +1429,6 @@ class GServer } } - Config::set('poco', 'last_federation_discovery', time()); + DI::config()->set('poco', 'last_federation_discovery', time()); } } diff --git a/src/Module/Admin/Blocklist/Server.php b/src/Module/Admin/Blocklist/Server.php index d6c3daf839..652439efcc 100644 --- a/src/Module/Admin/Blocklist/Server.php +++ b/src/Module/Admin/Blocklist/Server.php @@ -27,7 +27,7 @@ class Server extends BaseAdminModule 'domain' => Strings::escapeTags(trim($_POST['newentry_domain'])), 'reason' => Strings::escapeTags(trim($_POST['newentry_reason'])) ]; - Config::set('system', 'blocklist', $blocklist); + DI::config()->set('system', 'blocklist', $blocklist); info(DI::l10n()->t('Server domain pattern added to blocklist.') . EOL); } else { // Edit the entries from blocklist @@ -43,7 +43,7 @@ class Server extends BaseAdminModule ]; } } - Config::set('system', 'blocklist', $blocklist); + DI::config()->set('system', 'blocklist', $blocklist); info(DI::l10n()->t('Site blocklist updated.') . EOL); } diff --git a/src/Module/Admin/DBSync.php b/src/Module/Admin/DBSync.php index cfa6f8d83a..e4382319c9 100644 --- a/src/Module/Admin/DBSync.php +++ b/src/Module/Admin/DBSync.php @@ -24,10 +24,10 @@ class DBSync extends BaseAdminModule // @TODO: Replace with parameter from router $update = intval($a->argv[3]); if ($update) { - Config::set('database', 'update_' . $update, 'success'); + DI::config()->set('database', 'update_' . $update, 'success'); $curr = DI::config()->get('system', 'build'); if (intval($curr) == $update) { - Config::set('system', 'build', intval($curr) + 1); + DI::config()->set('system', 'build', intval($curr) + 1); } info(DI::l10n()->t('Update has been marked successful') . EOL); } @@ -40,8 +40,8 @@ class DBSync extends BaseAdminModule $retval = DBStructure::update($a->getBasePath(), false, true); if ($retval === '') { $o .= DI::l10n()->t("Database structure update %s was successfully applied.", DB_UPDATE_VERSION) . "
"; - Config::set('database', 'last_successful_update', DB_UPDATE_VERSION); - Config::set('database', 'last_successful_update_time', time()); + DI::config()->set('database', 'last_successful_update', DB_UPDATE_VERSION); + DI::config()->set('database', 'last_successful_update_time', time()); } else { $o .= DI::l10n()->t("Executing of database structure update %s failed with error: %s", DB_UPDATE_VERSION, $retval) . "
"; } @@ -63,13 +63,13 @@ class DBSync extends BaseAdminModule $o .= DI::l10n()->t("Executing %s failed with error: %s", $func, $retval); } elseif ($retval === Update::SUCCESS) { $o .= DI::l10n()->t('Update %s was successfully applied.', $func); - Config::set('database', $func, 'success'); + DI::config()->set('database', $func, 'success'); } else { $o .= DI::l10n()->t('Update %s did not return a status. Unknown if it succeeded.', $func); } } else { $o .= DI::l10n()->t('There was no additional update function %s that needed to be called.', $func) . "
"; - Config::set('database', $func, 'success'); + DI::config()->set('database', $func, 'success'); } return $o; diff --git a/src/Module/Admin/Features.php b/src/Module/Admin/Features.php index 374fd98f21..79d6e43f5e 100644 --- a/src/Module/Admin/Features.php +++ b/src/Module/Admin/Features.php @@ -29,10 +29,10 @@ class Features extends BaseAdminModule } else { $val = 0; } - Config::set('feature', $feature, $val); + DI::config()->set('feature', $feature, $val); if (!empty($_POST[$featurelock])) { - Config::set('feature_lock', $feature, $val); + DI::config()->set('feature_lock', $feature, $val); } else { Config::delete('feature_lock', $feature); } diff --git a/src/Module/Admin/Logs/Settings.php b/src/Module/Admin/Logs/Settings.php index 98bb9b301a..b4c1864ff6 100644 --- a/src/Module/Admin/Logs/Settings.php +++ b/src/Module/Admin/Logs/Settings.php @@ -28,9 +28,9 @@ class Settings extends BaseAdminModule return; } - Config::set('system', 'logfile', $logfile); - Config::set('system', 'debugging', $debugging); - Config::set('system', 'loglevel', $loglevel); + DI::config()->set('system', 'logfile', $logfile); + DI::config()->set('system', 'debugging', $debugging); + DI::config()->set('system', 'loglevel', $loglevel); } info(DI::l10n()->t("Log settings updated.")); diff --git a/src/Module/Admin/Site.php b/src/Module/Admin/Site.php index 88c62486bb..915eaa5046 100644 --- a/src/Module/Admin/Site.php +++ b/src/Module/Admin/Site.php @@ -93,7 +93,7 @@ class Site extends BaseAdminModule update_table($a, "gcontact", ['connect', 'addr'], $old_host, $new_host); // update config - Config::set('system', 'url', $new_url); + DI::config()->set('system', 'url', $new_url); DI::baseUrl()->saveByURL($new_url); // send relocate @@ -232,7 +232,7 @@ class Site extends BaseAdminModule // Has the directory url changed? If yes, then resubmit the existing profiles there if ($global_directory != DI::config()->get('system', 'directory') && ($global_directory != '')) { - Config::set('system', 'directory', $global_directory); + DI::config()->set('system', 'directory', $global_directory); Worker::add(PRIORITY_LOW, 'Directory'); } @@ -278,129 +278,129 @@ class Site extends BaseAdminModule ); } } - Config::set('system', 'ssl_policy' , $ssl_policy); - Config::set('system', 'maxloadavg' , $maxloadavg); - Config::set('system', 'maxloadavg_frontend' , $maxloadavg_frontend); - Config::set('system', 'min_memory' , $min_memory); - Config::set('system', 'optimize_max_tablesize', $optimize_max_tablesize); - Config::set('system', 'optimize_fragmentation', $optimize_fragmentation); - Config::set('system', 'poco_completion' , $poco_completion); - Config::set('system', 'poco_requery_days' , $poco_requery_days); - Config::set('system', 'poco_discovery' , $poco_discovery); - Config::set('system', 'poco_discovery_since' , $poco_discovery_since); - Config::set('system', 'poco_local_search' , $poco_local_search); - Config::set('system', 'nodeinfo' , $nodeinfo); - Config::set('config', 'sitename' , $sitename); - Config::set('config', 'sender_email' , $sender_email); - Config::set('system', 'suppress_tags' , $suppress_tags); - Config::set('system', 'shortcut_icon' , $shortcut_icon); - Config::set('system', 'touch_icon' , $touch_icon); + DI::config()->set('system', 'ssl_policy' , $ssl_policy); + DI::config()->set('system', 'maxloadavg' , $maxloadavg); + DI::config()->set('system', 'maxloadavg_frontend' , $maxloadavg_frontend); + DI::config()->set('system', 'min_memory' , $min_memory); + DI::config()->set('system', 'optimize_max_tablesize', $optimize_max_tablesize); + DI::config()->set('system', 'optimize_fragmentation', $optimize_fragmentation); + DI::config()->set('system', 'poco_completion' , $poco_completion); + DI::config()->set('system', 'poco_requery_days' , $poco_requery_days); + DI::config()->set('system', 'poco_discovery' , $poco_discovery); + DI::config()->set('system', 'poco_discovery_since' , $poco_discovery_since); + DI::config()->set('system', 'poco_local_search' , $poco_local_search); + DI::config()->set('system', 'nodeinfo' , $nodeinfo); + DI::config()->set('config', 'sitename' , $sitename); + DI::config()->set('config', 'sender_email' , $sender_email); + DI::config()->set('system', 'suppress_tags' , $suppress_tags); + DI::config()->set('system', 'shortcut_icon' , $shortcut_icon); + DI::config()->set('system', 'touch_icon' , $touch_icon); if ($banner == "") { Config::delete('system', 'banner'); } else { - Config::set('system', 'banner', $banner); + DI::config()->set('system', 'banner', $banner); } if (empty($additional_info)) { Config::delete('config', 'info'); } else { - Config::set('config', 'info', $additional_info); + DI::config()->set('config', 'info', $additional_info); } - Config::set('system', 'language', $language); - Config::set('system', 'theme', $theme); + DI::config()->set('system', 'language', $language); + DI::config()->set('system', 'theme', $theme); Theme::install($theme); if ($theme_mobile == '---') { Config::delete('system', 'mobile-theme'); } else { - Config::set('system', 'mobile-theme', $theme_mobile); + DI::config()->set('system', 'mobile-theme', $theme_mobile); } if ($singleuser == '---') { Config::delete('system', 'singleuser'); } else { - Config::set('system', 'singleuser', $singleuser); + DI::config()->set('system', 'singleuser', $singleuser); } - Config::set('system', 'maximagesize' , $maximagesize); - Config::set('system', 'max_image_length' , $maximagelength); - Config::set('system', 'jpeg_quality' , $jpegimagequality); - - Config::set('config', 'register_policy' , $register_policy); - Config::set('system', 'max_daily_registrations', $daily_registrations); - Config::set('system', 'account_abandon_days' , $abandon_days); - Config::set('config', 'register_text' , $register_text); - Config::set('system', 'allowed_sites' , $allowed_sites); - Config::set('system', 'allowed_email' , $allowed_email); - Config::set('system', 'forbidden_nicknames' , $forbidden_nicknames); - Config::set('system', 'no_oembed_rich_content' , $no_oembed_rich_content); - Config::set('system', 'allowed_oembed' , $allowed_oembed); - Config::set('system', 'block_public' , $block_public); - Config::set('system', 'publish_all' , $force_publish); - Config::set('system', 'newuser_private' , $newuser_private); - Config::set('system', 'enotify_no_content' , $enotify_no_content); - Config::set('system', 'disable_embedded' , $disable_embedded); - Config::set('system', 'allow_users_remote_self', $allow_users_remote_self); - Config::set('system', 'explicit_content' , $explicit_content); - Config::set('system', 'check_new_version_url' , $check_new_version_url); - - Config::set('system', 'block_extended_register', $no_multi_reg); - Config::set('system', 'no_openid' , $no_openid); - Config::set('system', 'no_regfullname' , $no_regfullname); - Config::set('system', 'community_page_style' , $community_page_style); - Config::set('system', 'max_author_posts_community_page', $max_author_posts_community_page); - Config::set('system', 'verifyssl' , $verifyssl); - Config::set('system', 'proxyuser' , $proxyuser); - Config::set('system', 'proxy' , $proxy); - Config::set('system', 'curl_timeout' , $timeout); - Config::set('system', 'dfrn_only' , $dfrn_only); - Config::set('system', 'ostatus_disabled' , $ostatus_disabled); - Config::set('system', 'diaspora_enabled' , $diaspora_enabled); - - Config::set('config', 'private_addons' , $private_addons); - - Config::set('system', 'force_ssl' , $force_ssl); - Config::set('system', 'hide_help' , $hide_help); - - Config::set('system', 'dbclean' , $dbclean); - Config::set('system', 'dbclean-expire-days' , $dbclean_expire_days); - Config::set('system', 'dbclean_expire_conversation', $dbclean_expire_conv); + DI::config()->set('system', 'maximagesize' , $maximagesize); + DI::config()->set('system', 'max_image_length' , $maximagelength); + DI::config()->set('system', 'jpeg_quality' , $jpegimagequality); + + DI::config()->set('config', 'register_policy' , $register_policy); + DI::config()->set('system', 'max_daily_registrations', $daily_registrations); + DI::config()->set('system', 'account_abandon_days' , $abandon_days); + DI::config()->set('config', 'register_text' , $register_text); + DI::config()->set('system', 'allowed_sites' , $allowed_sites); + DI::config()->set('system', 'allowed_email' , $allowed_email); + DI::config()->set('system', 'forbidden_nicknames' , $forbidden_nicknames); + DI::config()->set('system', 'no_oembed_rich_content' , $no_oembed_rich_content); + DI::config()->set('system', 'allowed_oembed' , $allowed_oembed); + DI::config()->set('system', 'block_public' , $block_public); + DI::config()->set('system', 'publish_all' , $force_publish); + DI::config()->set('system', 'newuser_private' , $newuser_private); + DI::config()->set('system', 'enotify_no_content' , $enotify_no_content); + DI::config()->set('system', 'disable_embedded' , $disable_embedded); + DI::config()->set('system', 'allow_users_remote_self', $allow_users_remote_self); + DI::config()->set('system', 'explicit_content' , $explicit_content); + DI::config()->set('system', 'check_new_version_url' , $check_new_version_url); + + DI::config()->set('system', 'block_extended_register', $no_multi_reg); + DI::config()->set('system', 'no_openid' , $no_openid); + DI::config()->set('system', 'no_regfullname' , $no_regfullname); + DI::config()->set('system', 'community_page_style' , $community_page_style); + DI::config()->set('system', 'max_author_posts_community_page', $max_author_posts_community_page); + DI::config()->set('system', 'verifyssl' , $verifyssl); + DI::config()->set('system', 'proxyuser' , $proxyuser); + DI::config()->set('system', 'proxy' , $proxy); + DI::config()->set('system', 'curl_timeout' , $timeout); + DI::config()->set('system', 'dfrn_only' , $dfrn_only); + DI::config()->set('system', 'ostatus_disabled' , $ostatus_disabled); + DI::config()->set('system', 'diaspora_enabled' , $diaspora_enabled); + + DI::config()->set('config', 'private_addons' , $private_addons); + + DI::config()->set('system', 'force_ssl' , $force_ssl); + DI::config()->set('system', 'hide_help' , $hide_help); + + DI::config()->set('system', 'dbclean' , $dbclean); + DI::config()->set('system', 'dbclean-expire-days' , $dbclean_expire_days); + DI::config()->set('system', 'dbclean_expire_conversation', $dbclean_expire_conv); if ($dbclean_unclaimed == 0) { $dbclean_unclaimed = $dbclean_expire_days; } - Config::set('system', 'dbclean-expire-unclaimed', $dbclean_unclaimed); + DI::config()->set('system', 'dbclean-expire-unclaimed', $dbclean_unclaimed); if ($itemcache != '') { $itemcache = BasePath::getRealPath($itemcache); } - Config::set('system', 'itemcache', $itemcache); - Config::set('system', 'itemcache_duration', $itemcache_duration); - Config::set('system', 'max_comments', $max_comments); + DI::config()->set('system', 'itemcache', $itemcache); + DI::config()->set('system', 'itemcache_duration', $itemcache_duration); + DI::config()->set('system', 'max_comments', $max_comments); if ($temppath != '') { $temppath = BasePath::getRealPath($temppath); } - Config::set('system', 'temppath', $temppath); + DI::config()->set('system', 'temppath', $temppath); - Config::set('system', 'proxy_disabled' , $proxy_disabled); - Config::set('system', 'only_tag_search' , $only_tag_search); + DI::config()->set('system', 'proxy_disabled' , $proxy_disabled); + DI::config()->set('system', 'only_tag_search' , $only_tag_search); - Config::set('system', 'worker_queues' , $worker_queues); - Config::set('system', 'worker_dont_fork' , $worker_dont_fork); - Config::set('system', 'worker_fastlane' , $worker_fastlane); - Config::set('system', 'frontend_worker' , $worker_frontend); + DI::config()->set('system', 'worker_queues' , $worker_queues); + DI::config()->set('system', 'worker_dont_fork' , $worker_dont_fork); + DI::config()->set('system', 'worker_fastlane' , $worker_fastlane); + DI::config()->set('system', 'frontend_worker' , $worker_frontend); - Config::set('system', 'relay_directly' , $relay_directly); - Config::set('system', 'relay_server' , $relay_server); - Config::set('system', 'relay_subscribe' , $relay_subscribe); - Config::set('system', 'relay_scope' , $relay_scope); - Config::set('system', 'relay_server_tags', $relay_server_tags); - Config::set('system', 'relay_user_tags' , $relay_user_tags); + DI::config()->set('system', 'relay_directly' , $relay_directly); + DI::config()->set('system', 'relay_server' , $relay_server); + DI::config()->set('system', 'relay_subscribe' , $relay_subscribe); + DI::config()->set('system', 'relay_scope' , $relay_scope); + DI::config()->set('system', 'relay_server_tags', $relay_server_tags); + DI::config()->set('system', 'relay_user_tags' , $relay_user_tags); - Config::set('system', 'rino_encrypt' , $rino); + DI::config()->set('system', 'rino_encrypt' , $rino); info(DI::l10n()->t('Site settings updated.') . EOL); @@ -416,7 +416,7 @@ class Site extends BaseAdminModule if (strlen(DI::config()->get('system', 'directory_submit_url')) && !strlen(DI::config()->get('system', 'directory'))) { - Config::set('system', 'directory', dirname(DI::config()->get('system', 'directory_submit_url'))); + DI::config()->set('system', 'directory', dirname(DI::config()->get('system', 'directory_submit_url'))); Config::delete('system', 'directory_submit_url'); } diff --git a/src/Module/Admin/Summary.php b/src/Module/Admin/Summary.php index a8b037d5d3..c74f877268 100644 --- a/src/Module/Admin/Summary.php +++ b/src/Module/Admin/Summary.php @@ -115,7 +115,7 @@ class Summary extends BaseAdminModule $confBasepath = $configCache->get('system', 'basepath'); $currBasepath = DI::config()->get('system', 'basepath'); if ($confBasepath !== $currBasepath || !is_dir($currBasepath)) { - if (is_dir($confBasepath) && Config::set('system', 'basepath', $confBasepath)) { + if (is_dir($confBasepath) && DI::config()->set('system', 'basepath', $confBasepath)) { DI::logger()->info('Friendica\'s system.basepath was updated successfully.', [ 'from' => $currBasepath, 'to' => $confBasepath, diff --git a/src/Module/Admin/Tos.php b/src/Module/Admin/Tos.php index 000dedd051..aa819fe41a 100644 --- a/src/Module/Admin/Tos.php +++ b/src/Module/Admin/Tos.php @@ -23,9 +23,9 @@ class Tos extends BaseAdminModule $displayprivstatement = !empty($_POST['displayprivstatement']); $tostext = (!empty($_POST['tostext']) ? strip_tags(trim($_POST['tostext'])) : ''); - Config::set('system', 'tosdisplay', $displaytos); - Config::set('system', 'tosprivstatement', $displayprivstatement); - Config::set('system', 'tostext', $tostext); + DI::config()->set('system', 'tosdisplay', $displaytos); + DI::config()->set('system', 'tosprivstatement', $displayprivstatement); + DI::config()->set('system', 'tostext', $tostext); info(DI::l10n()->t('The Terms of Service settings have been updated.')); diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php index 00e0df5f42..fe362839f3 100644 --- a/src/Protocol/DFRN.php +++ b/src/Protocol/DFRN.php @@ -492,8 +492,8 @@ class DFRN $pubkey = DI::config()->get('system', 'site_pubkey'); if (! $pubkey) { $res = Crypto::newKeypair(1024); - Config::set('system', 'site_prvkey', $res['prvkey']); - Config::set('system', 'site_pubkey', $res['pubkey']); + DI::config()->set('system', 'site_prvkey', $res['prvkey']); + DI::config()->set('system', 'site_pubkey', $res['pubkey']); } $rp = q( diff --git a/src/Worker/CheckVersion.php b/src/Worker/CheckVersion.php index b6fdd7f026..a25651523c 100644 --- a/src/Worker/CheckVersion.php +++ b/src/Worker/CheckVersion.php @@ -43,7 +43,7 @@ class CheckVersion $gitversion = DBA::escape(trim(Network::fetchUrl($checked_url))); Logger::log("Upstream VERSION is: ".$gitversion, Logger::DEBUG); - Config::set('system', 'git_friendica_version', $gitversion); + DI::config()->set('system', 'git_friendica_version', $gitversion); Logger::log('checkversion: end'); diff --git a/src/Worker/Cron.php b/src/Worker/Cron.php index 7a59d64ffb..559085be24 100644 --- a/src/Worker/Cron.php +++ b/src/Worker/Cron.php @@ -86,7 +86,7 @@ class Cron self::checkdeletedContacts(); - Config::set('system', 'last_expire_day', $d2); + DI::config()->set('system', 'last_expire_day', $d2); } // Hourly cron calls @@ -100,7 +100,7 @@ class Cron DBA::e("OPTIMIZE TABLE `workerqueue`"); } - Config::set('system', 'last_cron_hourly', time()); + DI::config()->set('system', 'last_cron_hourly', time()); } // Ensure to have a .htaccess file. @@ -118,7 +118,7 @@ class Cron Logger::log('cron: end'); - Config::set('system', 'last_cron', time()); + DI::config()->set('system', 'last_cron', time()); return; } diff --git a/src/Worker/CronJobs.php b/src/Worker/CronJobs.php index 5487b35d67..48b4923c76 100644 --- a/src/Worker/CronJobs.php +++ b/src/Worker/CronJobs.php @@ -226,7 +226,7 @@ class CronJobs } } - Config::set('system', 'cache_last_cleared', time()); + DI::config()->set('system', 'cache_last_cleared', time()); } /** diff --git a/src/Worker/DBClean.php b/src/Worker/DBClean.php index 11e73c24a2..60f0e64c42 100644 --- a/src/Worker/DBClean.php +++ b/src/Worker/DBClean.php @@ -98,7 +98,7 @@ class DBClean { DBA::close($r); Logger::log("Done deleting ".$count." old global item entries from item table without user copy. Last ID: ".$last_id); - Config::set('system', 'dbclean-last-id-1', $last_id); + DI::config()->set('system', 'dbclean-last-id-1', $last_id); } elseif ($stage == 2) { $last_id = DI::config()->get('system', 'dbclean-last-id-2', 0); @@ -120,10 +120,10 @@ class DBClean { DBA::close($r); Logger::log("Done deleting ".$count." items without parents. Last ID: ".$last_id); - Config::set('system', 'dbclean-last-id-2', $last_id); + DI::config()->set('system', 'dbclean-last-id-2', $last_id); if ($count < $limit) { - Config::set('system', 'finished-dbclean-2', true); + DI::config()->set('system', 'finished-dbclean-2', true); } } elseif ($stage == 3) { $last_id = DI::config()->get('system', 'dbclean-last-id-3', 0); @@ -146,10 +146,10 @@ class DBClean { DBA::close($r); Logger::log("Done deleting ".$count." orphaned data from thread table. Last ID: ".$last_id); - Config::set('system', 'dbclean-last-id-3', $last_id); + DI::config()->set('system', 'dbclean-last-id-3', $last_id); if ($count < $limit) { - Config::set('system', 'finished-dbclean-3', true); + DI::config()->set('system', 'finished-dbclean-3', true); } } elseif ($stage == 4) { $last_id = DI::config()->get('system', 'dbclean-last-id-4', 0); @@ -172,10 +172,10 @@ class DBClean { DBA::close($r); Logger::log("Done deleting ".$count." orphaned data from notify table. Last ID: ".$last_id); - Config::set('system', 'dbclean-last-id-4', $last_id); + DI::config()->set('system', 'dbclean-last-id-4', $last_id); if ($count < $limit) { - Config::set('system', 'finished-dbclean-4', true); + DI::config()->set('system', 'finished-dbclean-4', true); } } elseif ($stage == 5) { $last_id = DI::config()->get('system', 'dbclean-last-id-5', 0); @@ -198,10 +198,10 @@ class DBClean { DBA::close($r); Logger::log("Done deleting ".$count." orphaned data from notify-threads table. Last ID: ".$last_id); - Config::set('system', 'dbclean-last-id-5', $last_id); + DI::config()->set('system', 'dbclean-last-id-5', $last_id); if ($count < $limit) { - Config::set('system', 'finished-dbclean-5', true); + DI::config()->set('system', 'finished-dbclean-5', true); } } elseif ($stage == 6) { $last_id = DI::config()->get('system', 'dbclean-last-id-6', 0); @@ -224,10 +224,10 @@ class DBClean { DBA::close($r); Logger::log("Done deleting ".$count." orphaned data from sign table. Last ID: ".$last_id); - Config::set('system', 'dbclean-last-id-6', $last_id); + DI::config()->set('system', 'dbclean-last-id-6', $last_id); if ($count < $limit) { - Config::set('system', 'finished-dbclean-6', true); + DI::config()->set('system', 'finished-dbclean-6', true); } } elseif ($stage == 7) { $last_id = DI::config()->get('system', 'dbclean-last-id-7', 0); @@ -250,10 +250,10 @@ class DBClean { DBA::close($r); Logger::log("Done deleting ".$count." orphaned data from term table. Last ID: ".$last_id); - Config::set('system', 'dbclean-last-id-7', $last_id); + DI::config()->set('system', 'dbclean-last-id-7', $last_id); if ($count < $limit) { - Config::set('system', 'finished-dbclean-7', true); + DI::config()->set('system', 'finished-dbclean-7', true); } } elseif ($stage == 8) { if ($days <= 0) { @@ -289,7 +289,7 @@ class DBClean { DBA::close($r); Logger::log("Done deleting ".$count." expired threads. Last ID: ".$last_id); - Config::set('system', 'dbclean-last-id-8', $last_id); + DI::config()->set('system', 'dbclean-last-id-8', $last_id); } elseif ($stage == 9) { if ($days <= 0) { return; @@ -317,7 +317,7 @@ class DBClean { DBA::close($r); Logger::log("Done deleting ".$count." old global item entries from expired threads. Last ID: ".$last_id); - Config::set('system', 'dbclean-last-id-9', $last_id); + DI::config()->set('system', 'dbclean-last-id-9', $last_id); } elseif ($stage == 10) { $last_id = DI::config()->get('system', 'dbclean-last-id-10', 0); $days = intval(DI::config()->get('system', 'dbclean_expire_conversation', 90)); @@ -340,7 +340,7 @@ class DBClean { DBA::close($r); Logger::log("Done deleting ".$count." conversations. Last created: ".$last_id); - Config::set('system', 'dbclean-last-id-10', $last_id); + DI::config()->set('system', 'dbclean-last-id-10', $last_id); } } } diff --git a/tests/src/Database/DBATest.php b/tests/src/Database/DBATest.php index 15d438b679..60008d0db0 100644 --- a/tests/src/Database/DBATest.php +++ b/tests/src/Database/DBATest.php @@ -21,11 +21,11 @@ class DBATest extends DatabaseTest DI::init($dice); // Default config - Config::set('config', 'hostname', 'localhost'); - Config::set('system', 'throttle_limit_day', 100); - Config::set('system', 'throttle_limit_week', 100); - Config::set('system', 'throttle_limit_month', 100); - Config::set('system', 'theme', 'system_theme'); + DI::config()->set('config', 'hostname', 'localhost'); + DI::config()->set('system', 'throttle_limit_day', 100); + DI::config()->set('system', 'throttle_limit_week', 100); + DI::config()->set('system', 'throttle_limit_month', 100); + DI::config()->set('system', 'theme', 'system_theme'); } /** diff --git a/update.php b/update.php index d8591ec523..a40d19785c 100644 --- a/update.php +++ b/update.php @@ -65,7 +65,7 @@ function update_1178() function update_1179() { if (DI::config()->get('system', 'no_community_page')) { - Config::set('system', 'community_page_style', CP_NO_COMMUNITY_PAGE); + DI::config()->set('system', 'community_page_style', CP_NO_COMMUNITY_PAGE); } // Update the central item storage with uid=0 @@ -88,7 +88,7 @@ function update_1189() if (strlen(DI::config()->get('system', 'directory_submit_url')) && !strlen(DI::config()->get('system', 'directory'))) { - Config::set('system', 'directory', dirname(DI::config()->get('system', 'directory_submit_url'))); + DI::config()->set('system', 'directory', dirname(DI::config()->get('system', 'directory_submit_url'))); Config::delete('system', 'directory_submit_url'); } @@ -97,7 +97,7 @@ function update_1189() function update_1191() { - Config::set('system', 'maintenance', 1); + DI::config()->set('system', 'maintenance', 1); if (Addon::isEnabled('forumlist')) { $addon = 'forumlist'; @@ -114,7 +114,7 @@ function update_1191() // since Addon::uninstall() don't work here q("DELETE FROM `addon` WHERE `name` = 'forumlist' "); q("DELETE FROM `hook` WHERE `file` = 'addon/forumlist/forumlist.php' "); - Config::set('system', 'addon', implode(", ", $addons_arr)); + DI::config()->set('system', 'addon', implode(", ", $addons_arr)); } } } @@ -154,7 +154,7 @@ function update_1191() } } - Config::set('system', 'maintenance', 0); + DI::config()->set('system', 'maintenance', 0); return Update::SUCCESS; } @@ -193,7 +193,7 @@ function update_1245() return Update::SUCCESS; } - Config::set('system', 'rino_encrypt', 1); + DI::config()->set('system', 'rino_encrypt', 1); return Update::SUCCESS; } @@ -210,8 +210,8 @@ WHERE `hook` LIKE 'plugin_%'"); function update_1260() { - Config::set('system', 'maintenance', 1); - Config::set( + DI::config()->set('system', 'maintenance', 1); + DI::config()->set( 'system', 'maintenance_reason', DI::l10n()->t( @@ -252,7 +252,7 @@ function update_1260() DBA::e("UPDATE `thread` INNER JOIN `item` ON `thread`.`iid` = `item`.`id` SET `thread`.`author-id` = `item`.`author-id` WHERE `thread`.`author-id` = 0"); - Config::set('system', 'maintenance', 0); + DI::config()->set('system', 'maintenance', 0); return Update::SUCCESS; } @@ -265,8 +265,8 @@ function update_1261() function update_1278() { - Config::set('system', 'maintenance', 1); - Config::set( + DI::config()->set('system', 'maintenance', 1); + DI::config()->set( 'system', 'maintenance_reason', DI::l10n()->t( @@ -278,7 +278,7 @@ function update_1278() Item::update(['post-type' => Item::PT_PAGE], ['bookmark' => true]); Item::update(['post-type' => Item::PT_PERSONAL_NOTE], ['type' => 'note']); - Config::set('system', 'maintenance', 0); + DI::config()->set('system', 'maintenance', 0); return Update::SUCCESS; } @@ -415,7 +415,7 @@ function update_1330() // set the name of the storage instead of the classpath as config if (!empty($currStorage)) { /** @var Storage\IStorage $currStorage */ - if (!Config::set('storage', 'name', $currStorage::getName())) { + if (!DI::config()->set('storage', 'name', $currStorage::getName())) { return Update::FAILED; } diff --git a/view/theme/duepuntozero/config.php b/view/theme/duepuntozero/config.php index 5629d95c49..652cea9574 100644 --- a/view/theme/duepuntozero/config.php +++ b/view/theme/duepuntozero/config.php @@ -42,7 +42,7 @@ function theme_admin(App $a) function theme_admin_post(App $a) { if (isset($_POST['duepuntozero-settings-submit'])) { - Config::set('duepuntozero', 'colorset', $_POST['duepuntozero_colorset']); + DI::config()->set('duepuntozero', 'colorset', $_POST['duepuntozero_colorset']); } } diff --git a/view/theme/frio/config.php b/view/theme/frio/config.php index 95d9a0e4ec..2e76ae261c 100644 --- a/view/theme/frio/config.php +++ b/view/theme/frio/config.php @@ -34,18 +34,18 @@ function theme_admin_post(App $a) } if (isset($_POST['frio-settings-submit'])) { - Config::set('frio', 'scheme', $_POST['frio_scheme'] ?? ''); - Config::set('frio', 'nav_bg', $_POST['frio_nav_bg'] ?? ''); - Config::set('frio', 'nav_icon_color', $_POST['frio_nav_icon_color'] ?? ''); - Config::set('frio', 'link_color', $_POST['frio_link_color'] ?? ''); - Config::set('frio', 'background_color', $_POST['frio_background_color'] ?? ''); - Config::set('frio', 'contentbg_transp', $_POST['frio_contentbg_transp'] ?? ''); - Config::set('frio', 'background_image', $_POST['frio_background_image'] ?? ''); - Config::set('frio', 'bg_image_option', $_POST['frio_bg_image_option'] ?? ''); - Config::set('frio', 'login_bg_image', $_POST['frio_login_bg_image'] ?? ''); - Config::set('frio', 'login_bg_color', $_POST['frio_login_bg_color'] ?? ''); - Config::set('frio', 'css_modified', time()); - Config::set('frio', 'enable_compose', $_POST['frio_enable_compose'] ?? 0); + DI::config()->set('frio', 'scheme', $_POST['frio_scheme'] ?? ''); + DI::config()->set('frio', 'nav_bg', $_POST['frio_nav_bg'] ?? ''); + DI::config()->set('frio', 'nav_icon_color', $_POST['frio_nav_icon_color'] ?? ''); + DI::config()->set('frio', 'link_color', $_POST['frio_link_color'] ?? ''); + DI::config()->set('frio', 'background_color', $_POST['frio_background_color'] ?? ''); + DI::config()->set('frio', 'contentbg_transp', $_POST['frio_contentbg_transp'] ?? ''); + DI::config()->set('frio', 'background_image', $_POST['frio_background_image'] ?? ''); + DI::config()->set('frio', 'bg_image_option', $_POST['frio_bg_image_option'] ?? ''); + DI::config()->set('frio', 'login_bg_image', $_POST['frio_login_bg_image'] ?? ''); + DI::config()->set('frio', 'login_bg_color', $_POST['frio_login_bg_color'] ?? ''); + DI::config()->set('frio', 'css_modified', time()); + DI::config()->set('frio', 'enable_compose', $_POST['frio_enable_compose'] ?? 0); } } diff --git a/view/theme/quattro/config.php b/view/theme/quattro/config.php index 51915cfd7c..459a0d7f40 100644 --- a/view/theme/quattro/config.php +++ b/view/theme/quattro/config.php @@ -45,10 +45,10 @@ function theme_admin(App $a) { function theme_admin_post(App $a) { if (isset($_POST['quattro-settings-submit'])){ - Config::set('quattro', 'align', $_POST['quattro_align']); - Config::set('quattro', 'color', $_POST['quattro_color']); - Config::set('quattro', 'tfs', $_POST['quattro_tfs']); - Config::set('quattro', 'pfs', $_POST['quattro_pfs']); + DI::config()->set('quattro', 'align', $_POST['quattro_align']); + DI::config()->set('quattro', 'color', $_POST['quattro_color']); + DI::config()->set('quattro', 'tfs', $_POST['quattro_tfs']); + DI::config()->set('quattro', 'pfs', $_POST['quattro_pfs']); } } diff --git a/view/theme/vier/config.php b/view/theme/vier/config.php index 60c33975e2..2d185be2c8 100644 --- a/view/theme/vier/config.php +++ b/view/theme/vier/config.php @@ -90,14 +90,14 @@ function theme_admin(App $a) { function theme_admin_post(App $a) { if (isset($_POST['vier-settings-submit'])){ - Config::set('vier', 'style', $_POST['vier_style']); - Config::set('vier', 'show_pages', $_POST['vier_show_pages']); - Config::set('vier', 'show_profiles', $_POST['vier_show_profiles']); - Config::set('vier', 'show_helpers', $_POST['vier_show_helpers']); - Config::set('vier', 'show_services', $_POST['vier_show_services']); - Config::set('vier', 'show_friends', $_POST['vier_show_friends']); - Config::set('vier', 'show_lastusers', $_POST['vier_show_lastusers']); - Config::set('vier', 'helperlist', $_POST['vier_helperlist']); + DI::config()->set('vier', 'style', $_POST['vier_style']); + DI::config()->set('vier', 'show_pages', $_POST['vier_show_pages']); + DI::config()->set('vier', 'show_profiles', $_POST['vier_show_profiles']); + DI::config()->set('vier', 'show_helpers', $_POST['vier_show_helpers']); + DI::config()->set('vier', 'show_services', $_POST['vier_show_services']); + DI::config()->set('vier', 'show_friends', $_POST['vier_show_friends']); + DI::config()->set('vier', 'show_lastusers', $_POST['vier_show_lastusers']); + DI::config()->set('vier', 'helperlist', $_POST['vier_helperlist']); } } -- 2.39.5