]> git.mxchange.org Git - friendica.git/commitdiff
Fix: Only echo on verbose
authorMichael <heluecht@pirati.ca>
Mon, 23 Nov 2020 19:47:30 +0000 (19:47 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 23 Nov 2020 19:47:30 +0000 (19:47 +0000)
src/Database/DBStructure.php

index bda6f81f76464abca6c0b2950d83369eeaed0de4..aa6a0cf29b66741682882cd9fdfc351667a67d5e 100644 (file)
@@ -1090,9 +1090,9 @@ class DBStructure
                                        echo "Zero user added\n";
                                }
                        }
-               } elseif (self::existsTable('user')) {
+               } elseif (self::existsTable('user') && $verbose) {
                        echo "Zero user already added\n";
-               } else {
+               } elseif ($verbose) {
                        echo "user: Table not found\n";
                }
 
@@ -1105,12 +1105,27 @@ class DBStructure
                                        echo "Zero contact added\n";
                                }
                        }               
-               } elseif (self::existsTable('contact')) {
+               } elseif (self::existsTable('contact') && $verbose) {
                        echo "Zero contact already added\n";
-               } else {
+               } elseif ($verbose) {
                        echo "contact: Table not found\n";
                }
 
+               if (self::existsTable('tag') && !DBA::exists('tag', ['id' => 0])) {
+                       DBA::insert('tag', ['name' => '']);
+                       $lastid = DBA::lastInsertId();
+                       if ($lastid != 0) {
+                               DBA::update('tag', ['id' => 0], ['id' => $lastid]);
+                               if ($verbose) {
+                                       echo "Zero tag added\n";
+                               }
+                       }
+               } elseif (self::existsTable('tag') && $verbose) {
+                       echo "Zero tag already added\n";
+               } elseif ($verbose) {
+                       echo "tag: Table not found\n";
+               }
+
                if (self::existsTable('permissionset')) {
                        if (!DBA::exists('permissionset', ['id' => 0])) {
                                DBA::insert('permissionset', ['allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '']);       
@@ -1118,7 +1133,7 @@ class DBStructure
                                if ($lastid != 0) {
                                        DBA::update('permissionset', ['id' => 0], ['id' => $lastid]);
                                        if ($verbose) {
-                                               echo "Zero tag added\n";
+                                               echo "Zero permissionset added\n";
                                        }
                                }
                        } elseif ($verbose) {
@@ -1149,21 +1164,6 @@ class DBStructure
                        echo "permissionset: Table not found\n";
                }
        
-               if (self::existsTable('tag') && !DBA::exists('tag', ['id' => 0])) {
-                       DBA::insert('tag', ['name' => '']);
-                       $lastid = DBA::lastInsertId();
-                       if ($lastid != 0) {
-                               DBA::update('tag', ['id' => 0], ['id' => $lastid]);
-                               if ($verbose) {
-                                       echo "Zero tag added\n";
-                               }
-                       }
-               } elseif (self::existsTable('tag')) {
-                       echo "Zero tag already added\n";
-               } else {
-                       echo "tag: Table not found\n";
-               }
-
                if (!self::existsForeignKeyForField('tokens', 'client_id')) {
                        $tokens = DBA::p("SELECT `tokens`.`id` FROM `tokens`
                                LEFT JOIN `clients` ON `clients`.`client_id` = `tokens`.`client_id`