Permalink
Browse files

MDL-30545/ MDL-36199 reset plugin manager singletons

  • Loading branch information...
1 parent af698e6 commit 95f6a022ca6627bf6853b71bc8c3783ab8cb32da @skodak skodak committed with danpoltawski Oct 24, 2012
Showing with 28 additions and 0 deletions.
  1. +8 −0 lib/phpunit/classes/util.php
  2. +20 −0 lib/pluginlib.php
@@ -625,6 +625,14 @@ public static function reset_all_data($logchanges = false) {
$reset = 'reset';
get_fast_modinfo($reset);
+ // Reset other singletons.
+ if (class_exists('plugin_manager')) {
+ plugin_manager::reset_caches(true);
+ }
+ if (class_exists('available_update_checker')) {
+ available_update_checker::reset_caches(true);
+ }
+
// purge dataroot directory
self::reset_dataroot();
View
@@ -89,6 +89,16 @@ public static function instance() {
}
/**
+ * Reset any caches
+ * @param bool $phpunitreset
+ */
+ public static function reset_caches($phpunitreset = false) {
+ if ($phpunitreset) {
+ self::$singletoninstance = null;
+ }
+ }
+
+ /**
* Returns a tree of known plugins and information about them
*
* @param bool $disablecache force reload, cache can be used otherwise
@@ -650,6 +660,16 @@ public static function instance() {
}
/**
+ * Reset any caches
+ * @param bool $phpunitreset
+ */
+ public static function reset_caches($phpunitreset = false) {
+ if ($phpunitreset) {
+ self::$singletoninstance = null;
+ }
+ }
+
+ /**
* Returns the timestamp of the last execution of {@link fetch()}
*
* @return int|null null if it has never been executed or we don't known

0 comments on commit 95f6a02

Please sign in to comment.