diff --git a/database.sql b/database.sql index c413f2c24a..9ffa3544ac 100644 --- a/database.sql +++ b/database.sql @@ -1,6 +1,6 @@ -- ------------------------------------------ -- Friendica 2023.03-dev (Giant Rhubarb) --- DB_UPDATE_VERSION 1508 +-- DB_UPDATE_VERSION 1509 -- ------------------------------------------ diff --git a/src/Database/DBStructure.php b/src/Database/DBStructure.php index 7b284bf6d5..c0bd005d1e 100644 --- a/src/Database/DBStructure.php +++ b/src/Database/DBStructure.php @@ -74,7 +74,7 @@ class DBStructure $old_tables = ['fserver', 'gcign', 'gcontact', 'gcontact-relation', 'gfollower' ,'glink', 'item-delivery-data', 'item-activity', 'item-content', 'item_id', 'participation', 'poll', 'poll_result', 'queue', 'retriever_rule', 'deliverq', 'dsprphotoq', 'ffinder', 'sign', 'spam', 'term', 'user-item', 'thread', 'item', 'challenge', - 'auth_codes', 'tokens', 'clients', 'profile_check', 'host', 'conversation', 'fcontact', 'config']; + 'auth_codes', 'tokens', 'clients', 'profile_check', 'host', 'conversation', 'fcontact', 'config', 'addon']; $tables = DBA::selectToArray('INFORMATION_SCHEMA.TABLES', ['TABLE_NAME'], ['TABLE_SCHEMA' => DBA::databaseName(), 'TABLE_TYPE' => 'BASE TABLE']); diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php index 018bbf2c31..848da04040 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', 1508); + define('DB_UPDATE_VERSION', 1509); } return [ diff --git a/update.php b/update.php index 1dbf78e06f..584b8d788c 100644 --- a/update.php +++ b/update.php @@ -1192,5 +1192,23 @@ function update_1508() $newConfig->commit(); - DBA::e("TRUNCATE TABLE `config`"); + return DBA::e("TRUNCATE TABLE `config`") ? Update::SUCCESS : Update::FAILED; +} + +function update_1509() +{ + $addons = DBA::selectToArray('addon'); + + $newConfig = DI::config()->beginTransaction(); + + foreach ($addons as $addon) { + $newConfig->set('addons', $addon['name'], [ + 'last_update' => $addon['timestamp'], + 'admin' => (bool)$addon['plugin_admin'], + ]); + } + + $newConfig->commit(); + + return DBA::e("TRUNCATE TABLE `addon`") ? Update::SUCCESS : Update::FAILED; }