Often somebody will join the matrix with a dodgy cert and we'll sort that out but their profile photo will remain rainbow man (or the site default). However the photo_date has been updated so we won't try again. This checkin looks for such a failure and leaves the photo_date alone if the photo import failed.
This commit is contained in:
parent
73f459b68d
commit
769b0f6bc9
@ -616,7 +616,7 @@ function import_profile_photo($photo,$xchan,$thing = false) {
|
|||||||
$type = 'image/jpeg';
|
$type = 'image/jpeg';
|
||||||
}
|
}
|
||||||
|
|
||||||
return(array($photo,$thumb,$micro,$type));
|
return(array($photo,$thumb,$micro,$type,$photo_failure));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -728,7 +728,8 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED) {
|
|||||||
z_root() . '/photo/profile/l/' . $local[0]['channel_id'],
|
z_root() . '/photo/profile/l/' . $local[0]['channel_id'],
|
||||||
z_root() . '/photo/profile/m/' . $local[0]['channel_id'],
|
z_root() . '/photo/profile/m/' . $local[0]['channel_id'],
|
||||||
z_root() . '/photo/profile/s/' . $local[0]['channel_id'],
|
z_root() . '/photo/profile/s/' . $local[0]['channel_id'],
|
||||||
$arr['photo_mimetype']
|
$arr['photo_mimetype'],
|
||||||
|
false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -736,16 +737,29 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED) {
|
|||||||
$photos = import_profile_photo($arr['photo'],$xchan_hash);
|
$photos = import_profile_photo($arr['photo'],$xchan_hash);
|
||||||
}
|
}
|
||||||
if($photos) {
|
if($photos) {
|
||||||
$r = q("update xchan set xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s'
|
if($photos[4]) {
|
||||||
where xchan_hash = '%s' limit 1",
|
// importing the photo failed somehow. Leave the photo_date alone so we can try again at a later date.
|
||||||
dbesc(datetime_convert('UTC','UTC',$arr['photo_updated'])),
|
// This often happens when somebody joins the matrix with a bad cert.
|
||||||
dbesc($photos[0]),
|
$r = q("update xchan set xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s'
|
||||||
dbesc($photos[1]),
|
where xchan_hash = '%s' limit 1",
|
||||||
dbesc($photos[2]),
|
dbesc($photos[0]),
|
||||||
dbesc($photos[3]),
|
dbesc($photos[1]),
|
||||||
dbesc($xchan_hash)
|
dbesc($photos[2]),
|
||||||
);
|
dbesc($photos[3]),
|
||||||
|
dbesc($xchan_hash)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$r = q("update xchan set xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s'
|
||||||
|
where xchan_hash = '%s' limit 1",
|
||||||
|
dbesc(datetime_convert('UTC','UTC',$arr['photo_updated'])),
|
||||||
|
dbesc($photos[0]),
|
||||||
|
dbesc($photos[1]),
|
||||||
|
dbesc($photos[2]),
|
||||||
|
dbesc($photos[3]),
|
||||||
|
dbesc($xchan_hash)
|
||||||
|
);
|
||||||
|
}
|
||||||
$what .= 'photo ';
|
$what .= 'photo ';
|
||||||
$changed = true;
|
$changed = true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user