diff options
author | Mario <mario@mariovavti.com> | 2023-08-14 09:21:45 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2023-08-14 09:21:45 +0000 |
commit | a5a1bbf5d789f19fcb007802eee5e9a29abb72e7 (patch) | |
tree | 10e7fc2826f6ec6238196bb9224c6cf155c84212 | |
parent | c4af4e3297f09aa0c6f8ed8e21d6f54729ebfc4d (diff) | |
download | volse-hubzilla-a5a1bbf5d789f19fcb007802eee5e9a29abb72e7.tar.gz volse-hubzilla-a5a1bbf5d789f19fcb007802eee5e9a29abb72e7.tar.bz2 volse-hubzilla-a5a1bbf5d789f19fcb007802eee5e9a29abb72e7.zip |
move profile photo fetching to background
-rw-r--r-- | Zotlabs/Daemon/Xchan_photo.php | 34 | ||||
-rw-r--r-- | Zotlabs/Lib/Activity.php | 10 |
2 files changed, 35 insertions, 9 deletions
diff --git a/Zotlabs/Daemon/Xchan_photo.php b/Zotlabs/Daemon/Xchan_photo.php new file mode 100644 index 000000000..f90d1d726 --- /dev/null +++ b/Zotlabs/Daemon/Xchan_photo.php @@ -0,0 +1,34 @@ +<?php + +/** @file */ + +namespace Zotlabs\Daemon; + +class Xchan_photo { + + static public function run($argc, $argv) { + + if ($argc != 3) { + return; + } + + $url = hex2bin($argv[1]); + $xchan = hex2bin($argv[2]); + + $photos = import_xchan_photo($url, $xchan); + if ($photos) { + $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($photos[0]), + dbesc($photos[1]), + dbesc($photos[2]), + dbesc($photos[3]), + dbesc($xchan) + ); + + if (! $result) { + logger("xchan update failed for $url"); + } + } + } +} diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 992ade200..2741cc79a 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -1846,15 +1846,7 @@ class Activity { } } - $photos = import_xchan_photo($icon, $url); - 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('UTC', 'UTC', $photos[5])), - dbesc($photos[0]), - dbesc($photos[1]), - dbesc($photos[2]), - dbesc($photos[3]), - dbesc($url) - ); + Master::Summon(['Xchan_photo', bin2hex($icon), bin2hex($url)]); } |