r111653 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111652‎ | r111653 | r111654 >
Date:17:32, 16 February 2012
Author:jeroendedauw
Status:ok (Comments)
Tags:
Comment:
revert r111514 - this breaks compat with 1.16
Modified paths:
  • /trunk/extensions/SemanticForms/SemanticForms.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_GlobalFunctions.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_Utils.php (modified) (history)
  • /trunk/extensions/SemanticForms/languages/SF_Language.php (modified) (history)
  • /trunk/extensions/SemanticForms/languages/SF_Namespaces.php (deleted) (history)
  • /trunk/extensions/SemanticForms/specials/SF_CreateCategory.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/SemanticForms.php
@@ -91,7 +91,6 @@
9292 $wgHooks['MakeGlobalVariablesScript'][] = 'SFFormUtils::setGlobalJSVariables';
9393 $wgHooks['PageSchemasRegisterHandlers'][] = 'SFPageSchemas::registerClass';
9494 $wgHooks['EditPage::importFormData'][] = 'SFUtils::showFormPreview';
95 -$wgHooks['CanonicalNamespaces'][] = 'SFUtils::onCanonicalNamespaces';
9695
9796 $wgAPIModules['sfautocomplete'] = 'SFAutocompleteAPI';
9897 $wgAPIModules['sfautoedit'] = 'SFAutoeditAPI';
@@ -173,8 +172,6 @@
174173 $wgExtensionMessagesFiles['SemanticForms'] = $sfgIP . '/languages/SF_Messages.php';
175174 $wgExtensionMessagesFiles['SemanticFormsAlias'] = $sfgIP . '/languages/SF_Aliases.php';
176175 $wgExtensionMessagesFiles['SemanticFormsMagic'] = $sfgIP . '/languages/SF_Magic.php';
177 -$wgExtensionMessagesFiles['SemanticFormsNS'] = $sfgIP . '/languages/SF_Namespaces.php';
178 -
179176 // Allow for popup windows for file upload
180177 $wgEditPageFrameOptions = 'SAMEORIGIN';
181178
Index: trunk/extensions/SemanticForms/specials/SF_CreateCategory.php
@@ -30,14 +30,12 @@
3131 $form_tag = "[[" . $specprops[SF_SP_HAS_DEFAULT_FORM] . "::$default_form]]";
3232 $text = wfMsgForContent( 'sf_category_hasdefaultform', $form_tag );
3333 }
34 -
3534 if ( $parent_category !== '' ) {
3635 global $wgContLang;
3736 $namespace_labels = $wgContLang->getNamespaces();
3837 $category_namespace = $namespace_labels[NS_CATEGORY];
3938 $text .= "\n\n[[$category_namespace:$parent_category]]";
4039 }
41 -
4240 return $text;
4341 }
4442
Index: trunk/extensions/SemanticForms/includes/SF_GlobalFunctions.php
@@ -30,10 +30,15 @@
3131 * greater or equal to 100.
3232 */
3333 function sffInitNamespaces() {
34 - global $wgNamespacesWithSubpages, $wgLanguageCode, $sfgContLang;
 34+ global $wgExtraNamespaces, $wgNamespaceAliases, $wgNamespacesWithSubpages, $wgLanguageCode, $sfgContLang;
3535
3636 sffInitContentLanguage( $wgLanguageCode );
3737
 38+ // Register namespace identifiers
 39+ if ( !is_array( $wgExtraNamespaces ) ) { $wgExtraNamespaces = array(); }
 40+ $wgExtraNamespaces = $wgExtraNamespaces + $sfgContLang->getNamespaces();
 41+ $wgNamespaceAliases = $wgNamespaceAliases + $sfgContLang->getNamespaceAliases();
 42+
3843 // Support subpages only for talk pages by default
3944 $wgNamespacesWithSubpages = $wgNamespacesWithSubpages + array(
4045 SF_NS_FORM_TALK => true
Index: trunk/extensions/SemanticForms/includes/SF_Utils.php
@@ -417,8 +417,8 @@
418418
419419 public static function formDropdownHTML() {
420420 // create a dropdown of possible form names
421 - global $wgContLang;
422 - $namespace_labels = $wgContLang->getNamespaces();
 421+ global $sfgContLang;
 422+ $namespace_labels = $sfgContLang->getNamespaces();
423423 $form_label = $namespace_labels[SF_NS_FORM];
424424 $form_names = SFUtils::getAllForms();
425425 $select_body = "\n";
@@ -1082,21 +1082,4 @@
10831083 }
10841084
10851085
1086 - /**
1087 - * For extensions adding their own namespaces or altering the defaults.
1088 - * @see https://www.mediawiki.org/wiki/Manual:Hooks/CanonicalNamespaces
1089 - *
1090 - * @since 2.4.1
1091 - *
1092 - * @param array $list
1093 - *
1094 - * @return true
1095 - */
1096 - public static function onCanonicalNamespaces( array &$list ) {
1097 - $list[SF_NS_FORM] = 'Form';
1098 - $list[SF_NS_FORM_TALK] = 'Form_talk';
1099 -
1100 - return true;
1101 - }
1102 -
11031086 }
Index: trunk/extensions/SemanticForms/languages/SF_Namespaces.php
@@ -1,20 +0,0 @@
2 -<?php
3 -
4 -/**
5 - * Namespace internationalization for the Semantic Forms extension.
6 - *
7 - * @since 0.1
8 - *
9 - * @file SF_Namespaces.php
10 - * @ingroup SemanticForms
11 - *
12 - * @licence GNU GPL v2+
13 - * @author Jeroen De Dauw < jeroendedauw@gmail.com >
14 - */
15 -
16 -$namespaceNames = array();
17 -
18 -$namespaceNames['en'] = array(
19 - SF_NS_FORM => 'Form',
20 - SF_NS_FORM_TALK => 'Form_talk',
21 -);
Index: trunk/extensions/SemanticForms/languages/SF_Language.php
@@ -15,6 +15,7 @@
1616 // arrays for the names of special properties and namespaces -
1717 // all messages are stored in SF_Messages.php
1818 protected $m_SpecialProperties;
 19+ protected $m_Namespaces;
1920
2021 // By default, every language has English-language aliases for
2122 // special properties and namespaces
@@ -24,7 +25,26 @@
2526 'Creates pages with form' => SF_SP_CREATES_PAGES_WITH_FORM,
2627 );
2728
 29+ protected $m_NamespaceAliases = array(
 30+ 'Form' => SF_NS_FORM,
 31+ 'Form_talk' => SF_NS_FORM_TALK
 32+ );
 33+
2834 /**
 35+ * Function that returns an array of namespace identifiers.
 36+ */
 37+ function getNamespaces() {
 38+ return $this->m_Namespaces;
 39+ }
 40+
 41+ /**
 42+ * Function that returns an array of namespace aliases, if any.
 43+ */
 44+ function getNamespaceAliases() {
 45+ return $this->m_NamespaceAliases;
 46+ }
 47+
 48+ /**
2949 * Function that returns the labels for the special properties.
3050 */
3151 function getPropertyLabels() {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r111514address bug 34383jeroendedauw00:10, 15 February 2012

Comments

#Comment by Nikerabbit (talk | contribs)   17:36, 16 February 2012

Not just 1.16, translated namespace names were broken on trunk too.

#Comment by Jeroen De Dauw (talk | contribs)   02:01, 17 February 2012

Do you mean that I did not migrate over the already existing translations? If so, will do that once this revert gets reverted :)

Status & tagging log