UltrasonicNXT has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/182357

Change subject: Allow wikifarms to have global avatars
......................................................................

Allow wikifarms to have global avatars

The new $wgAvatarPath can now be used to set a static avatar path between 
wikis, allowing global avatars

Change-Id: I232e54b389b9c44f208a779dd0c96e46859fedb2
---
M SocialProfile.php
M UserProfile/AvatarClass.php
2 files changed, 5 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SocialProfile 
refs/changes/57/182357/1

diff --git a/SocialProfile.php b/SocialProfile.php
index 2a29658..25c0c48 100644
--- a/SocialProfile.php
+++ b/SocialProfile.php
@@ -98,6 +98,9 @@
 // Whether to enable friending or not -- this doesn't do very much actually, 
so don't rely on it
 $wgFriendingEnabled = true;
 
+// folder SocialProfile will store avatars under - for global avatars on a 
wikifarm, set to something static
+$wgAvatarPath = $wgDBname;
+
 // Extension credits that show up on Special:Version
 $wgExtensionCredits['other'][] = array(
        'path' => __FILE__,
diff --git a/UserProfile/AvatarClass.php b/UserProfile/AvatarClass.php
index 0e8b7ed..1f6db19 100644
--- a/UserProfile/AvatarClass.php
+++ b/UserProfile/AvatarClass.php
@@ -34,7 +34,7 @@
         *                      image size (s, m, ml or l)
         */
        function getAvatarImage() {
-               global $wgDBname, $wgUploadDirectory, $wgMemc;
+               global $wgAvatarPath, $wgUploadDirectory, $wgMemc;
 
                $key = wfMemcKey( 'user', 'profile', 'avatar', $this->user_id, 
$this->avatar_size );
                $data = $wgMemc->get( $key );
@@ -43,7 +43,7 @@
                if ( $data ) {
                        $avatar_filename = $data;
                } else {
-                       $files = glob( $wgUploadDirectory . '/avatars/' . 
$wgDBname . '_' . $this->user_id .  '_' . $this->avatar_size . "*" );
+                       $files = glob( $wgUploadDirectory . '/avatars/' . 
$wgAvatarPath . '_' . $this->user_id .  '_' . $this->avatar_size . "*" );
                        if ( !isset( $files[0] ) || !$files[0] ) {
                                $avatar_filename = 'default_' . 
$this->avatar_size . '.gif';
                        } else {

-- 
To view, visit https://gerrit.wikimedia.org/r/182357
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I232e54b389b9c44f208a779dd0c96e46859fedb2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SocialProfile
Gerrit-Branch: master
Gerrit-Owner: UltrasonicNXT <adamr_car...@btinternet.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to