From c428e07c4b219e400618f0647d6098b3e4aaca45 Mon Sep 17 00:00:00 2001 From: Romain Quetiez Date: Mon, 29 Nov 2010 10:19:33 +0000 Subject: [PATCH] XML data loader to request for credentials SVN:trunk[986] --- setup/xmldataloader.class.inc.php | 7 +++++-- webservices/backoffice.dataloader.php | 23 ++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/setup/xmldataloader.class.inc.php b/setup/xmldataloader.class.inc.php index bf323158d..b81dff815 100644 --- a/setup/xmldataloader.class.inc.php +++ b/setup/xmldataloader.class.inc.php @@ -46,13 +46,16 @@ class XMLDataLoader protected $m_aWarnings; protected $m_iCountCreated; - public function __construct($sConfigFileName) + public function __construct($sConfigFileName = null) { $this->m_aKeys = array(); $this->m_aObjectsCache = array(); $this->m_oChange = null; $this->m_sCacheFileName = KEYS_CACHE_FILE; - $this->InitDataModel($sConfigFileName); + if ($sConfigFileName != null) + { + $this->InitDataModel($sConfigFileName); + } $this->LoadKeysCache(); $this->m_bSessionActive = true; $this->m_aErrors = array(); diff --git a/webservices/backoffice.dataloader.php b/webservices/backoffice.dataloader.php index 5b955a0eb..ebe74bd58 100644 --- a/webservices/backoffice.dataloader.php +++ b/webservices/backoffice.dataloader.php @@ -29,11 +29,18 @@ * 'file' string Name of the file to load */ define('SAFE_MINIMUM_MEMORY', 256*1024*1024); + require_once('../approot.inc.php'); -require_once(APPROOT.'/application/utils.inc.php'); -require_once(APPROOT."/application/nicewebpage.class.inc.php"); +require_once(APPROOT.'/application/application.inc.php'); + +require_once(APPROOT.'/application/startup.inc.php'); + +require_once(APPROOT.'/application/loginwebpage.class.inc.php'); +LoginWebPage::DoLogin(true); // Check user rights and prompt if needed (must be admin) + // required because the class xmldataloader is reporting errors in the setup.log file require_once(APPROOT.'/setup/setuppage.class.inc.php'); +require_once(APPROOT.'/setup/xmldataloader.class.inc.php'); function SetMemoryLimit($oP) @@ -72,20 +79,10 @@ function SetMemoryLimit($oP) // //////////////////////////////////////////////////////////////////////////////// -require_once(APPROOT.'/core/config.class.inc.php'); -require_once(APPROOT.'/core/log.class.inc.php'); -require_once(APPROOT.'/core/kpi.class.inc.php'); -require_once(APPROOT.'/core/cmdbsource.class.inc.php'); -require_once(APPROOT.'/setup/xmldataloader.class.inc.php'); - -define('FINAL_CONFIG_FILE', APPROOT.'/config-itop.php'); - // Never cache this page header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Fri, 17 Jul 1970 05:00:00 GMT"); // Date in the past -Utils::SpecifyConfigFile(FINAL_CONFIG_FILE); - /** * Main program */ @@ -97,7 +94,7 @@ $oP = new WebPage("iTop - Backoffice data loader"); try { // Note: the data model must be loaded first - $oDataLoader = new XMLDataLoader(FINAL_CONFIG_FILE); // When called by the wizard, the final config is not yet there + $oDataLoader = new XMLDataLoader(); if (empty($sFileName)) {