Page MenuHomePhabricator

Incorrect array syntax for $wgExtraSignatureNamespaces in docs
Closed, ResolvedPublic

Description

On https://www.mediawiki.org/wiki/Extension:WikiEditor the text "The button for adding user signatures (four tildes) is available on talk pages and in namespaces specified in $wgExtraSignatureNamespaces." appears to be wrong.

Event Timeline

$wgExtraSignatureNamespace is not used anymore for the WikiEditor extension, as far as I see.

Aklapper renamed this task from Text "The button for adding user signatures (four tildes) is available on talk pages and in namespaces specified in $wgExtraSignatureNamespaces." appears to be invalid for current versions. to "The button for adding user signatures (four tildes) is available on talk pages and in namespaces specified in $wgExtraSignatureNamespaces." appears to be invalid for current versions..Dec 11 2019, 1:39 PM
Aklapper removed Catrope as the assignee of this task.
Aklapper added a project: Documentation.
Aklapper added a subscriber: Catrope.

@Wikinaut: Not sure why Catrope was set as assignee here?

@Aklapper: because of

grafik.png (443×384 px, 66 KB)

(mentioned as author).

@Wikinaut: Ah, thanks. Please don't expect original authors of some code to plan to work on every single issue that might happen around that code base nowadays. Also see https://www.mediawiki.org/wiki/How_to_report_a_bug - thanks! :)

matmarex added a subscriber: matmarex.

WikiEditor doesn't use $wgExtraSignatureNamespaces directly, but it calls mw.Title.wantSignaturesNamespace() to decide whether to display the button, and that uses $wgExtraSignatureNamespaces.

https://phabricator.wikimedia.org/diffusion/EWED/browse/master/modules/jquery.wikiEditor.toolbar.config.js$622
https://phabricator.wikimedia.org/source/mediawiki/browse/master/resources/src/mediawiki.Title/Title.js$649

As far as I can see, the feature works correctly.

I had to deactivate the delete command in order to get that mechanism working for NS_MAIN - which I added in LocalSettings.php. I will try that again and report here whether it worked or not in the second trial.

It's not correctly working:

We have in LocalSettings:

define( "NS_PROJECTS", 500 );
define( "NS_PROJECTS_TALK", 501 );
define( "NS_SESSION", 502 );
define( "NS_SESSION_TALK", 503 );
define( "NS_ASSEMBLY", 504 );
define( "NS_ASSEMBLY_TALK", 505 );
...
$wgExtraSignatureNamespaces = [ NS_MAIN, NS_HELP, NS_STATIC, NS_PROJECTS, NS_SESSION, NS_ASSEMBLY ];

The additional Namesspaces NS_HELP, NS_STATIC, NS_PROJECTS, NS_SESSION, NS_ASSEMBLY are ignored.

Reopened, because at least one issue remains.

It appears to be an issue of the correct syntax.
I changed to

$wgExtraSignatureNamespaces = array( NS_MAIN, NS_HELP, NS_STATIC, NS_PROJECTS, NS_SESSION, NS_ASSEMBLY );

which works now.

Wikinaut closed this task as Resolved.EditedDec 12 2019, 8:29 AM
Wikinaut claimed this task.

I will change the description page

https://www.mediawiki.org/wiki/Manual:$wgExtraSignatureNamespaces

accordingly.

@Aklapper: Additional question: is there a simple way or trick to programmatically add all namesspaces?

$wgExtraSignatureNamespaces = array( "all namespaces" );

Aklapper renamed this task from "The button for adding user signatures (four tildes) is available on talk pages and in namespaces specified in $wgExtraSignatureNamespaces." appears to be invalid for current versions. to Incorrect array syntax for $wgExtraSignatureNamespaces." in docs.Dec 12 2019, 12:13 PM
Aklapper renamed this task from Incorrect array syntax for $wgExtraSignatureNamespaces." in docs to Incorrect array syntax for $wgExtraSignatureNamespaces in docs.

@Wikinaut: Not sure why you're asking me specifically. :) For "How to...?" questions, please ask on the MediaWiki Support Desk or ask on a dedicated project/extension talk page if existing. Thanks for your understanding!

@Wikinaut Glad you got it working. However, I must note that array( … ) and [ … ] are exactly the same. If changing one to the other fixed your problem, then I would guess that your configuration was correct from the start, but the script was cached in your browser and that's why you didn't see the effect immediately.

@matmarex Hi, even why I must admit, that I knew this both. the extension was not working for non-NS_MAIN namespaces.
I suggest that I will scrutizine the problem (or non-problem) again and report here.

So I think it could be an issue related to the specific php version we have or with the fact that some namespaces we use were defined as constants in the LocalSettings.