]> git.mxchange.org Git - friendica.git/commitdiff
Issue 9975: Remove unused views
authorMichael <heluecht@pirati.ca>
Thu, 4 Mar 2021 00:02:34 +0000 (00:02 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 4 Mar 2021 00:02:34 +0000 (00:02 +0000)
src/Database/View.php

index e49eb8cc51cfcc7f664b1054e83cc1eff823401a..dd3c3e39fc076b2e081ca8fd3727769d9d6301b9 100644 (file)
@@ -77,6 +77,20 @@ class View
 
        public static function create(bool $verbose, bool $action)
        {
+               // Delete previously used views that aren't used anymore
+               foreach(['post-view', 'post-thread-view'] as $view) {
+                       if (self::isView($view)) {
+                               $sql = sprintf("DROP VIEW IF EXISTS `%s`", DBA::escape($view));
+                               if (!empty($sql) && $verbose) {
+                                       echo $sql . ";\n";
+                               }
+               
+                               if (!empty($sql) && $action) {
+                                       DBA::e($sql);
+                               }
+                       }
+               }
+
                $definition = self::definition();
 
                foreach ($definition as $name => $structure) {