Permalink
Browse files

add ability to "clear" a check, or pass ALL to clear all.

  • Loading branch information...
1 parent ce4519a commit e3e4f6357814ad7ae1478e373e2023bea1bd49aa Alan Pinstein committed Oct 6, 2011
Showing with 23 additions and 0 deletions.
  1. +23 −0 modules/heartbeat/heartbeat.php
@@ -83,3 +83,26 @@ public function noAction($page, $params)
$page->assign('allAlive', $allAlive);
}
}
+
+class module_heartbeat_clear
+{
+ public function parameterList()
+ {
+ return array('checkId');
+ }
+ public function noAction($page, $params)
+ {
+ if (!$params['checkId']) throw new WFRequestController_NotFoundException("Not a known checkId");
+
+ $checks = $page->module()->loadChecks();
+ if ($params['checkId'] === 'ALL')
+ {
+ $checks = array();
+ }
+ else if (isset($checks[$params['checkId']]))
+ {
+ unset($checks[$params['checkId']]);
+ }
+ $page->module()->saveChecks($checks);
+ }
+}

0 comments on commit e3e4f63

Please sign in to comment.