This is a hotfix for #5300 to prevent email reports from being sent more than once.
Now each time a report is sent, the last "period" it was sent for will be stored in the Option table. Before sending a report, we check if we have already sent a report for the same period.
If the report is sent manually through the web interface, a
force parameter is set to
true, which means that the whole "prevent from sending it twice" thing is ignored.
The tests are failing but it seems to be the same tests failing on master too: https://travis-ci.org/piwik/piwik/jobs/37238693 (broken for commit https://github.com/piwik/piwik/commit/092fda637eb967dd8aa0ca01c3817475effca8fc)
They started failing in https://travis-ci.org/piwik/piwik/jobs/37159183
but build was still "passing" because that error case did not return error code != 0 until few hours later with 092fda637eb967dd8aa0ca01c3817475effca8fc
I amended the commit to address your comments.
Looks good, well done
I'm sorry to report I still receive double Alerts. What is different in my case is that one email is English the other one in French. They're loged into the interface :
Also, my cronjob is set to every 15 minutes and emails where received with 4 minutes difference :
It's no big deal but I wanted to let you know.
Hi @gaumondp this is a different bug (this issue is about email reports). can you please create new issue?