Page MenuHomePhabricator

Some extra namespaces are not loaded when a user is logged in, particularly for SemanticMediaWiki
Closed, ResolvedPublic


I installed SemanticMediaWiki on MediaWiki 1.27.0-rc.1 and 1.28.0-alpha and the semantic namespaces (Property, Type, Concept) are not loaded when the user is logged in. Obviously it works with MediaWiki 1.26.

A practical way to see it is to go on Special:AllPages, but it is really a general issue: when you create a page in the Property NS as an unlogged user you can see it in Special:Recentchanges (e.g. "Property:Name"), and when the user is logged the recent changes display ":Name".

I also installed SemanticForms, and the namespace added by SF is added. SF uses the hook CanonicalNamespaces, but SMW modifies the global config parameter $wgExtraNamespaces in its register function declared in $wgExtensionFunctions.

Event Timeline

Seb35 created this task.Jun 17 2016, 9:01 AM
Restricted Application added subscribers: Zppix, Aklapper. · View Herald TranscriptJun 17 2016, 9:01 AM
Seb35 added a comment.Jun 17 2016, 9:21 AM

I investigated a bit. As expected, the function returning the list of namespaces (Language::getNamespaces) is called before the function declared in $wgExtensionFunctions is called, and the memoization mechanism always returns the namespaces list without the $wgExtraNamespaces declared after.

The first call to Language::getNamespaces was modified in 34b02d87 (2016-04-03): in User::getDefaultOptions(), the searchable namespaces are now defined in SearchEngineConfig::searchableNamespaces(). When I comment these some lines in User::getDefaultOptions(), the extra namespaces reappear, but this is not the right way to fix it.

I don’t exactly understand the differences in the old and new versions of searchableNamespaces:

  • the old version is: global $wgContLang; $wgContLang->getNamespaces()
  • the new version is: $this->config->get( 'ContLang' )->getNamespaces()

It is an incompatibility between MediaWiki 1.27+ and SemanticMediaWiki, but I’m not sure if MediaWiki should be fixed (function searchableNamespaces) or SemanticMediaWiki (by using the hook CanonicalNamespaces). Probably the latter should be done, but possibly also the former (other extensions could use this mechanism to load extra namespaces).

Seb35 triaged this task as High priority.Jun 17 2016, 9:40 AM
Seb35 added a subscriber: Smalyshev.
Seb35 added a comment.Jun 17 2016, 9:43 AM

Smalyshev, I’ve added you since you are the author the commit, and you probably have a better understanding of the issue.

I’ve changed the priority to High since it breaks SemanticMediaWiki, but feel free to downgrade to Normal.

It is resolved with the master version of SMW (2.3.x) but not in the last stable version (2.3.1), probably the commit 2081575 of SMW (2016-03-09).

So it mainly solved my issue, I let this bug open for one week or so if you want to comment or close this bug -- I’m a bit afraid it breaks other lesser-used extensions.

Kghbln added a subscriber: Kghbln.Jun 17 2016, 9:09 PM

@Seb35 If this is just related to SMW than GitHub is your friend for reporting issues. However in this particular case there was already a report. Glad to read that the mentioned commit fixed the issue so it should be in the upcoming SMW 2.4 release.

Switched the project since this report only refers to SMW. If other extensions are affected the original one may of course be added again.

I'm already in high spirit, maybe I should just switch into rage mode, since this issue cost me a fair amount of time and grieve.

Seb35 added a comment.Jun 20 2016, 9:59 AM

I'm already in high spirit, maybe I should just switch into rage mode, since this issue cost me a fair amount of time and grieve.

It also cost me time, but I’m more peaceful given bugs are the daily bread and are difficult to totally avoid, so the main thing to do is to investigate the issues and fixing the bugs to improve the global quality.

There is an issue (1686) on GitHub for this. It turns out the ConfirmEdit extension (rECOE) MediaWiki 1.26.x and SWM do not play for some reason.

Seb35 closed this task as Resolved.Jul 27 2016, 4:04 PM
Seb35 claimed this task.

This issue is resolved with the version 2.4 of Semantic MediaWiki. I still have a minor issue when the language is not English (Property: is not translated) but it is different from this very issue, and I can solve it by setting:

if( !defined( 'SMW_NS_PROPERTY' ) ) define( 'SMW_NS_PROPERTY', 102 );
$wgExtraNamespaces[SMW_NS_PROPERTY] = 'Attribut'; # French
$wgNamespaceAliases['Property'] = SMW_NS_PROPERTY;

(and the same of the 3 other namespaces)