registration: Fix namespaces added through the ExtensionProcessor
Using $wgExtraNamespaces overrides any localized namespaces with the canonical form, which is not ideal. Namespaces added through extension.json will now store the canonical form and numerical id in a 'ExtensionNamespaces' attribute that is read by MWNamespace::getCanonicalNamespaces(). Also fix the documentation on $wgExtraNamespaces, as using $wgCanonicalNamespaceNames has not been possible since r85327. Bug: T110389 Change-Id: I5bd9a7258f59d8c4a7ad0543d2115960fbea9b3a
This commit is contained in:
parent
f18cc062d7
commit
9df0672255
3 changed files with 5 additions and 3 deletions
|
|
@ -3720,8 +3720,8 @@ $wgMetaNamespaceTalk = false;
|
|||
* Additional namespaces. If the namespaces defined in Language.php and
|
||||
* Namespace.php are insufficient, you can create new ones here, for example,
|
||||
* to import Help files in other languages. You can also override the namespace
|
||||
* names of existing namespaces. Extensions developers should use
|
||||
* $wgCanonicalNamespaceNames.
|
||||
* names of existing namespaces. Extensions should use the CanonicalNamespaces
|
||||
* hook or extension.json.
|
||||
*
|
||||
* @warning Once you delete a namespace, the pages in that namespace will
|
||||
* no longer be accessible. If you rename it, then you can access them through
|
||||
|
|
|
|||
|
|
@ -210,6 +210,8 @@ class MWNamespace {
|
|||
if ( $namespaces === null || $rebuild ) {
|
||||
global $wgExtraNamespaces, $wgCanonicalNamespaceNames;
|
||||
$namespaces = array( NS_MAIN => '' ) + $wgCanonicalNamespaceNames;
|
||||
// Add extension namespaces
|
||||
$namespaces += ExtensionRegistry::getInstance()->getAttribute( 'ExtensionNamespaces' );
|
||||
if ( is_array( $wgExtraNamespaces ) ) {
|
||||
$namespaces += $wgExtraNamespaces;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ class ExtensionProcessor implements Processor {
|
|||
foreach ( $info['namespaces'] as $ns ) {
|
||||
$id = $ns['id'];
|
||||
$this->defines[$ns['constant']] = $id;
|
||||
$this->globals['wgExtraNamespaces'][$id] = $ns['name'];
|
||||
$this->attributes['ExtensionNamespaces'][$id] = $ns['name'];
|
||||
if ( isset( $ns['gender'] ) ) {
|
||||
$this->globals['wgExtraGenderNamespaces'][$id] = $ns['gender'];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue