if xchan_censored is 2, don't refresh profile photo

This commit is contained in:
Mike Macgirvin 2023-11-24 17:07:37 +11:00
parent c502b1153a
commit 3f529297da
2 changed files with 19 additions and 0 deletions

View file

@ -19,6 +19,24 @@ class Xchan_photo implements DaemonInterface
// Some photo sources hang after connect and aren't caught by curl timeout
$xchan = q("select * from xchan where xchan_hash = '%s'",
dbesc($xchan)
);
if ($xchan && (int)$xchan[0]['xchan_censored'] === 2) {
$result = 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'",
dbescdate(datetime_convert()),
dbesc(z_root() . '/' . Channel::get_default_profile_photo()),
dbesc(z_root() . '/' . Channel::get_default_profile_photo(80)),
dbesc(z_root() . '/' . Channel::get_default_profile_photo(48)),
dbesc('image/png'),
dbesc($xchan)
);
return;
}
set_time_limit(90);
$photos = import_remote_xchan_photo($url, $xchan);

View file

@ -2457,6 +2457,7 @@ class Activity
// pages of Mastodon and Pleroma instance actors in the directory.
// @TODO - (2021-08-27) remove this if they provide a non-person xchan_type
// once extended xchan_type directory filtering is implemented.
$censored = ((strpos($profile, 'instance_actor') || strpos($profile, '/internal/fetch')) ? 1 : 0);
$r = q(