]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Reduce duplication by handling both cases in find
authorStephen Paul Weber <singpolyma@singpolyma.net>
Fri, 23 Oct 2015 16:26:35 +0000 (16:26 +0000)
committerStephen Paul Weber <singpolyma@singpolyma.net>
Fri, 23 Oct 2015 16:26:35 +0000 (16:26 +0000)
plugins/TwitterBridge/lib/twitterimport.php

index 70c9093fa2f202fdd1d4cd39ed975822d9d9b6d9..d9858ca968683dfaecf19b4a3c036a03912244a4 100644 (file)
@@ -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);