Replace addon "last" config entries with key-value entries
This commit is contained in:
parent
b227d65dfc
commit
1ed67fba3d
2 changed files with 12 additions and 5 deletions
|
@ -2145,7 +2145,7 @@ class GServer
|
|||
*/
|
||||
private static function discoverFederation()
|
||||
{
|
||||
$last = DI::config()->get('poco', 'last_federation_discovery');
|
||||
$last = DI::keyValue()->get('poco_last_federation_discovery');
|
||||
|
||||
if ($last) {
|
||||
$next = $last + (24 * 60 * 60);
|
||||
|
@ -2189,7 +2189,7 @@ class GServer
|
|||
}
|
||||
}
|
||||
|
||||
DI::config()->set('poco', 'last_federation_discovery', time());
|
||||
DI::keyValue()->set('poco_last_federation_discovery', time());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
13
update.php
13
update.php
|
@ -1149,18 +1149,25 @@ function update_1502()
|
|||
function update_1505()
|
||||
{
|
||||
$conditions = [
|
||||
"(`cat` = ?) AND ((`k` LIKE ?) OR (`k` = ?) OR (`k` LIKE ?) OR (`k` = ?))",
|
||||
"((`cat` = ?) AND ((`k` LIKE ?) OR (`k` = ?) OR (`k` LIKE ?) OR (`k` = ?))) OR " .
|
||||
"((`cat` != ?) AND (`k` LIKE ?))",
|
||||
"system",
|
||||
"post_update_%",
|
||||
"worker_last_cleaned",
|
||||
"last%",
|
||||
"worker_daemon_mode",
|
||||
"system",
|
||||
"last_%",
|
||||
];
|
||||
|
||||
$postUpdateEntries = DBA::selectToArray('config', ['k', 'v'], $conditions);
|
||||
$postUpdateEntries = DBA::selectToArray('config', ['cat', 'k', 'v'], $conditions);
|
||||
|
||||
foreach ($postUpdateEntries as $postUpdateEntry) {
|
||||
DI::keyValue()->set($postUpdateEntry['k'], $postUpdateEntry['v']);
|
||||
if ($postUpdateEntry['cat'] === 'system') {
|
||||
DI::keyValue()->set($postUpdateEntry['k'], $postUpdateEntry['v']);
|
||||
} else {
|
||||
DI::keyValue()->set(sprintf('%s_%s', $postUpdateEntry['cat'], $postUpdateEntry['k']), $postUpdateEntry['v']);
|
||||
}
|
||||
}
|
||||
|
||||
return DBA::delete('config', $conditions) ? Update::SUCCESS : Update::FAILED;
|
||||
|
|
Loading…
Reference in a new issue