ensureFeedURL will return Ostatus_profile early if already stored

This commit is contained in:
Mikael Nordfeldth 2015-02-20 14:47:12 +01:00
parent 96099807e1
commit c1e3cfe7a7

View File

@ -1120,6 +1120,11 @@ class Ostatus_profile extends Managed_DataObject
*/ */
public static function ensureFeedURL($feed_url, array $hints=array()) public static function ensureFeedURL($feed_url, array $hints=array())
{ {
$oprofile = Ostatus_profile::getKV('feeduri', $feed_url);
if ($oprofile instanceof Ostatus_profile) {
return $oprofile;
}
$discover = new FeedDiscovery(); $discover = new FeedDiscovery();
$feeduri = $discover->discoverFromFeedURL($feed_url); $feeduri = $discover->discoverFromFeedURL($feed_url);