diff --git a/includes/media/MediaHandler.php b/includes/media/MediaHandler.php index c4aab7be9f9..26126857d7c 100644 --- a/includes/media/MediaHandler.php +++ b/includes/media/MediaHandler.php @@ -56,6 +56,7 @@ abstract class MediaHandler { if ( !isset( self::$handlers[$class] ) ) { self::$handlers[$class] = new $class; if ( !self::$handlers[$class]->isEnabled() ) { + wfDebug( __METHOD__ . ": $class is not enabled\n" ); self::$handlers[$class] = false; } } @@ -63,6 +64,13 @@ abstract class MediaHandler { return self::$handlers[$class]; } + /** + * Resets all static caches + */ + public static function resetCache() { + self::$handlers = array(); + } + /** * Get an associative array mapping magic word IDs to parameter names. * Will be used by the parser to identify parameters. diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index c9184e85343..301589542c9 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -246,6 +246,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { } $this->mwGlobals = array(); RequestContext::resetMain(); + MediaHandler::resetCache(); $phpErrorLevel = intval( ini_get( 'error_reporting' ) );