summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-08-13 14:33:41 -0700
committerEvan Prodromou <evan@status.net>2010-08-13 14:33:41 -0700
commit718317542940a8976f2c6f2a9ea09a04f2f00ca6 (patch)
tree2bae1e1b0ce628101453b83c7e4ddcce59b43c62 /classes
parent9f0715a9935966f3ec483bccc476d5baf3324b3c (diff)
parent029aa0c61c9942c0688fd3dc9aa2893311543db1 (diff)
Merge branch 'master' into 1.0.x
Diffstat (limited to 'classes')
-rw-r--r--classes/File_redirection.php8
-rw-r--r--classes/Notice.php7
-rw-r--r--classes/Profile.php4
3 files changed, 13 insertions, 6 deletions
diff --git a/classes/File_redirection.php b/classes/File_redirection.php
index 00ec75309..6a86197d9 100644
--- a/classes/File_redirection.php
+++ b/classes/File_redirection.php
@@ -240,6 +240,14 @@ class File_redirection extends Memcached_DataObject
} else if (is_string($redir_data)) {
// The file is a known redirect target.
$file = File::staticGet('url', $redir_data);
+ if (empty($file)) {
+ // @fixme should we save a new one?
+ // this case was triggering sometimes for redirects
+ // with unresolvable targets; found while fixing
+ // "can't linkify" bugs with shortened links to
+ // SSL sites with cert issues.
+ return null;
+ }
$file_id = $file->id;
}
} else {
diff --git a/classes/Notice.php b/classes/Notice.php
index 4646fc6ab..0eeebfadf 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -485,7 +485,7 @@ class Notice extends Memcached_DataObject
function saveKnownUrls($urls)
{
// @fixme validation?
- foreach ($urls as $url) {
+ foreach (array_unique($urls) as $url) {
File::processNew($url, $this->id);
}
}
@@ -893,7 +893,7 @@ class Notice extends Memcached_DataObject
}
$groups = array();
- foreach ($group_ids as $id) {
+ foreach (array_unique($group_ids) as $id) {
$group = User_group::staticGet('id', $id);
if ($group) {
common_log(LOG_ERR, "Local delivery to group id $id, $group->nickname");
@@ -1016,7 +1016,7 @@ class Notice extends Memcached_DataObject
}
$sender = Profile::staticGet($this->profile_id);
- foreach ($uris as $uri) {
+ foreach (array_unique($uris) as $uri) {
$user = User::staticGet('uri', $uri);
@@ -1029,6 +1029,7 @@ class Notice extends Memcached_DataObject
$reply->notice_id = $this->id;
$reply->profile_id = $user->id;
+ common_log(LOG_INFO, __METHOD__ . ": saving reply: notice $this->id to profile $user->id");
$id = $reply->insert();
}
diff --git a/classes/Profile.php b/classes/Profile.php
index 0d0463b73..d7617f0b7 100644
--- a/classes/Profile.php
+++ b/classes/Profile.php
@@ -464,11 +464,9 @@ class Profile extends Memcached_DataObject
$sub = new Subscription();
$sub->subscribed = $this->id;
-
+ $sub->whereAdd('subscriber != subscribed');
$cnt = (int) $sub->count('distinct subscriber');
- $cnt = ($cnt > 0) ? $cnt - 1 : $cnt;
-
if (!empty($c)) {
$c->set(common_cache_key('profile:subscriber_count:'.$this->id), $cnt);
}