Merge branch 'master' into revisionHandle3
[dokuwiki.git] / inc / Subscriptions / MediaSubscriptionSender.php
blob1757c2b1c91120a46ad406d0b088cce55f38e72e
1 <?php
4 namespace dokuwiki\Subscriptions;
7 class MediaSubscriptionSender extends SubscriptionSender
10 /**
11 * Send the diff for some media change
13 * @fixme this should embed thumbnails of images in HTML version
15 * @param string $subscriber_mail The target mail address
16 * @param string $template Mail template ('uploadmail', ...)
17 * @param string $id Media file for which the notification is
18 * @param int|bool $rev Old revision if any
19 * @param int|bool $current_rev New revision if any
21 public function sendMediaDiff($subscriber_mail, $template, $id, $rev = false, $current_rev = false)
23 global $conf;
25 $file = mediaFN($id);
26 list($mime, /* $ext */) = mimetype($id);
28 $trep = [
29 'MIME' => $mime,
30 'MEDIA' => ml($id, $current_rev?('rev='.$current_rev):'', true, '&', true),
31 'SIZE' => filesize_h(filesize($file)),
34 if ($rev && $conf['mediarevisions']) {
35 $trep['OLD'] = ml($id, "rev=$rev", true, '&', true);
36 } else {
37 $trep['OLD'] = '---';
40 $headers = ['Message-Id' => $this->getMessageID($id, @filemtime($file))];
41 if ($rev) {
42 $headers['In-Reply-To'] = $this->getMessageID($id, $rev);
45 $this->send($subscriber_mail, 'upload', $id, $template, $trep, null, $headers);