IcingaConfig: fix activity links

This commit is contained in:
Thomas Gelf 2015-06-18 11:01:45 +02:00
parent 48d876556c
commit 32cca9d2c6
3 changed files with 14 additions and 4 deletions

View File

@ -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');
}
}

View File

@ -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";

View File

@ -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(