From 6828567ed067b382f68910dba6d59b603fc782a4 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 11 Mar 2010 11:52:19 -0800 Subject: Add forgotten scripts/fixup_files.php to clean up "the h bug" --- scripts/fixup_files.php | 77 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100755 scripts/fixup_files.php diff --git a/scripts/fixup_files.php b/scripts/fixup_files.php new file mode 100755 index 000000000..18feaf221 --- /dev/null +++ b/scripts/fixup_files.php @@ -0,0 +1,77 @@ +#!/usr/bin/env php +. + */ + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); + +$longoptions = array('dry-run'); + +$helptext = <<title = 'h'; +$f->mimetype = 'h'; +$f->size = 0; +$f->protected = 0; +$f->find(); +echo "Found $f->N bad items:\n"; + +while ($f->fetch()) { + echo "$f->id $f->url"; + + $data = File_redirection::lookupWhere($f->url); + if ($dry) { + if (is_array($data)) { + echo " (unchanged)\n"; + } else { + echo " (unchanged, but embedding lookup failed)\n"; + } + } else { + // NULL out the mime/title/size/protected fields + $sql = sprintf("UPDATE file " . + "SET mimetype=null,title=null,size=null,protected=null " . + "WHERE id=%d", + $f->id); + $f->query($sql); + $f->decache(); + + if (is_array($data)) { + if ($f->saveOembed($data, $f->url)) { + echo " (ok)\n"; + } else { + echo " (ok, no embedding data)\n"; + } + } else { + echo " (ok, but embedding lookup failed)\n"; + } + } +} + +echo "done.\n"; + -- cgit v1.2.3-54-g00ecf From dacd0f3e6df020eda81d60139ac88437fed3352e Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 17 Mar 2010 12:14:19 -0700 Subject: Fix to regression for auto-subscribe - was backwards. --- classes/Subscription.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/Subscription.php b/classes/Subscription.php index 9cef2df1a..5ac95f922 100644 --- a/classes/Subscription.php +++ b/classes/Subscription.php @@ -105,8 +105,8 @@ class Subscription extends Memcached_DataObject $auto = new Subscription(); - $auto->subscriber = $subscriber->id; - $auto->subscribed = $other->id; + $auto->subscriber = $other->id; + $auto->subscribed = $subscriber->id; $auto->created = common_sql_now(); $result = $auto->insert(); -- cgit v1.2.3-54-g00ecf