Search code examples
phpmediawikimediawiki-extensions

How do I check if a MediaWiki extension is installed from within another extension?


I am currently working on a MediaWiki extension that requires the "Arrays" extension for some features. If the array extension is not installed, my extension should give a friendly warning when trying to use said features.

How do I check if an extension is installed from within another extension?


Solution

  • The nice way is ExtensionRegistry::getInstance()->isLoaded( 'Arrays' ). This only works for extensions which use extension registration (which Arrays does). Otherwise, you can just check if some class from that extension can be loaded.