@ziegenberg opened this Issue on January 5th 2011 Contributor

If some PDFReports are declared the Cron Task stops with an Error.
In the class Piwik_PDFReports the function getScheduledTasks (piwik/plugins/PDFReports/PDFReports.php, 40) calls Piwik_Date::factory (piwik/core/Date.php, 45) on line 49 and this factory expects a string as the first argument, but Piwik_PDFReports gives it a Piwik_Date Object. Solution to this problem was to call getTimestamp() on that Object to meet the requirements of the factory function. Actually I didn't know if you expect a UTC time or the Time with the Timezone in, so either getTimestamp() oder getTimestampUTC() might be correct.

I changed:

    $baseDate = Piwik_Date::factory("1971-01-01");
    foreach($sites as &$site)
    {
        $offsetDate = Piwik_Date::factory($baseDate,  $site['timezone']);

        // Earlier means a negative timezone
        if ( $offsetDate->isEarlier($baseDate) )
        {

to:

    $baseDate = Piwik_Date::factory("1971-01-01");
    foreach($sites as &$site)
    {
        $offsetDate = Piwik_Date::factory($baseDate->getTimestamp(),  $site['timezone']);

        // Earlier means a negative timezone
        if ( $offsetDate->isEarlier($baseDate) )
        {

Keywords: nasty bug

@ziegenberg commented on January 5th 2011 Contributor

Attachment:
backtrace.txt

@mattab commented on January 5th 2011 Member

This was fixed in Piwik 1.1.1

This Issue was closed on January 5th 2011
Powered by GitHub Issue Mirror