Skip to content
Permalink
Browse files

MDL-64454 Admin: Configuration option for cron frequency warning

This change makes the warning time (default 200 seconds) configurable
in config.php.
  • Loading branch information...
sammarshallou committed Jan 8, 2019
1 parent b18034e commit ff13ae5906ddcdd3b016f4edbf8590b8fd157af2
Showing with 13 additions and 3 deletions.
  1. +2 −1 admin/index.php
  2. +4 −1 admin/renderer.php
  3. +6 −0 config-dist.php
  4. +1 −1 lang/en/admin.php
@@ -826,7 +826,8 @@
$lastcron = get_config('tool_task', 'lastcronstart');
$cronoverdue = ($lastcron < time() - 3600 * 24);
$lastcroninterval = get_config('tool_task', 'lastcroninterval');
$croninfrequent = !$cronoverdue && ($lastcroninterval > 200 || $lastcron < time() - 200);
$expectedfrequency = $CFG->expectedcronfrequency ?? 200;
$croninfrequent = !$cronoverdue && ($lastcroninterval > $expectedfrequency || $lastcron < time() - $expectedfrequency);
$dbproblems = $DB->diagnose();
$maintenancemode = !empty($CFG->maintenance_enabled);
@@ -623,11 +623,14 @@ public function cron_overdue_warning($cronoverdue) {
* @return string HTML to output.
*/
public function cron_infrequent_warning(bool $croninfrequent) : string {
global $CFG;
if (!$croninfrequent) {
return '';
}
return $this->warning(get_string('croninfrequent', 'admin') . '&nbsp;' .
$expectedfrequency = $CFG->expectedcronfrequency ?? 200;
return $this->warning(get_string('croninfrequent', 'admin', $expectedfrequency) . '&nbsp;' .
$this->help_icon('cron', 'admin'));
}
@@ -599,6 +599,12 @@
//
// $CFG->disablelogintoken = true;
//
// Moodle 3.7+ checks that cron is running frequently. If the time between cron runs
// is greater than this value (in seconds), you get a warning on the admin page. (This
// setting only controls whether or not the warning appears, it has no other effect.)
//
// $CFG->expectedcronfrequency = 200;
//
//=========================================================================
// 7. SETTINGS FOR DEVELOPMENT SERVERS - not intended for production use!!!
//=========================================================================
@@ -416,10 +416,10 @@
$string['cronclionly'] = 'Cron execution via command line only';
$string['cronerrorclionly'] = 'Sorry, internet access to this page has been disabled by the administrator.';
$string['cronerrorpassword'] = 'Sorry, you have not provided a valid password to access this page';
$string['croninfrequent'] = 'The time between the last two runs of the cron maintenance script was over {$a} seconds. We recommend configuring it to run more frequently.';
$string['cronremotepassword'] = 'Cron password for remote access';
$string['cronwarning'] = 'The <a href="{$a}">cron.php maintenance script</a> has not been run for at least 24 hours.';
$string['cronwarningcli'] = 'The cli/cron.php maintenance script has not been run for at least 24 hours.';
$string['croninfrequent'] = 'The time between the last two runs of the cron maintenance script was over 3 minutes. We recommend configuring it to run more frequently.';
$string['ctyperequired'] = 'The ctype PHP extension is now required by Moodle, in order to improve site performance and to offer multilingual compatibility.';
$string['curlsecurityallowedport'] = 'cURL allowed ports list';
$string['curlsecurityallowedportsyntax'] = 'List of port numbers that cURL can connect to. Valid entries are integer numbers only. Put each entry on a new line. If left empty, then all ports are allowed. If set, in almost all cases, both 443 and 80 should be specified for cURL to connect to standard HTTPS and HTTP ports.';

0 comments on commit ff13ae5

Please sign in to comment.
You can’t perform that action at this time.