2021-12-03 03:01:39 +00:00
|
|
|
<?php
|
2018-09-07 00:37:09 +00:00
|
|
|
|
2021-12-03 03:01:39 +00:00
|
|
|
/** @file */
|
2018-09-07 00:37:09 +00:00
|
|
|
|
2021-12-03 03:01:39 +00:00
|
|
|
namespace Zotlabs\Daemon;
|
2018-09-07 00:37:09 +00:00
|
|
|
|
2021-12-03 03:01:39 +00:00
|
|
|
class Xchan_photo
|
|
|
|
{
|
2020-08-17 04:55:59 +00:00
|
|
|
|
2021-12-03 03:01:39 +00:00
|
|
|
public static function run($argc, $argv)
|
|
|
|
{
|
2018-09-07 00:37:09 +00:00
|
|
|
|
2021-12-03 03:01:39 +00:00
|
|
|
if ($argc != 3) {
|
|
|
|
return;
|
|
|
|
}
|
2018-09-07 00:37:09 +00:00
|
|
|
|
2021-12-03 03:01:39 +00:00
|
|
|
$url = hex2bin($argv[1]);
|
|
|
|
$xchan = hex2bin($argv[2]);
|
2018-09-07 00:37:09 +00:00
|
|
|
|
2021-12-03 03:01:39 +00:00
|
|
|
// Some photo sources hang after connect and aren't caught by curl timeout
|
2018-09-07 01:33:27 +00:00
|
|
|
|
2021-12-03 03:01:39 +00:00
|
|
|
set_time_limit(90);
|
2018-09-07 00:37:09 +00:00
|
|
|
|
2021-12-03 03:01:39 +00:00
|
|
|
$photos = import_remote_xchan_photo($url, $xchan);
|
|
|
|
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' where xchan_hash = '%s'",
|
|
|
|
dbescdate(datetime_convert()),
|
|
|
|
dbesc($photos[0]),
|
|
|
|
dbesc($photos[1]),
|
|
|
|
dbesc($photos[2]),
|
|
|
|
dbesc($photos[3]),
|
|
|
|
dbesc($xchan)
|
|
|
|
);
|
|
|
|
}
|
2018-09-07 00:37:09 +00:00
|
|
|
|
2021-12-03 03:01:39 +00:00
|
|
|
return;
|
|
|
|
}
|
2018-09-07 00:37:09 +00:00
|
|
|
}
|