Topic on Extension talk:SocialProfile

Megacane (talkcontribs)

Hello, I'm pretty sure this hasn't been covered here before. I am wondering how to share avatars with this extension cross-wiki. We use different upload directories though for each wiki, is this a roadblock or is there another way to achieve this? I know something with $wgSharedDB should work but I am having no luck with that. Thanks.

Jack Phoenix (talkcontribs)

@Megacane: Although it hasn't been touched in a while, the Extension:SocialProfile/Developer information page, especially the "Uploads" section there, is somewhat accurate in this regard. As per that page, by default user avatars use the naming convention $wgDBname_USERID_SIZE.EXTENSION (i.e. testwiki_1_l.png; size can be l for large, ml for medium-large, s for small) but luckily this is just the default, and you can configure a more static prefix by setting the $wgAvatarKey variable to something static; this string will then be used in the avatar file names instead of $wgDBname.

Having said that...SocialProfile and other social tools are not that well tested with various shared setups, as the extensions were originally written by and for a single wiki and thus there are certain assumptions the code makes. Some of these issues are known and tracked (e.g. T144466) but many probably aren't. Please do report any and all such inconsistencies, bugs and other quirks you may run into!

The $wgAvatarKey variable was originally introduced in commit bbb405a0a208a915c0f746b4c501ab6a8d9d86c9 back in late 2014 for Brickimedia, which was then a wiki farm consisting of several wikis (using shared uploads). Images were stored in the meta-wiki and shared from there to other wikis. These days the meta-wiki is gone and Brickipedia is basically just a single wiki, but regardless that particular setup has thus been tested on a production wiki, albeit a while ago.

That said, at a glance it looks like the code in wAvatar#getAvatarImage uses $wgUploadDirectory...perhaps the aforementioned $wgAvatarKey variable will do the trick, perhaps you may need to hack around limitations with symlinks or perhaps it's not doable without tweaking SocialProfile; either way, do give it a try and let me know how it goes!

Megacane (talkcontribs)

Your suggestion for making $wgAvatarKey be set to a random string (for example) worked just fine! I just literally got my problem resolved so I don't know of any bugs just yet. However, if I run across some I'll be sure to let you know. Thank you.