code style: line breaks
[dokuwiki.git] / inc / Subscriptions / MediaSubscriptionSender.php
blob84497c0714dd30ce2294dfc27e432ca3419344db
1 <?php
3 namespace dokuwiki\Subscriptions;
5 class MediaSubscriptionSender extends SubscriptionSender
7 /**
8 * Send the diff for some media change
10 * @fixme this should embed thumbnails of images in HTML version
12 * @param string $subscriber_mail The target mail address
13 * @param string $template Mail template ('uploadmail', ...)
14 * @param string $id Media file for which the notification is
15 * @param int|bool $rev Old revision if any
16 * @param int|bool $current_rev New revision if any
18 public function sendMediaDiff($subscriber_mail, $template, $id, $rev = false, $current_rev = false)
20 global $conf;
22 $file = mediaFN($id);
23 [$mime, /* ext */] = mimetype($id);
25 $trep = [
26 'MIME' => $mime,
27 'MEDIA' => ml($id, $current_rev ? ('rev=' . $current_rev) : '', true, '&', true),
28 'SIZE' => filesize_h(filesize($file)),
31 if ($rev && $conf['mediarevisions']) {
32 $trep['OLD'] = ml($id, "rev=$rev", true, '&', true);
33 } else {
34 $trep['OLD'] = '---';
37 $headers = ['Message-Id' => $this->getMessageID($id, @filemtime($file))];
38 if ($rev) {
39 $headers['In-Reply-To'] = $this->getMessageID($id, $rev);
42 $this->send($subscriber_mail, 'upload', $id, $template, $trep, null, $headers);