diff --git a/classes/Notice.php b/classes/Notice.php index a704053a01..f7194e3394 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -119,6 +119,9 @@ class Notice extends Memcached_DataObject // NOTE: we don't clear queue items $result = parent::delete(); + + $this->blowOnDelete(); + return $result; } /** @@ -421,6 +424,18 @@ class Notice extends Memcached_DataObject $profile->blowNoticeCount(); } + /** + * Clear cache entries related to this notice at delete time. + * Necessary to avoid breaking paging on public, profile timelines. + */ + function blowOnDelete() + { + $this->blowOnInsert(); + + self::blow('profile:notice_ids:%d;last', $this->profile_id); + self::blow('public;last'); + } + /** save all urls in the notice to the db * * follow redirects and save all available file information @@ -589,7 +604,6 @@ class Notice extends Memcached_DataObject array(), 'public', $offset, $limit, $since_id, $max_id); - return Notice::getStreamByIds($ids); } diff --git a/lib/activity.php b/lib/activity.php index 6acf37a8a2..ae65fe36ff 100644 --- a/lib/activity.php +++ b/lib/activity.php @@ -463,7 +463,7 @@ class ActivityUtils $text = $contentEl->textContent; return htmlspecialchars_decode($text, ENT_QUOTES); } else if ($type == 'xhtml') { - $divEl = ActivityUtils::child($contentEl, 'div'); + $divEl = ActivityUtils::child($contentEl, 'div', 'http://www.w3.org/1999/xhtml'); if (empty($divEl)) { return null; } diff --git a/plugins/OStatus/lib/feeddiscovery.php b/plugins/OStatus/lib/feeddiscovery.php index ff76b229e7..7761ea583a 100644 --- a/plugins/OStatus/lib/feeddiscovery.php +++ b/plugins/OStatus/lib/feeddiscovery.php @@ -211,11 +211,11 @@ class FeedDiscovery $type = $node->attributes->getNamedItem('type'); $href = $node->attributes->getNamedItem('href'); if ($rel && $type && $href) { - $rel = trim($rel->value); + $rel = array_filter(explode(" ", $rel->value)); $type = trim($type->value); $href = trim($href->value); - if (trim($rel) == 'alternate' && array_key_exists($type, $feeds) && empty($feeds[$type])) { + if (in_array('alternate', $rel) && array_key_exists($type, $feeds) && empty($feeds[$type])) { // Save the first feed found of each type... $feeds[$type] = $this->resolveURI($href, $base); } diff --git a/plugins/OStatus/scripts/testfeed.php b/plugins/OStatus/scripts/testfeed.php new file mode 100644 index 0000000000..5e3ccd433a --- /dev/null +++ b/plugins/OStatus/scripts/testfeed.php @@ -0,0 +1,89 @@ +#!/usr/bin/env php +. + */ + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); + +$longoptions = array('skip=', 'count='); + +$helptext = <<loadXML($xml)) { + print "Bad XML.\n"; + exit(1); +} + +if ($skip || $count) { + $entries = $feed->getElementsByTagNameNS(ActivityUtils::ATOM, 'entry'); + $remove = array(); + for ($i = 0; $i < $skip && $i < $entries->length; $i++) { + $item = $entries->item($i); + if ($item) { + $remove[] = $item; + } + } + if ($count) { + for ($i = $skip + $count; $i < $entries->length; $i++) { + $item = $entries->item($i); + if ($item) { + $remove[] = $item; + } + } + } + foreach ($remove as $item) { + $item->parentNode->removeChild($item); + } +} + +Event::handle('StartFeedSubReceive', array($sub, $feed)); +