Jump to content

MediaWiki Stakeholders' Group/Blog/2015-08-14

From mediawiki.org

Breaking Change - Settings Variables for MediaWiki Extensions Will Need to be Renamed

Author: Chris Koerner

People: Yaron Koren,
Tags: Updates, 1.25, Breaking, Change, Variables, Extensions, Extension Development,

Update: Yaron posted an update on the smw-user mailing list.

"About three weeks ago, I sent out an email explaining that five of the extensions I maintain (Approved Revs, External Data, Header Tabs, Semantic Drilldown and Semantic Forms) would need to have their global variables renamed because they start with a non-standard prefix, i.e. not $wg. This was in light of MediaWiki's new "extension.json" approach to extension loading, which required variables to start with $wg in order to work. However, the status of things changed significantly yesterday, when this change was made to core MediaWiki "


If you're a extension developer or a MediaWiki admin you'll want to pay attention to some changes coming your way. As of 1.25 (released in May of 2015) there is a new way to register extensions.

In the past you registered a new extension in your LocalSettings.php with something like:

include_once( "$IP/ExtensionName/ExtensionName.php" );

Now you can include an extension.json that stores all of your extension settings an call it with:

wfLoadExtension( "ExtensionName" );

As Yaron Koren describes the change in his post on semediawiki-user, "The whole thing seems like a good idea,...but there are also downsides. One big downside is that extension.json can only handle extension settings variables that start with "$wg". And it doesn't look like the MW developers are planning to change that requirement"

According to the discussion on Phabricator there are folks who don't wish to allow for customized extension setting variables. Extension authors, like Yaron, will have to modify their extensions in order to be registered through this new mechanism. This also means that admins will have to pay particular care during their upgrade process of extensions not using the "$wg" prefix. Be ye warned, things will break!

Yaron notes that some of the extensions he maintains will be impacted in the near future. They are:

  • Semantic Forms (currently all variables start with $sfg)
  • External Data (currently, $edg)
  • Header Tabs (currently, $ht)
  • Approved Revs (currently, $egApprovedRevs)
  • Semantic Drilldown (currently, $sdg)

It's also worth noting that other extensions will be impacted by this change. Semantic MediaWiki and Semantic Results Formats are both mentioned by Yaron. You can read his full post and some of the comments on the semediawiki-user archive and can chime in on the Phabracator task.