aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Daemon/Xchan_photo.php
blob: 662fc967c56f43606cb42d995d70237bccba44a4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?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]);
		$force = $argv[3];

		$photos = import_xchan_photo($url, $xchan, false, $force);
		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 photo update failed for $url");
			}
		}

		return;
	}
}