diff options
Diffstat (limited to 'core/Updates/3.0.0-b1.php')
-rw-r--r-- | core/Updates/3.0.0-b1.php | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/core/Updates/3.0.0-b1.php b/core/Updates/3.0.0-b1.php index bb3bf57350..1b08d48fcb 100644 --- a/core/Updates/3.0.0-b1.php +++ b/core/Updates/3.0.0-b1.php @@ -68,11 +68,8 @@ class Updates_3_0_0_b1 extends Updates ServerFilesGenerator::createHtAccessFiles(); // Renamed plugin ExampleRssWidget -> RssWidget - try { - \Piwik\Plugin\Manager::getInstance()->activatePlugin('RssWidget'); - \Piwik\Plugin\Manager::getInstance()->deactivatePlugin('ExampleRssWidget'); - } catch (\Exception $e) { - } + \Piwik\Plugin\Manager::getInstance()->activatePlugin('RssWidget'); + \Piwik\Plugin\Manager::getInstance()->deactivatePlugin('ExampleRssWidget'); } private function migratePluginEmailUpdateSetting() @@ -166,17 +163,23 @@ class Updates_3_0_0_b1 extends Updates private function getSiteSettingsMigrations($queries) { $table = $this->siteSettingsTable; - $queries[] = $this->migration->db->addColumn($table, 'plugin_name', 'VARCHAR(60) NOT NULL', $afer = 'idsite'); + + // we cannot migrate existing settings as we do not know the related plugin name, but this feature + // (measurablesettings) was not used anyway. also see https://github.com/piwik/piwik/issues/10703 + // we make sure to recreate the table as it might not have existed for some users instead of just + // deleting the content of it + $queries[] = $this->migration->db->dropTable($table); + $queries[] = $this->migration->db->createTable($table, array( + 'idsite' => 'INTEGER(10) UNSIGNED NOT NULL', + 'plugin_name' => 'VARCHAR(60) NOT NULL', + 'setting_name' => 'VARCHAR(255) NOT NULL', + 'setting_value' => 'LONGTEXT NOT NULL', + )); $table = Common::prefixTable($table); - $queries[] = $this->migration->db->sql("ALTER TABLE `$table` DROP PRIMARY KEY, ADD INDEX(idsite, plugin_name);", + $queries[] = $this->migration->db->sql("ALTER TABLE `$table` ADD INDEX(idsite, plugin_name);", Migration\Db::ERROR_CODE_COLUMN_NOT_EXISTS); - // we cannot migrate existing settings as we do not know the related plugin name, but this feature - // (measurablesettings) was not really used anyway. If a migration is somewhere really needed it has to be - // handled in the plugin - $queries[] = $this->migration->db->sql(sprintf('DELETE FROM `%s`', $table)); - return $queries; } |