Skip to content

Commit

Permalink
Merge branch 'MDL-68052' of git://github.com/danmarsden/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
abgreeve committed Nov 30, 2020
2 parents f34b446 + 9ae7167 commit bc58174
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
15 changes: 15 additions & 0 deletions admin/settings/analytics.php
Expand Up @@ -144,5 +144,20 @@
$settings->add(new admin_setting_configduration('analytics/modeltimelimit', new lang_string('modeltimelimit', 'analytics'),
new lang_string('modeltimelimitinfo', 'analytics'), 20 * MINSECS));

$options = array(
0 => new lang_string('neverdelete', 'analytics'),
1000 => new lang_string('numdays', '', 1000),
365 => new lang_string('numdays', '', 365),
180 => new lang_string('numdays', '', 180),
150 => new lang_string('numdays', '', 150),
120 => new lang_string('numdays', '', 120),
90 => new lang_string('numdays', '', 90),
60 => new lang_string('numdays', '', 60),
35 => new lang_string('numdays', '', 35));
$settings->add(new admin_setting_configselect('analytics/calclifetime',
new lang_string('calclifetime', 'analytics'),
new lang_string('configlcalclifetime', 'analytics'), 35, $options));


}
}
7 changes: 7 additions & 0 deletions analytics/classes/manager.php
Expand Up @@ -694,6 +694,13 @@ public static function cleanup() {
$param + $idsparams);
}
}

// Clean up calculations table.
$calclifetime = get_config('analytics', 'calclifetime');
if (!empty($calclifetime)) {
$lifetime = time() - ($calclifetime * DAYSECS); // Value in days.
$DB->delete_records_select('analytics_indicator_calc', 'timecreated < ?', [$lifetime]);
}
}

/**
Expand Down
3 changes: 3 additions & 0 deletions lang/en/analytics.php
Expand Up @@ -31,6 +31,8 @@
$string['analyticslogstore_help'] = 'The log store that will be used by the analytics API to read users\' activity.';
$string['analyticssettings'] = 'Analytics settings';
$string['analyticssiteinfo'] = 'Site information';
$string['calclifetime'] = 'Keep analytics calculations for';
$string['configlcalclifetime'] = 'This specifies the length of time you want to keep calculation data - this will not delete predictions, but deletes the data used to generate the predictions. Using the default option here is best as it keeps your disk usage under control, however if you are using calculation tables for other purposes you may want to increase this value.';
$string['defaulttimesplittingmethods'] = 'Default analysis intervals for model\'s evaluation';
$string['defaulttimesplittingmethods_help'] = 'The analysis interval defines when the system will calculate predictions and the portion of activity logs that will be considered for those predictions. The model evaluation process will iterate through these analysis intervals unless a specific analysis interval is specified.';
$string['defaultpredictionsprocessor'] = 'Default predictions processor';
Expand Down Expand Up @@ -97,6 +99,7 @@
$string['modeltimelimit'] = 'Analysis time limit per model';
$string['modeltimelimitinfo'] = 'This setting limits the time each model spends analysing the site contents.';
$string['neutral'] = 'Neutral';
$string['neverdelete'] = 'Never delete calculations';
$string['noevaluationbasedassumptions'] = 'Models based on assumptions cannot be evaluated.';
$string['nodata'] = 'No data to analyse';
$string['noinsightsmodel'] = 'This model does not generate insights';
Expand Down

0 comments on commit bc58174

Please sign in to comment.