summaryrefslogtreecommitdiff
path: root/plugins/OStatus
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-10-07 13:30:34 -0700
committerBrion Vibber <brion@pobox.com>2010-10-07 13:30:34 -0700
commitfd0768be291c8c32ae5bfa434cfed4ed93548e49 (patch)
tree1dfd1ab41e9e25e062f40dcf8786ab82348830a3 /plugins/OStatus
parent707b45097428b0dbcdbf9ae2590129080207f254 (diff)
parent06c4212bd4db8815b3f91e5eab3a079784738ae3 (diff)
Merge branch 'master' into 0.9.x
Diffstat (limited to 'plugins/OStatus')
-rw-r--r--plugins/OStatus/OStatusPlugin.php2
-rw-r--r--plugins/OStatus/scripts/fixup-shadow.php44
2 files changed, 45 insertions, 1 deletions
diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php
index 3cd29aff7..9c6696439 100644
--- a/plugins/OStatus/OStatusPlugin.php
+++ b/plugins/OStatus/OStatusPlugin.php
@@ -966,7 +966,7 @@ class OStatusPlugin extends Plugin
{
$group = User_group::staticGet('uri', $url);
if ($group) {
- $local = Local_group::staticGet('id', $group->id);
+ $local = Local_group::staticGet('group_id', $group->id);
if ($local) {
return $group->id;
}
diff --git a/plugins/OStatus/scripts/fixup-shadow.php b/plugins/OStatus/scripts/fixup-shadow.php
index 3e2c18e02..18df2995f 100644
--- a/plugins/OStatus/scripts/fixup-shadow.php
+++ b/plugins/OStatus/scripts/fixup-shadow.php
@@ -84,6 +84,50 @@ while ($group->fetch()) {
}
echo "\n";
+// And there may be user_group entries remaining where we've already killed
+// the ostatus_profile. These were "harmless" until our lookup started actually
+// using the uri field, at which point we can clearly see it breaks stuff.
+echo "Checking for leftover bogus user_group.uri entries obscuring local_group entries...\n";
+
+$group = new User_group();
+$group->joinAdd(array('id', 'local_group:group_id'), 'LEFT');
+$group->whereAdd('group_id IS NULL');
+
+
+$marker = mt_rand(31337, 31337000);
+$groupTemplate = common_local_url('groupbyid', array('id' => $marker));
+$encGroup = $group->escape($groupTemplate, true);
+$encGroup = str_replace($marker, '%', $encGroup);
+echo " LIKE '$encGroup'\n";
+$group->whereAdd("uri LIKE '$encGroup'");
+
+$group->find();
+$count = $group->N;
+echo "Found $count...\n";
+
+while ($group->fetch()) {
+ $uri = $group->uri;
+ if (preg_match('!/group/(\d+)/id!', $uri, $matches)) {
+ $id = intval($matches[1]);
+ $local = Local_group::staticGet('group_id', $id);
+ if ($local) {
+ $nick = $local->nickname;
+ } else {
+ $nick = '<deleted>';
+ }
+ echo "local group $id ($local->nickname) hidden by $uri (bogus group id $group->id)";
+ if ($dry) {
+ echo " - skipping\n";
+ } else {
+ echo " - removing bogus user_group entry...";
+ $evil = User_group::staticGet('id', $group->id);
+ $evil->delete();
+ echo " ok\n";
+ }
+ }
+}
+echo "\n";
+
// Fallback?
echo "Checking for bogus profiles blocking local users/groups by URI pattern match...\n";