diff options
author | Stefan Giehl <stefan@matomo.org> | 2020-03-14 14:09:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-14 14:09:09 +0300 |
commit | 51522d95873a4b798bef186b082b19f9183e05a3 (patch) | |
tree | af38b87391f3e050c8fe7fd9636f9f8b169777d5 | |
parent | c1ddd0c1673abd6f2ab07afd5a20ce0749c7e591 (diff) |
Trigger SafeMode if a plugin update is broken (#15555)
* Trigger SafeMode if a plugin update is broken
* add comment
-rw-r--r-- | core/Updater.php | 4 | ||||
-rw-r--r-- | plugins/CoreUpdater/CoreUpdater.php | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/core/Updater.php b/core/Updater.php index 3057506fc3..f13e020b1c 100644 --- a/core/Updater.php +++ b/core/Updater.php @@ -241,7 +241,9 @@ class Updater $className = $this->getUpdateClassName($componentName, $fileVersion); if (!class_exists($className, false)) { - throw new \Exception("The class $className was not found in $file"); + // throwing an error here causes Matomo to show the safe mode instead of showing an exception fatal only + // that makes it possible to deactivate / uninstall a broken plugin to recover Matomo directly + throw new \Error("The class $className was not found in $file"); } if (in_array($className, $classNames)) { diff --git a/plugins/CoreUpdater/CoreUpdater.php b/plugins/CoreUpdater/CoreUpdater.php index f24bf25cd2..2265793b3e 100644 --- a/plugins/CoreUpdater/CoreUpdater.php +++ b/plugins/CoreUpdater/CoreUpdater.php @@ -65,6 +65,8 @@ class CoreUpdater extends \Piwik\Plugin || $module == 'Proxy' // Do not show update page during installation. || $module == 'Installation' + || ($module == 'CorePluginsAdmin' && $action == 'deactivate') + || ($module == 'CorePluginsAdmin' && $action == 'uninstall') || ($module == 'LanguagesManager' && $action == 'saveLanguage')) { return; } |