0

I have a LAMP environment with /var/www/html/x which is a MediaWiki website. I have a few more MediaWiki websites but I'd like to print the version of the x one to terminal.

I need to do so I could know what the last version was before I manually update MediaWiki.

Inside that dir, there's a file named RELEASE-NOTES-1.32 with the text:

== MediaWiki 1.32 ==

=== Changes since MediaWiki 1.32.0-rc.2 ===

MORE_TEXT...........

Maybe I should just print line 3 as with awk 'NR>3' /var/www/html/x/RELEASE-NOTES-* but maybe there's a better way to know the full version of a given MediaWiki installation.

What would be the best, most stable way to do this outputting?

1

If the wiki is up, the most robust method is to just ask (via the generator property of the siteinfo API, for example) - changes to that are subject to a deprecation policy, while any internal structure you rely on could change without warning.

If that's not an option, you can try parsing out the value of $wgVersion from includes/DefaultSettings.php. E.g.

ack '\$'"wgVersion\s*=\s*'([\w\d.-]+)';" --output='$1' mediawiki/includes/DefaultSettings.php

Checking the release notes works as well, if you always use proper releases, and only care about the major version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.