]> git.mxchange.org Git - friendica.git/commitdiff
re-fetch FB photos that failed
authorFriendika <info@friendika.com>
Tue, 10 May 2011 05:44:14 +0000 (22:44 -0700)
committerFriendika <info@friendika.com>
Tue, 10 May 2011 05:44:14 +0000 (22:44 -0700)
addon/facebook/facebook.php

index 2120459c39acbcef51fbcf9a535d0df63fffef07..76b26003c14275c466a3cdb751c58fd3770708b8 100644 (file)
@@ -141,6 +141,31 @@ function fb_get_friends($uid) {
                                );                      
 
                                if(count($r)) {
+
+                                       // check that we have all the photos, this has been known to fail on occasion
+
+                                       if((! $r[0]['photo']) || (! $r[0]['thumb']) || (! $r[0]['micro'])) {  
+                                               require_once("Photo.php");
+
+                                               $photos = import_profile_photo('https://graph.facebook.com/' . $jp->id . '/picture', $uid, $r[0]['id']);
+
+                                               $r = q("UPDATE `contact` SET `photo` = '%s', 
+                                                       `thumb` = '%s',
+                                                       `micro` = '%s', 
+                                                       `name-date` = '%s', 
+                                                       `uri-date` = '%s', 
+                                                       `avatar-date` = '%s'
+                                                       WHERE `id` = %d LIMIT 1
+                                               ",
+                                                       dbesc($photos[0]),
+                                                       dbesc($photos[1]),
+                                                       dbesc($photos[2]),
+                                                       dbesc(datetime_convert()),
+                                                       dbesc(datetime_convert()),
+                                                       dbesc(datetime_convert()),
+                                                       intval($r[0]['id'])
+                                               );                      
+                                       }       
                                        continue;
                                }
                                else {