From: Stephen Paul Weber Date: Fri, 23 Oct 2015 16:26:35 +0000 (+0000) Subject: Reduce duplication by handling both cases in find X-Git-Url: https://git.mxchange.org/?p=quix0rs-gnu-social.git;a=commitdiff_plain;h=2030ddfc7992f4c36cfb2123b250c6c88e9bf44c Reduce duplication by handling both cases in find --- diff --git a/plugins/TwitterBridge/lib/twitterimport.php b/plugins/TwitterBridge/lib/twitterimport.php index 70c9093fa2..d9858ca968 100644 --- a/plugins/TwitterBridge/lib/twitterimport.php +++ b/plugins/TwitterBridge/lib/twitterimport.php @@ -233,7 +233,10 @@ class TwitterImport $profile->limit(1); if (!$profile->find(true)) { - throw new NoResultException($profile); + $profile->profileurl = str_replace('https://', 'http://', $profileurl); + if (!$profile->find(true)) { + throw new NoResultException($profile); + } } return $profile; } @@ -242,16 +245,6 @@ class TwitterImport { // check to see if there's already a profile for this user $profileurl = 'https://twitter.com/' . $twuser->screen_name; - try { - $profile = $this->getProfileByUrl($twuser->screen_name, $profileurl); - $this->updateAvatar($twuser, $profile); - return $profile; - } catch (NoResultException $e) { - common_debug(__METHOD__ . ' - Falling back to check for http: ' . - "for Twitter user: $profileurl."); - } - - $profileurl = 'http://twitter.com/' . $twuser->screen_name; try { $profile = $this->getProfileByUrl($twuser->screen_name, $profileurl); $this->updateAvatar($twuser, $profile);