return self::$singletoninstance;
}
+ /**
+ * Resets the caches, usually to be called between unit tests
+ */
+ public static function reset_caches() {
+ if (self::$singletoninstance) {
+ self::$singletoninstance->unload_all_filters();
+ }
+ self::$singletoninstance = null;
+ }
+
+ /**
+ * Unloads all filters and other cached information
+ */
+ protected function unload_all_filters() {
+ $this->textfilters = array();
+ $this->stringfilters = array();
+ $this->stringfilternames = array();
+ }
+
/**
* Load all the filters required by this context.
*
protected $textsfiltered = 0;
protected $stringsfiltered = 0;
+ /**
+ * Unloads all filters and other cached information
+ */
+ protected function unload_all_filters() {
+ parent::unload_all_filters();
+ $this->filterscreated = 0;
+ $this->textsfiltered = 0;
+ $this->stringsfiltered = 0;
+ }
+
/**
* @param string $filtername
* @param object $context
if (class_exists('repository')) {
repository::reset_caches();
}
+ filter_manager::reset_caches();
//TODO MDL-25290: add more resets here and probably refactor them to new core function
// Reset course and module caches.