diff --git a/application/controllers/ShowController.php b/application/controllers/ShowController.php index 14a9d329..3cb667ed 100644 --- a/application/controllers/ShowController.php +++ b/application/controllers/ShowController.php @@ -9,8 +9,11 @@ class Director_ShowController extends ActionController public function activitylogAction() { if ($id = $this->params->get('id')) { - $this->view->entry = $this->db()->fetchActivityLogEntry($id); - $this->view->title = $this->translate('Activity'); + $this->view->entry = $this->db()->fetchActivityLogEntryById($id); + } elseif ($checksum = $this->params->get('checksum')) { + $this->view->entry = $this->db()->fetchActivityLogEntry(pack('H*', $checksum)); } + + $this->view->title = $this->translate('Activity'); } } diff --git a/library/Director/Db.php b/library/Director/Db.php index 6875b6f1..24fa9e55 100644 --- a/library/Director/Db.php +++ b/library/Director/Db.php @@ -17,13 +17,20 @@ class Db extends DbConnection return $this->getDbAdapter(); } - public function fetchActivityLogEntry($id) + public function fetchActivityLogEntryById($id) { $sql = 'SELECT * FROM director_activity_log WHERE id = ' . (int) $id; return $this->db()->fetchRow($sql); } + public function fetchActivityLogEntry($checksum) + { + $sql = 'SELECT * FROM director_activity_log WHERE checksum = ?'; + + return $this->db()->fetchRow($sql, $checksum); + } + public function getLastActivityChecksum() { $select = "SELECT checksum FROM (SELECT * FROM (SELECT 1 AS pos, LOWER(HEX(checksum)) AS checksum FROM director_activity_log ORDER BY change_time DESC LIMIT 1) a UNION SELECT 2 AS pos, '' AS checksum) u ORDER BY pos LIMIT 1"; diff --git a/library/Director/IcingaConfig/IcingaConfig.php b/library/Director/IcingaConfig/IcingaConfig.php index 9dc454e5..323aaee7 100644 --- a/library/Director/IcingaConfig/IcingaConfig.php +++ b/library/Director/IcingaConfig/IcingaConfig.php @@ -202,7 +202,7 @@ class IcingaConfig )->where('checksum = ?', $checksum); $result = $this->db->fetchRow($query); $this->checksum = $result->checksum; - $this->last_activity_checksum = $result->last_activity_checksum; + $this->lastActivityChecksum = $result->last_activity_checksum; $query = $this->db->select()->from( array('cf' => 'director_generated_config_file'), array(