Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core/Menu
diff options
context:
space:
mode:
authorMatthieu Napoli <matthieu@mnapoli.fr>2015-06-19 13:13:03 +0300
committerMatthieu Napoli <matthieu@mnapoli.fr>2015-06-19 13:13:03 +0300
commit401f59d168d3a22b694170b9db32f4fe19b1dc5e (patch)
treec0142d424fd4436f657de477795078b1ace9b13f /core/Menu
parent7a23a898cac3694632542462a54dd8ebfcc7ba68 (diff)
Resolving a problem with global state messing up with tests
Diffstat (limited to 'core/Menu')
-rw-r--r--core/Menu/MenuAbstract.php16
1 files changed, 13 insertions, 3 deletions
diff --git a/core/Menu/MenuAbstract.php b/core/Menu/MenuAbstract.php
index 1c8e7f9800..7651a1199d 100644
--- a/core/Menu/MenuAbstract.php
+++ b/core/Menu/MenuAbstract.php
@@ -55,9 +55,9 @@ abstract class MenuAbstract extends Singleton
*/
protected function getAllMenus()
{
-// if (!empty(self::$menus)) {
-// return self::$menus;
-// }
+ if (!empty(self::$menus)) {
+ return self::$menus;
+ }
self::$menus = PluginManager::getInstance()->findComponents('Menu', 'Piwik\\Plugin\\Menu');
@@ -65,6 +65,16 @@ abstract class MenuAbstract extends Singleton
}
/**
+ * To use only for tests.
+ *
+ * @deprecated The whole $menus cache should be replaced by a real transient cache
+ */
+ public static function clearMenus()
+ {
+ self::$menus = array();
+ }
+
+ /**
* Adds a new entry to the menu.
*
* @param string $menuName The menu's category name. Can be a translation token.