]> git.mxchange.org Git - friendica.git/blobdiff - src/Database/DBStructure.php
Issue 11508: Sanitizing date fields for events and polls
[friendica.git] / src / Database / DBStructure.php
index 4a1588dd12856ca90ab65f1f038da4f287b481a5..2638bafab767f825d56932ba1bc82697af0b0872 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -82,7 +82,7 @@ class DBStructure
                $old_tables = ['fserver', 'gcign', 'gcontact', 'gcontact-relation', 'gfollower' ,'glink', 'item-delivery-data',
                        'item-activity', 'item-content', 'item_id', 'participation', 'poll', 'poll_result', 'queue', 'retriever_rule',
                        'deliverq', 'dsprphotoq', 'ffinder', 'sign', 'spam', 'term', 'user-item', 'thread', 'item', 'challenge',
-                       'auth_codes', 'clients', 'tokens', 'profile_check'];
+                       'auth_codes', 'tokens', 'clients', 'profile_check', 'host'];
 
                $tables = DBA::selectToArray(['INFORMATION_SCHEMA' => 'TABLES'], ['TABLE_NAME'],
                        ['TABLE_SCHEMA' => DBA::databaseName(), 'TABLE_TYPE' => 'BASE TABLE']);
@@ -96,10 +96,10 @@ class DBStructure
                        echo DI::l10n()->t('These tables are not used for friendica and will be deleted when you execute "dbstructure drop -e":') . "\n\n";
                }
 
-               foreach ($tables as $table) {
-                       if (in_array($table['TABLE_NAME'], $old_tables)) {
+               foreach ($old_tables as $table) {
+                       if (in_array($table, array_column($tables, 'TABLE_NAME'))) {
                                if ($execute) {
-                                       $sql = 'DROP TABLE ' . DBA::quoteIdentifier($table['TABLE_NAME']) . ';';
+                                       $sql = 'DROP TABLE ' . DBA::quoteIdentifier($table) . ';';
                                        echo $sql . "\n";
 
                                        $result = DBA::e($sql);
@@ -107,7 +107,7 @@ class DBStructure
                                                self::printUpdateError($sql);
                                        }
                                } else {
-                                       echo $table['TABLE_NAME'] . "\n";
+                                       echo $table . "\n";
                                }
                        }
                }