]> git.mxchange.org Git - friendica.git/blobdiff - update.php
Fix "Undefined constant Friendica\Content\Conversation::PARCEL_DIASPORA"
[friendica.git] / update.php
index 9aaf95193be26165befb87fe48d5e9af690ac33c..85a06892f04c99a542545221ceba5bdfa4f0ad07 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,9 +1148,14 @@ 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 ?))",
+               "((`cat` != ?) AND  (`k` LIKE ?)) OR " .
+               "((`cat`  = ?) AND  (`k` LIKE ?))",
                "system",
                "post_update_%",
                "worker_last_cleaned",
@@ -1158,6 +1163,8 @@ function update_1505()
                "worker_daemon_mode",
                "system",
                "last_%",
+               "database",
+               "update_%",
        ];
 
        $postUpdateEntries = DBA::selectToArray('config', ['cat', 'k', 'v'], $conditions);
@@ -1172,3 +1179,51 @@ 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();
+
+       return Update::SUCCESS;
+}
+
+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 Update::SUCCESS;
+}
+
+function update_1510()
+{
+       $blocks = DBA::select('pconfig', ['uid', 'v'], ['cat' => 'blockem', 'k' => 'words']);
+       while ($block = DBA::fetch($blocks)) {
+               foreach (explode(',', $block['v']) as $account) {
+                       $id = Contact::getIdForURL(trim($account), 0, false);
+                       if (empty($id)) {
+                               continue;
+                       }
+                       Contact\User::setCollapsed($id, $block['uid'], true);
+               }
+       }
+       return Update::SUCCESS;
+}