From 317fdce1c7a7116f6879f46f78ade506c5057f46 Mon Sep 17 00:00:00 2001
From: diosmosis <benaka@piwik.pro>
Date: Tue, 17 Mar 2015 17:58:30 -0700
Subject: [PATCH] Correctly filter out InnoDB tables in Db::optimizeTables.

---
 core/Db.php | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/core/Db.php b/core/Db.php
index 25409ecce5..8c718ceac5 100644
--- a/core/Db.php
+++ b/core/Db.php
@@ -324,7 +324,7 @@ class Db
         $optimize = Config::getInstance()->General['enable_sql_optimize_queries'];
 
         if (empty($optimize)) {
-            return;
+            return false;
         }
 
         if (empty($tables)) {
@@ -345,14 +345,16 @@ class Db
                     $myisamDbTables[] = $row['Name'];
                 }
             }
+
+            $tables = $myisamDbTables;
         }
 
-        if (empty($myisamDbTables)) {
+        if (empty($tables)) {
             return false;
         }
 
         // optimize the tables
-        return self::query("OPTIMIZE TABLE " . implode(',', $myisamDbTables));
+        return self::query("OPTIMIZE TABLE " . implode(',', $tables));
     }
 
     private static function getTableStatus()
-- 
GitLab