Index: admin/index.php =================================================================== RCS file: /cvsroot/moodle/moodle/admin/index.php,v retrieving revision 1.286.2.16 diff -u -r1.286.2.16 index.php --- admin/index.php 4 Feb 2008 10:58:25 -0000 1.286.2.16 +++ admin/index.php 25 Feb 2008 14:41:55 -0000 @@ -467,6 +467,9 @@ /// Check all message output plugins and upgrade if necessary upgrade_plugins('message','message/output',"$CFG->wwwroot/$CFG->admin/index.php"); +/// Check all admin report plugins and upgrade if necessary + upgrade_plugins('report',$CFG->admin.'/report',"$CFG->wwwroot/$CFG->admin/index.php"); + /// just make sure upgrade logging is properly terminated upgrade_log_finish(); Index: admin/cron.php =================================================================== RCS file: /cvsroot/moodle/moodle/admin/cron.php,v retrieving revision 1.126.2.10 diff -u -r1.126.2.10 cron.php --- admin/cron.php 24 Feb 2008 13:29:10 -0000 1.126.2.10 +++ admin/cron.php 25 Feb 2008 14:41:55 -0000 @@ -159,6 +159,32 @@ } mtrace('Finished blocks'); + mtrace('Starting admin reports'); + // Admin reports do not have a database table that lists them. Instead a + // report includes cron.php with function reportname_cron() if it wishes + // to be cronned. It is up to cron.php to handle e.g. if it only needs to + // actually do anything occasionally. + $reports=get_list_of_plugins($CFG->admin.'/report'); + foreach($reports as $report) { + $cronfile=$CFG->dirroot.'/'.$CFG->admin.'/report/'.$report.'/cron.php'; + if(file_exists($cronfile)) { + require_once($cronfile); + $cronfunction='report_'.$report.'_cron'; + mtrace('Processing cron function for '.$report.'...',''); + if (!empty($PERF->dbqueries)) { + $pre_dbqueries = $PERF->dbqueries; + $pre_time = microtime(true); + } + $cronfunction(); + if (isset($pre_dbqueries)) { + mtrace("... used " . ($PERF->dbqueries - $pre_dbqueries) . " dbqueries"); + mtrace("... used " . round(microtime(true) - $pre_time,2) . " seconds"); + } + mtrace('done.'); + } + } + mtrace('Finished admin reports'); + if (!empty($CFG->langcache)) { mtrace('Updating languages cache'); get_list_of_languages(true);