diff options
author | Matthieu Aubry <mattab@users.noreply.github.com> | 2017-02-21 13:27:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-21 13:27:13 +0300 |
commit | 64416dc79f47c7f3fb4d1387c85ad7d78d01abc1 (patch) | |
tree | 912f23bd9be257962f16c1303014eed1961de856 | |
parent | 7522132d4e8e6200531c09bcd6ed384071b56610 (diff) |
Make activated plugins count in Admin widget correct (#11377)
* Do not count always activated plugins.
Fixes #11144
* UI test: Fixed count of activated plugins
-rw-r--r-- | core/Plugin/Manager.php | 5 | ||||
-rw-r--r-- | plugins/CoreHome/Widgets/GetSystemSummary.php | 6 | ||||
-rw-r--r-- | tests/UI/expected-screenshots/UIIntegrationTest_admin_home.png | 4 |
3 files changed, 8 insertions, 7 deletions
diff --git a/core/Plugin/Manager.php b/core/Plugin/Manager.php index 9cf941a135..b1e97f7f8b 100644 --- a/core/Plugin/Manager.php +++ b/core/Plugin/Manager.php @@ -554,13 +554,14 @@ class Manager throw new \Exception('Theme not found : ' . $themeName); } - public function getNumberOfActivatedPlugins() + public function getNumberOfActivatedPluginsExcludingAlwaysActivated() { $counter = 0; $pluginNames = $this->getLoadedPluginsName(); foreach ($pluginNames as $pluginName) { - if ($this->isPluginActivated($pluginName)) { + if ($this->isPluginActivated($pluginName) + && !$this->isPluginAlwaysActivated($pluginName)) { $counter++; } } diff --git a/plugins/CoreHome/Widgets/GetSystemSummary.php b/plugins/CoreHome/Widgets/GetSystemSummary.php index fcd7d76316..f68ce36d4f 100644 --- a/plugins/CoreHome/Widgets/GetSystemSummary.php +++ b/plugins/CoreHome/Widgets/GetSystemSummary.php @@ -58,7 +58,7 @@ class GetSystemSummary extends Widget 'numWebsites' => count($websites), 'numUsers' => $numUsers, 'numSegments' => $this->getNumSegments(), - 'numPlugins' => $this->getNumPlugins(), + 'numPlugins' => $this->getNumActivatedPlugins(), 'piwikVersion' => Version::VERSION, 'mySqlVersion' => $this->getMySqlVersion(), 'phpVersion' => phpversion() @@ -77,8 +77,8 @@ class GetSystemSummary extends Widget return $db->getServerVersion(); } - private function getNumPlugins() + private function getNumActivatedPlugins() { - return count($this->pluginManager->getActivatedPlugins()); + return $this->pluginManager->getNumberOfActivatedPluginsExcludingAlwaysActivated(); } }
\ No newline at end of file diff --git a/tests/UI/expected-screenshots/UIIntegrationTest_admin_home.png b/tests/UI/expected-screenshots/UIIntegrationTest_admin_home.png index db62d73aac..b90c7f5d5e 100644 --- a/tests/UI/expected-screenshots/UIIntegrationTest_admin_home.png +++ b/tests/UI/expected-screenshots/UIIntegrationTest_admin_home.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b3d266b43692d54103aef43324162c7bad12c77e4294f5a1f6c7080aa4f9c4b5 -size 126685 +oid sha256:f7ca0b7e1cbadb43e8f2d93000da883c116a737e7c25192089ab96face178f25 +size 126845 |