Merge pull request #9982 from annando/issue-9975

Issue 9975: Remove unused views
This commit is contained in:
Tobias Diekershoff 2021-03-04 10:19:38 +01:00 committed by GitHub
commit a23c3111a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View 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) {