Skip to content

Commit

Permalink
Add default mute duration setting
Browse files Browse the repository at this point in the history
  • Loading branch information
bwalkerl committed Feb 26, 2024
1 parent 50b01d5 commit 587b23e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion classes/object/override.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ class override extends Persistent {
*/

public function __construct(int $id = 0, \stdClass $record = null) {
$this->set('expires_at', strtotime('+1 month', time()));
$expiredate = date('Y-m-d', time() + (int) get_config('tool_heartbeat', 'mutedefault'));
$this->set('expires_at', strtotime($expiredate));
parent::__construct($id, $record);
}

Expand Down
5 changes: 2 additions & 3 deletions lang/en/tool_heartbeat.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@
$string['formoverridefieldoverriderequired'] = 'Please select an status to use while muted';
$string['formoverridefieldnoterequired'] = 'Please add some notes';
$string['formoverridefieldmuteuntilrequired'] = 'Please select a date';
$string['overridestatusmuted'] = 'MUTED';
$string['overridestatusresolved'] = 'RESOLVED';
$string['overridestatusoverdue'] = 'OVERDUE';
$string['mutedefault'] = 'Default mute duration';
$string['mutedefaultdesc'] = 'Adjust the default duration of a check mute.';

$string['settings:cachecheckheading'] = 'Cache consistency check';
$string['settings:shouldlogcacheping:heading'] = 'Log cache ping';
Expand Down
4 changes: 4 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@
get_string('errorascritical', 'tool_heartbeat'),
get_string('errorascritical_desc', 'tool_heartbeat', $time->format('e P')), 'warning', $opts));

$settings->add(new admin_setting_configduration('tool_heartbeat/mutedefault',
get_string('mutedefault', 'tool_heartbeat'),
get_string('mutedefaultdesc', 'tool_heartbeat'), 12 * WEEKSECS, WEEKSECS));

$example = '\logstore_standard\task\cleanup_task, 5, 5, 5';
$settings->add(new admin_setting_configtextarea('tool_heartbeat/tasklatencymonitoring',
get_string('tasklatencymonitoring', 'tool_heartbeat'),
Expand Down

0 comments on commit 587b23e

Please sign in to comment.