From b798ca2da6d0185f7f1c313e3402313af6338d5f Mon Sep 17 00:00:00 2001 From: Philipp Date: Tue, 10 Aug 2021 22:53:20 +0200 Subject: [PATCH] Force "Database" as default storage backend --- static/settings.config.php | 7 +++++++ update.php | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/static/settings.config.php b/static/settings.config.php index e8c6d09f81..96ae421ff0 100644 --- a/static/settings.config.php +++ b/static/settings.config.php @@ -203,4 +203,11 @@ return [ // Used in the admin settings to lock certain features 'featurelock' => [ ], + + // Storage backend configuration + 'storage' => [ + // name (String) + // The name of the current used backend (default is Database) + 'name' => 'Database', + ], ]; diff --git a/update.php b/update.php index 842fefca88..5d9c76a994 100644 --- a/update.php +++ b/update.php @@ -981,3 +981,20 @@ function update_1429() return Update::SUCCESS; } + +function update_1433() +{ + $name = DI::config()->get('storage', 'name'); + + // in case of an empty config, set "Database" as default storage backend + if (empty($name)) { + DI::config()->set('storage', 'name', Storage\Database::getName()); + } + + // In case of a Using deprecated storage class value, set the right name for it + if (stristr($name, 'Friendica\Model\Storage\\')) { + DI::config()->set('storage', 'name', substr($name, 24)); + } + + return Update::SUCCESS; +}