Replace `MonitoringBackend::createBackend()` with `MonitoringBackend::instance()`

This commit is contained in:
Sukhwinder Dhillon 2022-05-02 15:55:30 +02:00 committed by Johannes Meyer
parent 49bea36345
commit 60756afa34
4 changed files with 5 additions and 6 deletions

View File

@ -25,8 +25,7 @@ class ListCommand extends Command
public function init()
{
$this->app->setupZendAutoloader();
$this->backend = Backend::createBackend($this->params->shift('backend'));
$this->backend = Backend::instance($this->params->shift('backend'));
$this->dumpSql = $this->params->shift('showsql');
}

View File

@ -215,7 +215,7 @@ class ConfigController extends Controller
$form->setTitle(sprintf($this->translate('Edit Command Transport %s'), $transportName));
$form->setIniConfig($this->Config('commandtransports'));
$form->setInstanceNames(
Backend::createBackend()->select()->from('instance', array('instance_name'))->fetchColumn()
Backend::instance()->select()->from('instance', array('instance_name'))->fetchColumn()
);
$form->setOnSuccess(function (TransportConfigForm $form) use ($transportName) {
try {
@ -259,7 +259,7 @@ class ConfigController extends Controller
$form->setTitle($this->translate('Create New Command Transport'));
$form->setIniConfig($this->Config('commandtransports'));
$form->setInstanceNames(
Backend::createBackend()->select()->from('instance', array('instance_name'))->fetchColumn()
Backend::instance()->select()->from('instance', array('instance_name'))->fetchColumn()
);
$form->setOnSuccess(function (TransportConfigForm $form) {
try {

View File

@ -28,7 +28,7 @@ class Controller extends IcingaWebController
protected function moduleInit()
{
$this->backend = Backend::createBackend($this->_getParam('backend'));
$this->backend = Backend::instance($this->_getParam('backend'));
$this->view->url = Url::fromRequest();
}

View File

@ -53,7 +53,7 @@ class Bug7043Test extends BaseTestCase
)
)));
$defaultBackend = Backend::createBackend();
$defaultBackend = Backend::instance();
$this->assertEquals('backendName', $defaultBackend->getName(), 'Default backend has name set');
}