Module: nagvis Branch: master Commit: 381c1263147df7334e1462ccb5bd1747cc025884 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=381c1263147df7334e1462ccb5bd1747cc025884
Author: Lars Michelsen <[email protected]> Date: Wed Jun 9 22:24:39 2010 +0200 Fixed old backend call in automap, removed old backend initialized check and removed old error message --- share/frontend/wui/ajax_handler.php | 2 -- share/server/core/classes/CoreBackendMgmt.php | 12 ++++-------- share/server/core/classes/NagVisAutoMap.php | 14 ++++++-------- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/share/frontend/wui/ajax_handler.php b/share/frontend/wui/ajax_handler.php index f610a3e..858f9c9 100644 --- a/share/frontend/wui/ajax_handler.php +++ b/share/frontend/wui/ajax_handler.php @@ -106,8 +106,6 @@ switch($_GET['action']) { new GlobalMessage('ERROR', $CORE->getLang()->getText('mustValueNotSet', 'ATTRIBUTE~ackend_id')); } elseif(!isset($_GET['host_name']) || $_GET['host_name'] == '') { new GlobalMessage('ERROR', $CORE->getLang()->getText('mustValueNotSet', 'ATTRIBUTE~host_name')); - } elseif(!$BACKEND->checkBackendInitialized($_GET['backend_id'], FALSE)) { - new GlobalMessage('ERROR', $CORE->getLang()->getText('backendNotInitialized', 'BACKENDID~'.$_GET['backend_id'])); } elseif(!method_exists($BACKEND->BACKENDS[$_GET['backend_id']],'getObjects')) { new GlobalMessage('ERROR', $CORE->getLang()->getText('methodNotSupportedByBackend', 'METHOD~getObjects')); } else { diff --git a/share/server/core/classes/CoreBackendMgmt.php b/share/server/core/classes/CoreBackendMgmt.php index 02a6cfe..84c5220 100644 --- a/share/server/core/classes/CoreBackendMgmt.php +++ b/share/server/core/classes/CoreBackendMgmt.php @@ -410,20 +410,16 @@ class CoreBackendMgmt { * @param Boolean $printErr * @return Boolean Is Successful? * @author Lars Michelsen <[email protected]> + * @deprecated Please don't use this function anymore */ public function checkBackendInitialized($backendId, $printErr) { if(isset($this->aInitialized[$backendId])) { return true; } else { - // Try to initialize backend - if($this->initializeBackend($backendId)) { - return true; - } else { - if($printErr == 1) { - new GlobalMessage('ERROR', $this->CORE->getLang()->getText('backendNotInitialized','BACKENDID~'.$backendId.',BACKENDTYPE~'.$this->CORE->getMainCfg()->getValue('backend_'.$backendId,'backendtype'))); - } - return false; + if($printErr == 1) { + new GlobalMessage('ERROR', $this->CORE->getLang()->getText('backendNotInitialized','BACKENDID~'.$backendId.',BACKENDTYPE~'.$this->CORE->getMainCfg()->getValue('backend_'.$backendId,'backendtype'))); } + return false; } } diff --git a/share/server/core/classes/NagVisAutoMap.php b/share/server/core/classes/NagVisAutoMap.php index 6c365a8..3f3b1b9 100644 --- a/share/server/core/classes/NagVisAutoMap.php +++ b/share/server/core/classes/NagVisAutoMap.php @@ -764,14 +764,12 @@ class NagVisAutoMap extends GlobalMap { */ $defaultRoot = $this->CORE->getMainCfg()->getValue('automap','defaultroot', TRUE); if(!isset($defaultRoot) || $defaultRoot == '') { - if($this->BACKEND->checkBackendInitialized($this->backend_id, TRUE)) { - try { - $hostsWithoutParent = $this->BACKEND->BACKENDS[$this->backend_id]->getHostNamesWithNoParent(); - } catch(BackendConnectionProblem $e) {} - if(count($hostsWithoutParent) == 1) { - $defaultRoot = $hostsWithoutParent[0]; - } - } + try { + $hostsWithoutParent = $this->BACKEND->getBackend($this->backend_id)->getHostNamesWithNoParent(); + } catch(BackendConnectionProblem $e) {} + + if(isset($hostsWithoutParent) && count($hostsWithoutParent) == 1) + $defaultRoot = $hostsWithoutParent[0]; } if(!isset($defaultRoot) || $defaultRoot == '') { ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
