]> git.mxchange.org Git - friendica.git/commitdiff
Changed order of inserts
authorMichael <heluecht@pirati.ca>
Wed, 18 Nov 2020 00:13:39 +0000 (00:13 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 18 Nov 2020 00:13:39 +0000 (00:13 +0000)
src/Database/DBStructure.php

index a59376e0ca5a288a3c3ff621b18ad09ef414faa8..3c443d5371db480db332c459c9d0fc17cc7208ee 100644 (file)
@@ -1055,6 +1055,22 @@ class DBStructure
                }
 
                if (self::existsTable('user') && !DBA::exists('user', ['uid' => 0])) {
+                       DBA::insert('user', ['uid' => 0]);
+                       $lastid = DBA::lastInsertId();
+                       if ($lastid != 0) {
+                               DBA::update('user', ['uid' => 0], ['uid' => $lastid]);
+                       }
+               }
+
+               if (self::existsTable('contact') && !DBA::exists('contact', ['id' => 0])) {
+                       DBA::insert('contact', ['nurl' => '']);
+                       $lastid = DBA::lastInsertId();
+                       if ($lastid != 0) {
+                               DBA::update('contact', ['id' => 0], ['id' => $lastid]);
+                       }               
+               }
+
+               if (self::existsTable('user') && DBA::exists('user', ['uid' => 0])) {
                        $system = User::getSystemAccount();
                        $user = [
                                "username" => $system['name'],
@@ -1069,19 +1085,7 @@ class DBStructure
                                "account-type" => User::ACCOUNT_TYPE_RELAY,
                        ];
        
-                       DBA::insert('user', $user);
-                       $lastid = DBA::lastInsertId();
-                       if ($lastid != 0) {
-                               DBA::update('user', ['uid' => 0], ['uid' => $lastid]);
-                       }
-               }
-
-               if (self::existsTable('contact') && !DBA::exists('contact', ['id' => 0])) {
-                       DBA::insert('contact', ['nurl' => '']);
-                       $lastid = DBA::lastInsertId();
-                       if ($lastid != 0) {
-                               DBA::update('contact', ['id' => 0], ['id' => $lastid]);
-                       }               
+                       DBA::update('user', $user, ['uid' => 0]);
                }
 
                if (self::existsTable('permissionset')) {