コード例 #1
0
ファイル: health.php プロジェクト: remotelearner/elis.cm
 function description()
 {
     if ($this->inprogress) {
         require_once dirname(__FILE__) . '/etl.php';
         $state = user_activity_task_init(false);
         $last_time = (int) $state['starttime'];
         $records_done = count_records_select('log', "time < {$last_time}");
         $records_togo = count_records_select('log', "time >= {$last_time}");
         return "The ETL process has not completed running.  Certain reports (such as the site-wide time summary) may show incomplete data until the ETL process has completed.\nCurrently, <b>{$records_done}</b> records have been processed and <b>{$records_togo}</b> records remain to be processed.";
     } else {
         return "The ETL process has not been run.  This prevents certain reports (such as the\nsite-wide time summary) from working.";
     }
 }
コード例 #2
0
ファイル: etl.php プロジェクト: remotelearner/elis.cm
/**
 * Splits the Moodle log into sessions for each user, tracking how long they
 * have spent in each Moodle course.
 *
 * Processes approx 40k records / minute
 */
function user_activity_etl_cron()
{
    $rununtil = time() + USERACT_TIME_LIMIT;
    $state = user_activity_task_init();
    do {
        list($completed, $total) = user_activity_task_process($state);
    } while (time() < $rununtil && $completed < $total);
    if ($completed < $total) {
        user_activity_task_save($state);
    } else {
        user_activity_task_finish($state);
    }
}