Page MenuHomePhabricator

User should be able to get MediaWiki version from any page
Closed, ResolvedPublic


Many bots rely on the version of MediaWiki engine. But they need to make additional request to Special:Version each time they start. For bots involked by cron, recursive bots etc. that causes a large number of unneeded requests to servers. More serious problem is that the format of Special:Version may change as the format of any other pages, and bot won't be able to handle this.

I suggest doing a very simple thing. Let's add a variable, say 'wgMWVersion', to each page, into the block where we define wgScript, wgServer etc. for javascripts.

I'm setting priority to High because it would be possible to write bots fully compatible with older version of MediaWiki only when this feature will be enabled, and only for versions where it is enabled. Don't think that it's hard to implement this, but we need that feature right now.

Thank you.

Version: unspecified
Severity: enhancement



Event Timeline

bzimport raised the priority of this task from to High.Nov 21 2014, 10:01 PM
bzimport set Reference to bz12536.
bzimport added a subscriber: Unknown Object (MLST).

You could increase the global request rate for Special:Version by 50 times, and you'd still use less server CPU time than this feature. SpecialVersion::getVersion() is too slow to be calling on every request. I'll have to revert this. Use api.php?action=query&meta=siteinfo if you want to be server-friendly.

rotemliss wrote:

Why is this function so slow? If the problem is getSvnRevision, could $wgVersion be used for this variable instead of calling SpecialVersion::getVersion?

Mostly getSvnRevision(). Also, on systems without a bytecode cache, loading SpecialVersion.php will be slow. Using $wgVersion would be fine.

Well, we can hardcore version inside GlobalSettings.php and then use it instead of calling getVersion().

rotemliss wrote:

(In reply to comment #5)

Well, we can hardcore version inside GlobalSettings.php and then use it instead
of calling getVersion().

We already do so (in DefaultSettings.php), this is $wgVersion. The version is hardcoded there, but not the SVN revision. (BTW, couldn't SVN properties be used to get SVN revision, instead of the file .svn/entries?)

Let's use $wgVersion then. SVN revision is not needed at all - bots are usually written for stable versions of MediaWiki, and in most cases bots will work with stable versions only.