Merge branch 'master' into 1.0.x

This commit is contained in:
Evan Prodromou
2010-08-13 14:33:41 -07:00
78 changed files with 11330 additions and 2668 deletions

View File

@@ -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 {

View File

@@ -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();
}

View File

@@ -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);
}