Hi,
Statistics are not working for my moodle site. When I run the cron, either scheduled or manually, I get the following output (with debug settings set to developer).
Running auth crons if required...
Running daily statistics gathering, starting at 1223942400:
1:0 2:0 3:1 <div class="notifytiny" style="text-align:center"><br /><br />UPDATE mdl_stats_daily
SET stat2 = (SELECT COUNT(DISTINCT ra.userid)
FROM mdl_role_assignments ra JOIN mdl_context ctx
ON ctx.id = ra.contextid
CROSS JOIN mdl_course c
JOIN mdl_role_capabilities rc
ON rc.roleid = ra.roleid LEFT OUTER JOIN mdl_course_categories cc1
ON cc1.id = c.category
WHERE ra.roleid = mdl_stats_daily.roleid AND
c.id = mdl_stats_daily.courseid AND
((rc.capability = 'moodle/course:view' )
AND rc.permission = 1 AND rc.contextid = 1
AND (ctx.contextlevel = 10
OR (c.id = ctx.instanceid AND ctx.contextlevel = 50) OR (cc1.id = ctx.instanceid AND ctx.contextlevel = 40))) AND
EXISTS (SELECT 'x'
FROM mdl_log l
WHERE l.course = mdl_stats_daily.courseid AND
l.userid = ra.userid AND l.time >= 1223942400 AND l.time < 1224028800))
WHERE mdl_stats_daily.stattype = 'enrolments' AND
mdl_stats_daily.timeend = 1224028800 AND
mdl_stats_daily.courseid IN
(SELECT DISTINCT l.course
FROM mdl_log l
WHERE l.time >= 1223942400 AND l.time < 1224028800)<ul style="text-align:left"><li>line 103 of lib\dmllib.php: call to debugging()</li><li>line 255 of lib\statslib.php: call to execute_sql()</li><li>line 468 of admin\cron.php: call to stats_cron_daily()</li></ul></div>
<div class="notifytiny" style="text-align:center"><br /><br />SELECT name FROM mdl_config WHERE name = 'statsrunning'<ul style="text-align:left"><li>line 686 of lib\dmllib.php: call to debugging()</li><li>line 1134 of lib\dmllib.php: call to get_recordset_sql()</li><li>line 1098 of lib\dmllib.php: call to get_field_sql()</li><li>line 648 of lib\moodlelib.php: call to get_field()</li><li>line 476 of lib\adminlib.php: call to set_config()</li><li>line 559 of lib\statslib.php: call to set_cron_lock()</li><li>line 468 of admin\cron.php: call to stats_cron_daily()</li></ul></div>
...error occured, completed 0 days of statistics.
Cron script completed correctly
My Moodle setup is: Moodle 1.9.3+ (20081015), Apache 2.2, Php 5.2.6, MS SQL 2005 and FreeTDS
Cheers,
Ross