Topic on Manual talk:Extension registration

How to get extension version?

3
Planetenxin (talkcontribs)

With ExtensionRegistry::getInstance()->isLoaded( 'ExtensionB' ) one can check if an extension is loaded.

What would be the best way to get ExtensionB's version (as defined in extension.json?

Florianschmidtwelzow (talkcontribs)

If you want to do that (I don't think that this is really needed somewhere), you can use something like:

echo ExtensionRegistry::getInstance()->getAllThings()['GoogleLogin']['version'];

which will print the version of Extension:GoogleLogin.

However, it would be nice, if you would give some more information about what do you want to do. E.g. if you want to check, that a specific other extension is installed and has a specific version, you can (and probably use) the requirements/dependencies feature of extension registration.

213.61.254.67 (talkcontribs)

I can not get the extension infos.

I tried:

$geshiExists = defined('SyntaxHighlight_GeSHi');

$geshiExists = ExtensionRegistry::getInstance()->isLoaded( 'SyntaxHighlight_GeSHi');

$geshiExists = class_exists( 'GeSHi');

$geshiExists = class_exists( 'SyntaxHighlight');

$geshiExists = ExtensionRegistry::getInstance()->getAllThings()['SyntaxHighlight_GeSHi']['version'];

Reply to "How to get extension version?"