From 1075bfb189b2c2fba0e73ffeefe4f127dfe5f084 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 17 Dec 2019 07:10:55 +0000 Subject: [PATCH] Issue 7659: Udate the "user-contact" value with the "contact" values --- static/dbstructure.config.php | 2 +- update.php | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php index 078d7c1177..bd8da30f67 100755 --- a/static/dbstructure.config.php +++ b/static/dbstructure.config.php @@ -34,7 +34,7 @@ use Friendica\Database\DBA; if (!defined('DB_UPDATE_VERSION')) { - define('DB_UPDATE_VERSION', 1326); + define('DB_UPDATE_VERSION', 1327); } return [ diff --git a/update.php b/update.php index 3132677ea7..40f39ebeba 100644 --- a/update.php +++ b/update.php @@ -396,3 +396,15 @@ function update_1323() return Update::SUCCESS; } +function update_1327() +{ + $contacts = DBA::select('contact', ['uid', 'id', 'blocked', 'readonly'], ["`uid` != ? AND (`blocked` OR `readonly`) AND NOT `pending`", 0]); + while ($contact = DBA::fetch($contacts)) { + Contact::setBlockedForUser($contact['id'], $contact['uid'], $contact['blocked']); + Contact::setIgnoredForUser($contact['id'], $contact['uid'], $contact['readonly']); + } + DBA::close($contacts); + + return Update::SUCCESS; +} +