https://www.mediawiki.org/wiki/Special:Code/MediaWiki/102129

Revision: 102129
Author:   ashley
Date:     2011-11-05 23:45:28 +0000 (Sat, 05 Nov 2011)
Log Message:
-----------
SocialProfile: as per Markus' in-depth review:
*add an informational message when someone tries to view SocialProfile.php 
directly
*clarify doc comment about this being the main setup file -- it's also the only 
one right now; things were different years ago
*moved hooked functions into the same place
*move globals to the beginning of the function

Modified Paths:
--------------
    trunk/extensions/SocialProfile/SocialProfile.php

Modified: trunk/extensions/SocialProfile/SocialProfile.php
===================================================================
--- trunk/extensions/SocialProfile/SocialProfile.php    2011-11-05 23:27:42 UTC 
(rev 102128)
+++ trunk/extensions/SocialProfile/SocialProfile.php    2011-11-05 23:45:28 UTC 
(rev 102129)
@@ -4,12 +4,22 @@
  * This line must be present before any global variable is referenced.
  */
 if ( !defined( 'MEDIAWIKI' ) ) {
-       die();
+       die(
+               'This is the setup file for the SocialProfile extension to 
MediaWiki.' .
+               'Please see 
http://www.mediawiki.org/wiki/Extension:SocialProfile for' .
+               ' more information about this extension.'
+       );
 }
 
 /**
- * This is the *main* (but certainly not the only) loader file for 
SocialProfile extension.
+ * This is the loader file for the SocialProfile extension. You should include
+ * this file in your wiki's LocalSettings.php to activate SocialProfile.
  *
+ * If you want to use the UserWelcome extension (bundled with SocialProfile),
+ * the <topusers /> tag or the user levels feature, there are some other files
+ * you will need to include in LocalSettings.php. The online manual has more
+ * details about this.
+ *
  * For more info about SocialProfile, please see 
http://www.mediawiki.org/wiki/Extension:SocialProfile.
  */
 $dir = dirname( __FILE__ ) . '/';
@@ -210,9 +220,26 @@
 require_once( "$IP/extensions/SocialProfile/SystemGifts/SystemGifts.php" ); // 
SystemGifts (awards functionality) loader file
 require_once( "$IP/extensions/SocialProfile/UserActivity/UserActivity.php" ); 
// UserActivity - recent social changes
 
-# Schema changes
+// Hooked functions
+$wgHooks['CanonicalNamespaces'][] = 
'wfSocialProfileRegisterCanonicalNamespaces';
 $wgHooks['LoadExtensionSchemaUpdates'][] = 'efSocialProfileSchemaUpdates';
 
+/**
+ * Register the canonical names for our custom namespaces and their talkspaces.
+ *
+ * @param $list Array: array of namespace numbers with corresponding
+ *                     canonical names
+ * @return Boolean: true
+ */
+function wfSocialProfileRegisterCanonicalNamespaces( &$list ) {
+       $list[NS_USER_WIKI] = 'UserWiki';
+       $list[NS_USER_WIKI_TALK] = 'UserWiki_talk';
+       $list[NS_USER_PROFILE] = 'User_profile';
+       $list[NS_USER_PROFILE_TALK] = 'User_profile_talk';
+       return true;
+}
+
+// Schema changes
 function efSocialProfileDBUpdate( $updater, $label, $file ) {
        if ( $updater === null ) {
                global $wgExtNewTables;
@@ -224,9 +251,10 @@
 }
 
 function efSocialProfileSchemaUpdates( $updater = null ) {
+       global $wgDBtype;
+
        $dir = dirname( __FILE__ );
        $dbExt = '';
-       global $wgDBtype;
 
        if ( $wgDBtype == 'postgres' ) {
                $dbExt = '.postgres';
@@ -308,20 +336,4 @@
 
 if( !defined( 'NS_USER_PROFILE_TALK' ) ) {
        define( 'NS_USER_PROFILE_TALK', 203 );
-}
-
-$wgHooks['CanonicalNamespaces'][] = 
'wfSocialProfileRegisterCanonicalNamespaces';
-/**
- * Register the canonical names for our custom namespaces and their talkspaces.
- *
- * @param $list Array: array of namespace numbers with corresponding
- *                     canonical names
- * @return Boolean: true
- */
-function wfSocialProfileRegisterCanonicalNamespaces( &$list ) {
-       $list[NS_USER_WIKI] = 'UserWiki';
-       $list[NS_USER_WIKI_TALK] = 'UserWiki_talk';
-       $list[NS_USER_PROFILE] = 'User_profile';
-       $list[NS_USER_PROFILE_TALK] = 'User_profile_talk';
-       return true;
 }
\ No newline at end of file


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to