]> git.mxchange.org Git - friendica.git/blobdiff - update.php
Merge pull request #12606 from nupplaphil/bug/file_put
[friendica.git] / update.php
index 2235b04512f40d13b0d2022f2215cc9a2e67de1d..1dbf78e06f915647cf6300c4886623fe4ca8fdaa 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -59,8 +59,8 @@ use Friendica\Model\Photo;
 use Friendica\Model\Post;
 use Friendica\Model\Profile;
 use Friendica\Model\User;
+use Friendica\Protocol\Delivery;
 use Friendica\Security\PermissionSet\Repository\PermissionSet;
-use Friendica\Worker\Delivery;
 
 // Post-update script of PR 5751
 function update_1298()
@@ -1148,6 +1148,10 @@ function update_1502()
 
 function update_1505()
 {
+       if (!DBStructure::existsTable('config')) {
+               return Update::SUCCESS;
+       }
+
        $conditions = [
                "((`cat`  = ?) AND ((`k` LIKE ?) OR (`k` = ?) OR (`k` LIKE ?) OR (`k` = ?))) OR " .
                "((`cat` != ?) AND  (`k` LIKE ?)) OR " .
@@ -1175,3 +1179,18 @@ function update_1505()
 
        return DBA::delete('config', $conditions) ? Update::SUCCESS : Update::FAILED;
 }
+
+function update_1508()
+{
+       $config = DBA::selectToArray('config');
+
+       $newConfig = DI::config()->beginTransaction();
+
+       foreach ($config as $entry) {
+               $newConfig->set($entry['cat'], $entry['k'], $entry['v']);
+       }
+
+       $newConfig->commit();
+
+       DBA::e("TRUNCATE TABLE `config`");
+}