Update routine to transfer the blockem list to collapsed

This commit is contained in:
Michael 2023-01-08 18:59:07 +00:00
parent 5738d480da
commit b0aa4eb4b7
3 changed files with 17 additions and 2 deletions

View File

@ -1,6 +1,6 @@
-- ------------------------------------------
-- Friendica 2023.03-dev (Giant Rhubarb)
-- DB_UPDATE_VERSION 1509
-- DB_UPDATE_VERSION 1510
-- ------------------------------------------

View File

@ -55,7 +55,7 @@
use Friendica\Database\DBA;
if (!defined('DB_UPDATE_VERSION')) {
define('DB_UPDATE_VERSION', 1509);
define('DB_UPDATE_VERSION', 1510);
}
return [

View File

@ -1213,3 +1213,18 @@ function update_1509()
return Update::SUCCESS;
}
function update_1510()
{
$blocks = DBA::select('pconfig', ['uid', 'v'], ['cat' => 'blockem', 'k' => 'words']);
while ($block = DBA::fetch($blocks)) {
foreach (explode(',', $block['v']) as $account) {
$id = Contact::getIdForURL(trim($account), 0, false);
if (empty($id)) {
continue;
}
Contact\User::setCollapsed($id, $block['uid'], true);
}
}
return Update::SUCCESS;
}