X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FOStatus%2Fclasses%2FOstatus_profile.php;h=b94950138fd15d8acd8d615f1f4c38de4f66d0a2;hb=e45c784451f9a63e4cf87255d13ed90d568fb621;hp=cf5e3f90edbdb86eb76523ef1c0b601d94c370dc;hpb=1a5101d654fb29abe0e9291a4f70af6e5bbad530;p=quix0rs-gnu-social.git diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index cf5e3f90ed..b94950138f 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -81,6 +81,14 @@ class Ostatus_profile extends Managed_DataObject return $this->uri; } + public function fromProfile(Profile $profile) + { + $oprofile = Ostatus_profile::getKV('profile_id', $profile->id); + if (!$oprofile instanceof Ostatus_profile) { + throw new Exception('No Ostatus_profile for Profile ID: '.$profile->id); + } + } + /** * Fetch the locally stored profile for this feed * @return Profile @@ -93,10 +101,10 @@ class Ostatus_profile extends Managed_DataObject } $profile = Profile::getKV('id', $this->profile_id); - if ($profile instanceof Profile) { - return $profile; + if (!$profile instanceof Profile) { + throw new NoProfileException($this->profile_id); } - throw new NoProfileException($this->profile_id); + return $profile; } /** @@ -1133,8 +1141,9 @@ class Ostatus_profile extends Managed_DataObject ?: $discover->getAtomLink(Salmon::NS_REPLIES); $hints['salmon'] = $salmonuri; - if (!$huburi && !common_config('feedsub', 'fallback_hub')) { + if (!$huburi && !common_config('feedsub', 'fallback_hub') && !common_config('feedsub', 'nohub')) { // We can only deal with folks with a PuSH hub + // unless we have something similar available locally. throw new FeedSubNoHubException(); } @@ -1526,7 +1535,7 @@ class Ostatus_profile extends Managed_DataObject $huburi = $discover->getHubLink(); } - if (!$huburi && !common_config('feedsub', 'fallback_hub')) { + if (!$huburi && !common_config('feedsub', 'fallback_hub') && !common_config('feedsub', 'nohub')) { // We can only deal with folks with a PuSH hub throw new FeedSubNoHubException(); }