From 436a4d296541e50e073bcfe4934217c3454b10ba Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Thu, 28 Aug 2014 11:42:22 +0200 Subject: [PATCH] ResourceConfig: Chance createResouce to create Not useful everywhere. Changed on the best suitable places. refs #5514 --- application/controllers/ListController.php | 3 +-- application/forms/Config/Authentication/DbBackendForm.php | 3 +-- application/forms/Config/Authentication/LdapBackendForm.php | 2 +- modules/monitoring/library/Monitoring/Backend.php | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/application/controllers/ListController.php b/application/controllers/ListController.php index b790418f7..dac0cc68b 100644 --- a/application/controllers/ListController.php +++ b/application/controllers/ListController.php @@ -45,8 +45,7 @@ class ListController extends Controller file_exists($config_ini['logging']['target']) ) ) { - $config = ResourceFactory::getResourceConfig('logfile'); - $resource = ResourceFactory::createResource($config); + $resource = ResourceFactory::create('logfile'); $this->view->logData = $resource->select()->order('DESC')->paginate(); } else { $this->view->logData = null; diff --git a/application/forms/Config/Authentication/DbBackendForm.php b/application/forms/Config/Authentication/DbBackendForm.php index 82594280b..7184debdb 100644 --- a/application/forms/Config/Authentication/DbBackendForm.php +++ b/application/forms/Config/Authentication/DbBackendForm.php @@ -111,10 +111,9 @@ class DbBackendForm extends BaseBackendForm public function isValidAuthenticationBackend() { try { - $testConnection = ResourceFactory::createResource(ResourceFactory::getResourceConfig( + $dbUserBackend = new DbUserBackend(ResourceFactory::create( $this->getValue('backend_' . $this->filterName($this->getBackendName()) . '_resource') )); - $dbUserBackend = new DbUserBackend($testConnection); if ($dbUserBackend->count() < 1) { $this->addErrorMessage(t("No users found under the specified database backend")); return false; diff --git a/application/forms/Config/Authentication/LdapBackendForm.php b/application/forms/Config/Authentication/LdapBackendForm.php index cf0afd631..111824b9f 100644 --- a/application/forms/Config/Authentication/LdapBackendForm.php +++ b/application/forms/Config/Authentication/LdapBackendForm.php @@ -149,7 +149,7 @@ class LdapBackendForm extends BaseBackendForm $cfg = $this->getConfig(); $backendName = 'backend_' . $this->filterName($this->getBackendName()) . '_name'; $backendConfig = new Zend_Config($cfg[$this->getValue($backendName)]); - $backend = ResourceFactory::createResource(ResourceFactory::getResourceConfig($backendConfig->resource)); + $backend = ResourceFactory::create($backendConfig->resource); $testConn = new LdapUserBackend( $backend, $backendConfig->user_class, diff --git a/modules/monitoring/library/Monitoring/Backend.php b/modules/monitoring/library/Monitoring/Backend.php index e10c70d4e..34be4aff5 100644 --- a/modules/monitoring/library/Monitoring/Backend.php +++ b/modules/monitoring/library/Monitoring/Backend.php @@ -97,7 +97,7 @@ class Backend implements Selectable, Queryable, ConnectionInterface ); } } - $resource = ResourceFactory::createResource(ResourceFactory::getResourceConfig($backendConfig->resource)); + $resource = ResourceFactory::create($backendConfig->resource); if ($backendConfig->type === 'ido' && $resource->getDbType() !== 'oracle') { // TODO(el): The resource should set the table prefix $resource->setTablePrefix('icinga_');