Topic on Project:Support desk

How to apply wgNamespaceContentModels to ALL namespaces in a single statement?

6
Johnywhy (talkcontribs)

Flow manual says i must apply the following to localsettings.php, for each namespace.

$wgNamespaceContentModels[NS_TALK] = 'flow-board';
$wgNamespaceContentModels[NS_USER_TALK] = 'flow-board';
# Do not reassign the global ($wgNamespaceContentModels =)

Extension:StructuredDiscussions#Enabling or disabling StructuredDiscussions

How can i apply wgNamespaceContentModels to ALL namespaces in a single statement?

星耀晨曦 (talkcontribs)

To enable Flow for all namespaces is a bad idea. If you want to use your wiki as a social site:

$needFlow = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
foreach ( array_keys( $wgExtraNamespaces ) as $key ) {
    $needFlow[] = $key;
}
foreach ( $needFlow as $value ) {
    $wgNamespaceContentModels[$value] = 'flow-board';
}

put it to the bottom of your LocalSettings.php.

Johnywhy (talkcontribs)

Thx!

> To enable Flow for all namespaces is a bad idea.

Why?

Bawolff (talkcontribs)

Typically people dont want flow on all namespaces as usually some namespaces are for content and others are for talking. But its really up to you.

This post was hidden by Johnywhy (history)
Bawolff (talkcontribs)

A shorter version of that is

$wgNamespaceContentModels = array_fill( 0, 16, true );

[That said, 星耀晨曦's is a better solution because it takes extra namespaces into account and is less hacky. Although you can do the same with array_fill by replacing 16 with 2000 (since invalid namespaces are ignored)]

Reply to "How to apply wgNamespaceContentModels to ALL namespaces in a single statement?"