一时手贱选择了更新到最新版本Matomo 4.0.X beta,还有些bug,直接用回3.X的程序覆盖对接会提示版本不对,无法使用,好险Matomo官方提供降级方式。
1、备份当前数据库配置文件:
路径:config/config.ini.php
2、上传3.0X的程序,并上传数据库配置文件到相同目录。
3、到Motomo数据库执行SQL降级,如果是早期安装的,下面 matomo 批量改 piwik
ALTER TABLE matomo_user ADD COLUMN alias VARCHAR(45) NOT NULL;
ALTER TABLE matomo_user ADD COLUMN token_auth CHAR(32) NOT NULL;
UPDATE matomo_user set token_auth = MD5(CONCAT(NOW(), UUID())), `alias` = `login`;
ALTER TABLE matomo_log_visit ADD COLUMN config_gears TINYINT(1) NOT NULL, ADD COLUMN config_director TINYINT(1) NOT NULL;
ALTER TABLE `matomo_log_link_visit_action` CHANGE `pageview_position` `interaction_position` MEDIUMINT UNSIGNED DEFAULT NULL;
ALTER TABLE matomo_log_visit ADD COLUMN visitor_days_since_first INT(11) UNSIGNED NULL;
ALTER TABLE matomo_log_visit ADD COLUMN visitor_days_since_order INT(11) UNSIGNED NULL;
ALTER TABLE matomo_log_visit ADD COLUMN visitor_days_since_last INT(11) UNSIGNED NULL;
ALTER TABLE matomo_log_conversion ADD COLUMN visitor_days_since_first INT(11) UNSIGNED NULL;
ALTER TABLE matomo_log_conversion ADD COLUMN visitor_days_since_order INT(11) UNSIGNED NULL;
UPDATE matomo_log_visit SET visitor_days_since_first = ROUND(visitor_seconds_since_first / 86400), visitor_days_since_order = ROUND(visitor_seconds_since_order / 86400), visitor_days_since_last = ROUND(visitor_seconds_since_last / 86400);
UPDATE matomo_option set option_value = ‘3.13.6’ where option_value like ‘4.0.0%’;
4、直接访问matomo网址按网页提示操作即可。
参考官方文献:https://matomo.org/faq/how-to/how-do-i-downgrade-from-matomo-4-to-matomo-3/