r93317 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93316‎ | r93317 | r93318 >
Date:21:31, 27 July 2011
Author:ashley
Status:ok
Tags:
Comment:
SocialProfile: automagically register the new namespaces
Modified paths:
  • /trunk/extensions/SocialProfile/SocialProfile.namespaces.php (added) (history)
  • /trunk/extensions/SocialProfile/SocialProfile.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SocialProfile/SocialProfile.php
@@ -21,6 +21,7 @@
2222 $wgExtensionMessagesFiles['SocialProfileUserStats'] = $dir . 'UserStats/UserStats.i18n.php';
2323 $wgExtensionMessagesFiles['SocialProfileUserStatus'] = $dir . 'UserStatus/UserStatus.i18n.php';
2424
 25+$wgExtensionMessagesFiles['SocialProfileNamespaces'] = $dir . 'SocialProfile.namespaces.php';
2526 $wgExtensionAliasesFiles['SocialProfile'] = $dir . 'SocialProfile.alias.php';
2627
2728 // Classes to be autoloaded
@@ -222,8 +223,8 @@
223224
224225 function efSocialProfileSchemaUpdates( $updater = null ) {
225226 $dir = dirname( __FILE__ );
226 - $dbExt = "";
227 - global $wgExtNewTables, $wgDBtype;
 227+ $dbExt = '';
 228+ global $wgDBtype;
228229
229230 if ( $wgDBtype == 'postgres' ) {
230231 $dbExt = '.postgres';
@@ -287,4 +288,36 @@
288289 $renameUserSQL->tables['user_system_messages'] = array( 'um_user_name', 'um_user_id' );
289290 return true;
290291 }
291 -*/
\ No newline at end of file
 292+*/
 293+
 294+if( !defined( 'NS_USER_WIKI' ) ) {
 295+ define( 'NS_USER_WIKI', 200 );
 296+}
 297+
 298+if( !defined( 'NS_USER_WIKI_TALK' ) ) {
 299+ define( 'NS_USER_WIKI_TALK', 201 );
 300+}
 301+
 302+if( !defined( 'NS_USER_PROFILE' ) ) {
 303+ define( 'NS_USER_PROFILE', 202 );
 304+}
 305+
 306+if( !defined( 'NS_USER_PROFILE_TALK' ) ) {
 307+ define( 'NS_USER_PROFILE_TALK', 203 );
 308+}
 309+
 310+$wgHooks['CanonicalNamespaces'][] = 'wfSocialProfileRegisterCanonicalNamespaces';
 311+/**
 312+ * Register the canonical names for our custom namespaces and their talkspaces.
 313+ *
 314+ * @param $list Array: array of namespace numbers with corresponding
 315+ * canonical names
 316+ * @return Boolean: true
 317+ */
 318+function wfSocialProfileRegisterCanonicalNamespaces( &$list ) {
 319+ $list[NS_USER_WIKI] = 'UserWiki';
 320+ $list[NS_USER_WIKI_TALK] = 'UserWiki_talk';
 321+ $list[NS_USER_PROFILE] = 'User_profile';
 322+ $list[NS_USER_PROFILE_TALK] = 'User_profile_talk';
 323+ return true;
 324+}
\ No newline at end of file
Index: trunk/extensions/SocialProfile/SocialProfile.namespaces.php
@@ -0,0 +1,41 @@
 2+<?php
 3+/**
 4+ * Translations of the namespaces introduced by SocialProfile.
 5+ *
 6+ * @file
 7+ */
 8+
 9+$namespaceNames = array();
 10+
 11+// For wikis where the SocialProfile extension is not installed.
 12+if( !defined( 'NS_USER_WIKI' ) ) {
 13+ define( 'NS_USER_WIKI', 200 );
 14+}
 15+
 16+if( !defined( 'NS_USER_WIKI_TALK' ) ) {
 17+ define( 'NS_USER_WIKI_TALK', 201 );
 18+}
 19+
 20+if( !defined( 'NS_USER_PROFILE' ) ) {
 21+ define( 'NS_USER_PROFILE', 202 );
 22+}
 23+
 24+if( !defined( 'NS_USER_PROFILE_TALK' ) ) {
 25+ define( 'NS_USER_PROFILE_TALK', 203 );
 26+}
 27+
 28+/** English */
 29+$namespaceNames['en'] = array(
 30+ NS_USER_WIKI => 'UserWiki',
 31+ NS_USER_WIKI_TALK => 'UserWiki_talk',
 32+ NS_USER_PROFILE => 'User_profile',
 33+ NS_USER_PROFILE_TALK => 'User_profile_talk',
 34+);
 35+
 36+/** Finnish (Suomi) */
 37+$namespaceNames['fi'] = array(
 38+ NS_USER_WIKI => 'Käyttäjäwiki',
 39+ NS_USER_WIKI_TALK => 'Keskustelu_käyttäjäwikistä',
 40+ NS_USER_PROFILE => 'Käyttäjäprofiili',
 41+ NS_USER_PROFILE_TALK => 'Keskustelu_käyttäjäprofiilista',
 42+);
\ No newline at end of file
Property changes on: trunk/extensions/SocialProfile/SocialProfile.namespaces.php
___________________________________________________________________
Added: svn:eol-style
143 + native

Status & tagging log