Add caching to site incident retrieval. Add site status function.

This commit is contained in:
2011-12-17 12:41:23 +00:00
parent 3f7f84d47c
commit 42ca2a1a5c

View File

@@ -7,6 +7,9 @@ class StatusBoard_Site {
protected $name; protected $name;
protected $description; protected $description;
protected $incidents;
protected $incidents_open;
protected function __construct($id, $service, $name, $description) { protected function __construct($id, $service, $name, $description) {
$this->id = $id; $this->id = $id;
$this->service = $service; $this->service = $service;
@@ -94,8 +97,16 @@ class StatusBoard_Site {
$this->id = null; $this->id = null;
} }
public function incidents_open() { public function openIncidents() {
return StatusBoard_Incident::open_for_site($this); if ($this->incidents_open === null || $ignore_cache) {
$this->incidents_open = StatusBoard_Incident::open_for_site($this);
}
return $this->incidents_open;
}
public function status() {
return StatusBoard_Incident::highestSeverityStatus($this->openIncidents());
} }
public function id() { public function id() {