Aliases for Remote StatusNet Groups

Read this first: Remote StatusNet Groups by @jpope

Okay, so now that you're aware of what's going on and you've inserted group names in your group_alias SQL table, let's take care of group aliases. This post addresses the following note:

These queries, and the end result, only check for the name of the group as it is entered in the database. If the group has other aliases that you'd rather use instead of the main group name, you'll still need to manually add them in. There's not much that can be done using just mysql to find the other aliases for remote groups.

Save the following PHP script on your server, change the database credentials to match your configurations, and then run it.

What it does

  1. For each group in your "group_member" table, it gets its respective "uri" from the "user_group" table.
  2. Fetches the HTML page located at "uri" extracted above.
  3. Extracts text from each <li class="group_alias">
  4. Adds them to your "group_alias" SQL table

Once it's done, you should be able to use, say, "!sn" for the "!statusnet" group.

Note: Because it fetches remote HTML pages for each group, it can take a while until it completes the process. This is especially true if you have a lot of groups listed in your "group_member" table.

It'd be nice to have some sort of caching mechanism in place so that it doesn't re-fetch all groups when you run the script again. I might look into that if I have time at some point. Feel free to contribute enhancements if you want!

Leave a Reply