Skip to content

Commit a5d8475

Browse files
Merge pull request #17 from matomo-org/fix-mark-report-sent
Adds missing markReportAsSent method
2 parents 8b0ce51 + 9c46fc1 commit a5d8475

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
## Changelog
22

3+
5.0.1 - 2025-10-10
4+
- Fix markReportAsSent method was missing
5+
36
5.0.0 - 2025-09-29
47
- Initial release to send scheduled reports and Custom Alerts to a Slack channel

Slack.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,9 @@ public function sendReport(
319319
$subject = Piwik::translate('Slack_PleaseFindYourReport', [$periods[$report['period']], $reportSubject]);
320320
$channelId = $report['parameters'][self::SLACK_CHANNEL_ID_PARAMETER];
321321
$scheduleReportSlack = new ScheduleReportSlack($subject, $filename, $contents, $channelId, $token);
322-
$scheduleReportSlack->send();
322+
if ($scheduleReportSlack->send() && !$force) {
323+
$this->markReportAsSent($report, $period);
324+
}
323325
}
324326

325327
/**
@@ -503,6 +505,13 @@ private function reportAlreadySent($report, Period $period)
503505
return $previousDate === $period->getRangeString();
504506
}
505507

508+
private function markReportAsSent($report, Period $period)
509+
{
510+
$key = ScheduledReports::OPTION_KEY_LAST_SENT_DATERANGE . $report['idreport'];
511+
512+
Option::set($key, $period->getRangeString());
513+
}
514+
506515
private static function valueIsTrue($value)
507516
{
508517
return $value == 'true' || $value == 1 || $value == '1' || $value === true;

plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Slack",
33
"description": "Send Matomo reports and alerts to Slack channels, keeping your team informed and ready to act in real time.",
4-
"version": "5.0.0",
4+
"version": "5.0.1",
55
"theme": false,
66
"require": {
77
"matomo": ">=5.0.0,<6.0.0-b1"

0 commit comments

Comments
 (0)