]> git.mxchange.org Git - friendica.git/commitdiff
Replace addon "last" config entries with key-value entries
authorPhilipp <admin@philipp.info>
Thu, 29 Dec 2022 19:51:04 +0000 (20:51 +0100)
committerPhilipp <admin@philipp.info>
Thu, 29 Dec 2022 20:53:57 +0000 (21:53 +0100)
src/Model/GServer.php
update.php

index b0a9dd5c9a590210d233d2161932df2f6239e2f8..6945fab3e01ffd8b168c1e25581e4409d856a46e 100644 (file)
@@ -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());
        }
 
        /**
index ff3b6b536257779057e65ef59cb7a833e7826078..9aaf95193be26165befb87fe48d5e9af690ac33c 100644 (file)
@@ -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;