Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reports do not send whilst set to a daily basis #1961

Closed
jloh opened this issue Jan 5, 2011 · 32 comments
Closed

Reports do not send whilst set to a daily basis #1961

jloh opened this issue Jan 5, 2011 · 32 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@jloh
Copy link

jloh commented Jan 5, 2011

Hi guys,

Whilst setting up websites I've set it to email reports to myself, mooash@gmail.com, on a weekly basis. The only problem is, that it doesn't do this. When I hit "Send report now." the report sends, but on Monday it doesn't send. I live in Australia, Tasmania to be exact and my server is hosted in Richmond, Virginia in the USA. I shall attach a screenshot of my current report settings. I don't think whether this is a bug or just me fucking something up somehow, if it is the later then I am sorry in advance!

Cheers,

James
Keywords: mail report piwik

@jloh
Copy link
Author

jloh commented Jan 5, 2011

Attachment: First Screenshot
screenshot 1.png

@jloh
Copy link
Author

jloh commented Jan 5, 2011

Attachment: Second Screenshot
screenshot 2.png

@julienmoumne
Copy link
Member

Did you check your mail configuration by clicking on "Send Report Now" ?

@robocoder
Copy link
Contributor

Are you running Piwik 1.1.1? This fix went in for php 5.1.x: [3617]

@jloh
Copy link
Author

jloh commented Jan 6, 2011

Sorry, the title of this ticket is wrong. It should be weekly* not daily basis. But I am currently testing on daily trying and get them working.

@julienm, yes, when I hit "Send Report Now" the reports do send.

@vipsoft, I upgraded to the latest version last night, but no matter what version I've been running they haven't sent. I'm currently running php version 5.2.14

@jloh
Copy link
Author

jloh commented Jan 6, 2011

Actually I tried sending a daily report then, the email went through, but the PDF didn't have any information in it. The structure of the file was all their, the tables and such, but no information.

@mattab
Copy link
Member

mattab commented Jan 6, 2011

what language did you set your piwik to? maybe you set it to an unsupported language (there are not many left, but a few are not supported by the PDF library and fonts)

@jloh
Copy link
Author

jloh commented Jan 6, 2011

My Piwik is currently set to English.

@mattab
Copy link
Member

mattab commented Jan 9, 2011

Please post the PDF without any info in it so we can see what you mean.

To summarize, daily PDF is empty but is sent, and weekly/monthly PDF don't send at all?

@jloh
Copy link
Author

jloh commented Jan 9, 2011

Ah. Turns out the PDF's do show content, Google reader was stuffing up.

Sorry about the confusion, my explanation is very messy.

Pretty much when I schedule reports to send no matter whether its weekly or daily, I am yet to test monthly out yet, they do not send. Yet when I click "Send Report Now" they do send. My settings are still set to as they were above on the attachment. Sorry for all the confusion.

Make a little bit more sense now?

@anonymous-matomo-user
Copy link

We are also experiencing the same issue with Pwiki 1.1.1. Reports are set up to send daily but never send. If we click the "Send Report Now" button, it works without error.

If there's any workaround or further information we can provide to help debug the issue please let us know!

@mattab
Copy link
Member

mattab commented Jan 13, 2011

Questions

  • Do you have 'enable browser to trigger archiving' to yes or no?
  • Have you setup cronjob?

@jloh
Copy link
Author

jloh commented Jan 15, 2011

Hi matt, I have 'enable browser to trigger archiving' set to yes I'm pretty sure. And I don't have a cronjob setup.

@robocoder
Copy link
Contributor

See bolero's patch in http://forum.piwik.org/read.php?2,71473,page=1#msg-71752

@anonymous-matomo-user
Copy link

On second thought it seems that the original "if(strlen($piwikHost) == 0)" is meant as a fix for this problem. But it fails because getCurrentHost allows for passing a parameter and has a default value of "unknown". I assume that "unknown" is used elsewhere, or maybe just some Piwik code convention. The author of the PDF plugin wasn't aware of this and checks for an empty string - makes sense.
There are at least three solutions.

  1. reduce my code from the forum in Mail.php to just
    public function setFrom($email, $name = null)
    {
        $piwikHost = Piwik_Url::getCurrentHost();
        if ($piwikHost == "" || $piwikHost == "unknown")
            $piwikHost = $_ENV['HOSTNAME'];
        $email = str_replace('{DOMAIN}', $piwikHost, $email);
        parent::setFrom($email, $name);
    ```}

2. pass in the host (which may create other problems, e.g. overwrite values)

3. change getCurrentHost in Url.php. The $default='unknown' doesn't make any sense to me. You cannot pass a $default parameter there, because it would get set to $_SERVER[later, anyway. So, you always end up with "unknown" or $_SERVER['HTTP_HOST']('HTTP_HOST']). (Unless you run via cron *and* pass something in, but this isn't done.)
Proposed change:

static public function getCurrentHost()
{
    ...

    if(isset($_SERVER['HTTP_HOST']))
    {
        $default = Piwik_Common::sanitizeInputValue($_SERVER['HTTP_HOST']);
    }
    elseif ($_ENV['HOSTNAME'])
    {
        $default = Piwik_Common::sanitizeInputValue($_ENV['HOSTNAME']);
    }
    else
    {
        $default = "unknown";
    }

    ...
}

Btw, I don't understand this construct:

static $hostHeaders = null;
if(is_null($hostHeaders))


Isn't that always to be true, anyway?

@anonymous-matomo-user
Copy link

I have found that this will not always work. I thought it worked, but I guess I still had the hard-coded FQDN in the code.

$_ENV['HOSTNAME']

gets the hostname if run on the command line. However, via cron it seems to be empty. I'm too lazy zu troubleshoot this any further. I just changed the code to set a given hostname if there's still an empty $piwikHost at the end.

So, there should be an option that always fills in an appropriate FQDN if it's still empty.

Possible solutions:

  • have the user enter a sender address for the reports
  • use the hostname from piwik_site - main_url

@robocoder
Copy link
Contributor

What if you usephp_uname('n') to get the host name?

@anonymous-matomo-user
Copy link

php_uname seems to have a bug. I get "host" only, no matter if I use 'n' or even 'a' ! Version is 5.2.16

@anonymous-matomo-user
Copy link

Oh, wrong usage. I thought I could get a direct output from this command on the command line. I added it to Mail.php, let's see tomorrow.

@jloh
Copy link
Author

jloh commented Feb 8, 2011

I am so confused right now...

@anonymous-matomo-user
Copy link

Ok, "$piwikHost = php_uname('n')" in Mail.php (=solution 1. above) works for cron. Do you want to go with solution 1., 2. or 3.? I can test No. 3 as well if you want. Something like

    static public function getCurrentHost()
    {
        ...

        if(isset($_SERVER['HTTP_HOST']))
        {
            $default = Piwik_Common::sanitizeInputValue($_SERVER['HTTP_HOST']);
        }
        elseif (isset($_ENV['HOSTNAME']))
        {
            $default = Piwik_Common::sanitizeInputValue($_ENV['HOSTNAME']);
        }
        else
        {
            $default = php_uname('n'); //not necessary to sanitize?
        }

        ...
    }

@jloh
Copy link
Author

jloh commented Feb 8, 2011

Alright, I just changed my mail.php and I just setup a cron job. I'll get back to you soon!

@mattab
Copy link
Member

mattab commented Feb 17, 2011

Is there any update on this? Is there a proposed patch for trunk? please attach :)

@anonymous-matomo-user
Copy link

There was no answer to my question if I should test solution 3 as well. Won't test solution 3 if you want to use solution 1. I'm running with solution 1 now. I can test solution 3 if you want to implement it. I think that's the preferred way to do it (it fixes the problem at the source), but I don't know what you prefer.

@jloh
Copy link
Author

jloh commented Feb 17, 2011

I've tried using solution 1 but I don't my host likes cron jobs much, that or I'm just retarded in setting it up. Maybe we could try solution 3?

@anonymous-matomo-user
Copy link

Solution 1 works. You may not have correctly implemmented it. And solution 3 is outlined above. You can just try it.

@jloh
Copy link
Author

jloh commented Feb 17, 2011

Do I need to use cron to use it?

@anonymous-matomo-user
Copy link

No. If you do not use cron I think you do not need either solution. This solution should only be necessary if archive.sh is run by cron because then the environment doesn't include the $_SERVER array which is originally used to get the hostname.

@mattab
Copy link
Member

mattab commented Feb 17, 2011

I'll mark it as fixed because I think this is not a bug in 1.2-rc as this code has changed and now we pass piwik.org as parameter to the function.

@mattab
Copy link
Member

mattab commented Feb 17, 2011

(In [3936]) Refs #1961 Adding new config parameter to configure the default hostname when it couldn't be detected

To test with this new code, please try 1.2-rc3, more info in: http://forum.piwik.org/read.php?2,72265

@anonymous-matomo-user
Copy link

I would not pass piwik.org in. You may get lots of botmail to non-existant addresses under piwik.org. I would either pass nothing or "unknown" (as now) or something like @setconfigparameter_parametername_@example.com. This would trip off people if there is a problem and the latter syntax would even tell them what to do.

@mattab
Copy link
Member

mattab commented Feb 19, 2011

(In [3943]) Refs #1961 changing default host from piwik.org thanks for the tip!

@jloh jloh added this to the Piwik 1.2 milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

5 participants