diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2019-01-25 00:09:05 +0300 |
---|---|---|
committer | diosmosis <diosmosis@users.noreply.github.com> | 2019-01-25 00:09:05 +0300 |
commit | d95e2d0792bd229b31b000818c973191eee3b7e3 (patch) | |
tree | d1ddcea6c26878181e26d6c4a680a88e59a7a3d5 /core/Updates | |
parent | df561f7e954b5d45a4201ada32fb9bd5df3f2470 (diff) |
Only migrate GoogleAuthentication if plugin is activated (#14022)
fix https://github.com/matomo-org/matomo/issues/14020
see https://forum.matomo.org/t/post-upgrade-superuser-login/31401
Diffstat (limited to 'core/Updates')
-rw-r--r-- | core/Updates/3.8.0-b3.php | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/core/Updates/3.8.0-b3.php b/core/Updates/3.8.0-b3.php index 83cc13e4fb..0455683138 100644 --- a/core/Updates/3.8.0-b3.php +++ b/core/Updates/3.8.0-b3.php @@ -12,6 +12,7 @@ namespace Piwik\Updates; use Piwik\Common; use Piwik\Db; use Piwik\Option; +use Piwik\Plugin; use Piwik\Updater; use Piwik\Updates as PiwikUpdates; use Piwik\Updater\Migration\Factory as MigrationFactory; @@ -47,14 +48,17 @@ class Updates_3_8_0_b3 extends PiwikUpdates { $updater->executeMigrations(__FILE__, $this->getMigrations($updater)); - foreach (Option::getLike('GoogleAuthentication.%') as $name => $value) { - $value = @unserialize($value); - if (!empty($value['isActive']) && !empty($value['secret'])) { - $login = str_replace('GoogleAuthentication.', '', $name); + if (Plugin\Manager::getInstance()->isPluginActivated('GoogleAuthenticator')) { + foreach (Option::getLike('GoogleAuthentication.%') as $name => $value) { + $value = @unserialize($value); + if (!empty($value['isActive']) && !empty($value['secret'])) { + $login = str_replace('GoogleAuthentication.', '', $name); - $table = Common::prefixTable('user'); - Db::query("UPDATE $table SET twofactor_secret = ? where login = ?", array($value['secret'], $login)); + $table = Common::prefixTable('user'); + Db::query("UPDATE $table SET twofactor_secret = ? where login = ?", array($value['secret'], $login)); + } } } + } } |