From d76963944ad886cfc73183e3c0624627b89662eb Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 22 Jan 2023 13:40:08 +0000 Subject: [PATCH 1/4] More configs moved to key values --- src/Core/Config/Model/Config.php | 3 +++ src/Module/Admin/Summary.php | 3 ++- src/Worker/CheckVersion.php | 2 +- static/dbstructure.config.php | 2 +- update.php | 9 +++++++++ 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Core/Config/Model/Config.php b/src/Core/Config/Model/Config.php index 46d5643b34..0a242c8587 100644 --- a/src/Core/Config/Model/Config.php +++ b/src/Core/Config/Model/Config.php @@ -27,6 +27,8 @@ use Friendica\Core\Config\Exception\ConfigFileException; use Friendica\Core\Config\Exception\ConfigPersistenceException; use Friendica\Core\Config\Util\ConfigFileManager; use Friendica\Core\Config\ValueObject\Cache; +use Friendica\Core\Logger; +use Friendica\Core\System; /** * Configuration model, which manages the whole system configuration @@ -118,6 +120,7 @@ class Config implements IManageConfigValues /** {@inheritDoc} */ public function set(string $cat, string $key, $value): bool { + Logger::debug('Set config value', ['cat' => $cat, 'key' => $key, 'value' => $value, 'callstack' => System::callstack(20)]); if ($this->configCache->set($cat, $key, $value, Cache::SOURCE_DATA)) { $this->save(); return true; diff --git a/src/Module/Admin/Summary.php b/src/Module/Admin/Summary.php index e963e7606d..f9c8cefbb6 100644 --- a/src/Module/Admin/Summary.php +++ b/src/Module/Admin/Summary.php @@ -79,7 +79,8 @@ class Summary extends BaseAdmin // Check if github.com/friendica/stable/VERSION is higher then // the local version of Friendica. Check is opt-in, source may be stable or develop branch if (DI::config()->get('system', 'check_new_version_url', 'none') != 'none') { - $gitversion = DI::config()->get('system', 'git_friendica_version'); + $gitversion = DI::keyValue()->get('git_friendica_version'); + if (version_compare(App::VERSION, $gitversion) < 0) { $warningtext[] = DI::l10n()->t('There is a new version of Friendica available for download. Your current version is %1$s, upstream version is %2$s', App::VERSION, $gitversion); } diff --git a/src/Worker/CheckVersion.php b/src/Worker/CheckVersion.php index 6676e51127..f4c45fe33d 100644 --- a/src/Worker/CheckVersion.php +++ b/src/Worker/CheckVersion.php @@ -58,7 +58,7 @@ class CheckVersion $gitversion = DBA::escape(trim(DI::httpClient()->fetch($checked_url, HttpClientAccept::TEXT))); Logger::notice("Upstream VERSION is: ".$gitversion); - DI::config()->set('system', 'git_friendica_version', $gitversion); + DI::keyValue()->set('git_friendica_version', $gitversion); Logger::notice('checkversion: end'); diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php index 4329410b4a..9dfd7820c1 100644 --- a/static/dbstructure.config.php +++ b/static/dbstructure.config.php @@ -55,7 +55,7 @@ use Friendica\Database\DBA; if (!defined('DB_UPDATE_VERSION')) { - define('DB_UPDATE_VERSION', 1512); + define('DB_UPDATE_VERSION', 1513); } return [ diff --git a/update.php b/update.php index 8f93775259..7d9a9d2363 100644 --- a/update.php +++ b/update.php @@ -1244,3 +1244,12 @@ function update_1512() DI::config()->delete('nodeinfo', 'local_posts'); DI::config()->delete('nodeinfo', 'local_comments'); } + +function update_1513() +{ + DI::keyValue()->set('git_friendica_version', DI::config()->get('system', 'git_friendica_version')); + DI::keyValue()->set('twitter_application_name', DI::config()->get('twitter', 'application_name')); + + DI::config()->delete('system', 'git_friendica_version'); + DI::config()->delete('twitter', 'application_name'); +} From 70d942bd8b8807e1d0911b00e17251cec473e813 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 22 Jan 2023 13:47:33 +0000 Subject: [PATCH 2/4] Updated database.sql --- database.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database.sql b/database.sql index 0b91aedc06..843db1f6cf 100644 --- a/database.sql +++ b/database.sql @@ -1,6 +1,6 @@ -- ------------------------------------------ -- Friendica 2023.03-dev (Giant Rhubarb) --- DB_UPDATE_VERSION 1512 +-- DB_UPDATE_VERSION 1513 -- ------------------------------------------ From 415e592886da235bc8ea251cecbea08cf8a234a4 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 22 Jan 2023 13:58:28 +0000 Subject: [PATCH 3/4] Debug message removed --- src/Core/Config/Model/Config.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Core/Config/Model/Config.php b/src/Core/Config/Model/Config.php index 0a242c8587..46d5643b34 100644 --- a/src/Core/Config/Model/Config.php +++ b/src/Core/Config/Model/Config.php @@ -27,8 +27,6 @@ use Friendica\Core\Config\Exception\ConfigFileException; use Friendica\Core\Config\Exception\ConfigPersistenceException; use Friendica\Core\Config\Util\ConfigFileManager; use Friendica\Core\Config\ValueObject\Cache; -use Friendica\Core\Logger; -use Friendica\Core\System; /** * Configuration model, which manages the whole system configuration @@ -120,7 +118,6 @@ class Config implements IManageConfigValues /** {@inheritDoc} */ public function set(string $cat, string $key, $value): bool { - Logger::debug('Set config value', ['cat' => $cat, 'key' => $key, 'value' => $value, 'callstack' => System::callstack(20)]); if ($this->configCache->set($cat, $key, $value, Cache::SOURCE_DATA)) { $this->save(); return true; From 9e9aa4b108d3bbfc16f51d56fd03957516b28715 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 22 Jan 2023 21:35:24 +0100 Subject: [PATCH 4/4] Update src/Module/Admin/Summary.php Co-authored-by: Hypolite Petovan --- src/Module/Admin/Summary.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module/Admin/Summary.php b/src/Module/Admin/Summary.php index f9c8cefbb6..9ca71e33d2 100644 --- a/src/Module/Admin/Summary.php +++ b/src/Module/Admin/Summary.php @@ -79,7 +79,7 @@ class Summary extends BaseAdmin // Check if github.com/friendica/stable/VERSION is higher then // the local version of Friendica. Check is opt-in, source may be stable or develop branch if (DI::config()->get('system', 'check_new_version_url', 'none') != 'none') { - $gitversion = DI::keyValue()->get('git_friendica_version'); + $gitversion = DI::keyValue()->get('git_friendica_version') ?? ''; if (version_compare(App::VERSION, $gitversion) < 0) { $warningtext[] = DI::l10n()->t('There is a new version of Friendica available for download. Your current version is %1$s, upstream version is %2$s', App::VERSION, $gitversion);