Stats Problem

Bart

Active Member
Heya,
I've got a little stats problem, everyday i get a few Uniques Out & Total Out,
But for some reason yesterday it shows i got 0.

The thing is i refresh the stats page quite often and i know i had a minimum of 50 Uniques Out and 60 Total Out but for some reason VisoaList did not register them when today started, i have changed nothing at all and everything is the same as it was for the past 2 weeks.

Please have a look:
http://maxleech.com/stats/

Don't worry about Unique PVs, Total PVs & Unique In as i don;t get any anyway.

Regards,
Bart
 

Mark

Administrator
Staff member
Looks like something happened while your new_day() and new_week() functions were running. Any clues in your error log?
 

Mark

Administrator
Staff member
Any clues in your error log?

if this problem is as common as it seems to be we might want to move new_day functions into a cron job instead of the pseudo cron being used now in index.php
 

Basti

Administrator
Staff member
Yes Mark, a real cron would be needed. the data is not lost, it just seem to trigger new_day twice. This issue has been there ever since aardvark
 

Mark

Administrator
Staff member
I thought so, I will do some testing and add this asap.

I think the way to handle this is is with an option in the admin panel:

have you setup a cron job on your server? (if yes automatically disable psuedo cron)
 
Cron job would be better to as it is always done each day. If no one is clicking to your website, a pseudo cron will not get processed.
 

Basti

Administrator
Staff member
Indeed. Pseudo cron is nice though, not relying on the user to create a cron job. Kills user mistakes.
I know what is triggering the double function call, just dont see a way how to stop it from happening
 

Mark

Administrator
Staff member
Edit your index.php file and remove or comment out this part:

PHP:
// Is it a new day/week/month?
list($last_new_day, $last_new_week, $last_new_month) =
    $DB->fetch("SELECT last_new_day, last_new_week, last_new_month FROM {$CONF['sql_prefix']}_etc", __file__, __line__);
$time = time() + (3600 * $CONF['time_offset']);
$current_day = date('d', $time);
$current_week = date('W', $time);
$current_month = date('m', $time);
if ($last_new_month != $current_month) {
    require_once ("{$CONF['path']}/sources/misc/new_day.php");
    new_month($current_month);
}
if ($last_new_week != $current_week) {
    require_once ("{$CONF['path']}/sources/misc/new_day.php");
    new_week($current_week);
}
if ($last_new_day != $current_day) {
    require_once ("{$CONF['path']}/sources/misc/new_day.php");
    new_day($current_day);
}
download the attached file, extract cron.php and upload it to your lists root directory *(the same place button.php is found)

set a cron job on your server to run this everyday at midnight.

Let me know how it goes
 

Attachments

Basti

Administrator
Staff member
They could not mess up the stats, unless they change the value of last_new_month etc in the database. If they access it at any other time than midnight, the code in cron.php simply does not run. Its the same code as in index.php, but cant be triggered twice by accident ( so the 0 stats are happening we guess )
 

Mark

Administrator
Staff member
depend on your server configuration, they are not universal. For the most reliable answer you should ask your host.

Most Cpanel servers would work like so, but again paths can vary greatly:

/usr/local/bin/php -f /home/username/public_html/cron.php
 

Bart

Active Member
I've a small problem, yesterday i checked with my host what kind of cron job i need and they informed me that:
/home/username/public_html/maxleech.com/cron.php

Is fine to use for the cron job, but when the Cron Job ran it sent me this error in my email:
/bin/sh: /home/username/public_html/maxleech.com/cron.php: Permission denied

And when i took a look at the cron job file i saw thisL
Fatal error: Class 'PluginManager' not found in /home/username/public_html/maxleech.com/sources/misc/new_day.php on line 120

I have changed the name of cron.php for personal peace of mind security.

Please help <3
 
Top