-- ------------------------------------------
-- Friendica 2023.03-dev (Giant Rhubarb)
--- DB_UPDATE_VERSION 1508
+-- DB_UPDATE_VERSION 1509
-- ------------------------------------------
$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']);
$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;
}