From 942363c65d7dbf57d8234cbee609bff480cc1669 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 15 Dec 2015 16:46:19 +0100 Subject: [PATCH] IcingaConfig: rename fromDb to load --- application/controllers/ConfigController.php | 5 +++-- library/Director/IcingaConfig/IcingaConfig.php | 10 +++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/application/controllers/ConfigController.php b/application/controllers/ConfigController.php index a86b0bbd..cd706de5 100644 --- a/application/controllers/ConfigController.php +++ b/application/controllers/ConfigController.php @@ -13,7 +13,7 @@ class ConfigController extends ActionController public function deployAction() { $checksum = $this->params->get('checksum'); - $config = IcingaConfig::fromDb(Util::hex2binary($checksum), $this->db()); + $config = IcingaConfig::load(Util::hex2binary($checksum), $this->db()); if ($this->api()->dumpConfig($config, $this->db())) { $url = Url::fromPath('director/list/deploymentlog'); Notification::success( @@ -48,9 +48,10 @@ class ConfigController extends ActionController 'url' => $this->getRequest()->getUrl(), ))->activate('config'); - $this->view->config = IcingaConfig::fromDb(Util::hex2binary($this->params->get('checksum')), $this->db()); + $this->view->config = IcingaConfig::load(Util::hex2binary($this->params->get('checksum')), $this->db()); } + // TODO: Check if this can be removed public function storeAction() { $config = IcingaConfig::generate($this->db()); diff --git a/library/Director/IcingaConfig/IcingaConfig.php b/library/Director/IcingaConfig/IcingaConfig.php index fedc2c45..23f2140e 100644 --- a/library/Director/IcingaConfig/IcingaConfig.php +++ b/library/Director/IcingaConfig/IcingaConfig.php @@ -2,8 +2,8 @@ namespace Icinga\Module\Director\IcingaConfig; -use Icinga\Data\Db\DbConnection; use Icinga\Exception\ProgrammingError; +use Icinga\Module\Director\Db; use Icinga\Module\Director\Util; use Icinga\Module\Director\Objects\IcingaCommand; use Icinga\Module\Director\Objects\IcingaHost; @@ -32,7 +32,7 @@ class IcingaConfig public static $table = 'director_generated_config'; - protected function __construct(DbConnection $connection) + protected function __construct(Db $connection) { $this->connection = $connection; $this->db = $connection->getDbAdapter(); @@ -77,20 +77,20 @@ class IcingaConfig return $files; } - public static function fromDb($checksum, DbConnection $connection) + public static function load($checksum, Db $connection) { $config = new static($connection); $config->loadFromDb($checksum); return $config; } - public static function generate(DbConnection $connection) + public static function generate(Db $connection) { $config = new static($connection); return $config->storeIfModified(); } - public static function wouldChange(DbConnection $connection) + public static function wouldChange(Db $connection) { $config = new static($connection); return $config->hasBeenModified();