} if (file_exists(dirname(__FILE__) . '/utils/xml.class.php')) { include_once "utils/xml.class.php"; } if (file_exists(dirname(__FILE__) . '/utils/scheduler.class.php')) { include_once "utils/scheduler.class.php"; } if (file_exists(dirname(__FILE__) . '/utils/forceRequest.class.php')) { include_once "utils/forceRequest.class.php"; } /* Init log default type */ Log::setDefaultType($CONF_default_log); /* Init of scheduler */ Scheduler::initTimer($CONF_WsGetReqList, $CONF_WsPostReqList, $CONF_CachetimeLbl, $CONF_LastrequestLbl); /* Init of forceRequest (used to test only one request) */ ForceRequest::initForceRequest(Scheduler::getWsNameGetList(), Scheduler::getWsNamePostList()); if (ForceRequest::isForcedRequest() && isset($_GET['log'])) { Log::setDefaultType($_GET['log']); } /* * Execute POST requests */ Log::write("###### DO POST REQUESTS ######", "info"); $listPOST = ''; for ($i = 0; $i < sizeof($CONF_WsPostReqList); $i++) { $listPOST .= $i == 0 ? $CONF_WsPostReqList[$i] : ' - ' . $CONF_WsPostReqList[$i]; } Log::write("Webservices to call : " . $listPOST, "info"); include "postSynchCtrl.php"; Log::write("###### END POST REQUESTS / TREATMENTS ######<br /><br />", "info"); /*
$dao = new Dao(); $postOSIReq = new PostActionRequests(GlobalConfig::getWsUrl(), GlobalConfig::getWsPort(), 20, GlobalConfig::getWsLogin(), GlobalConfig::getWsPasswd(), GlobalConfig::getServiceCode(), GlobalConfig::getWebSiteCode()); /* WebService infos values */ $wSOInfosList = Scheduler::getWsInfosList(); /* POST requests */ if (ForceRequest::isForcedRequest()) { /* Send only one POST request */ $wsName = ForceRequest::getWsName(); $dateFrom = ForceRequest::getDateFrom() . " " . ForceRequest::getTimeFrom(); $dateFrom = date::dateTimeFr2DateTimeBdd($dateFrom); $dateTo = ForceRequest::getDateTo() . " " . ForceRequest::getTimeTo(); $dateTo = date::dateTimeFr2DateTimeBdd($dateTo); doPostSynch($wsName, $dateFrom, $dateTo); } else { /* Send all POST requests in function of the scheduler permissions */ $wSOList = Scheduler::getWsNamePostList(); foreach ($wSOList as $wsName) { $dateFrom = $wSOInfosList[$CONF_LastrequestLbl . $wsName]; $dateFrom = DATE::timestamp2DateTimeBdd($dateFrom); $dateTo = Scheduler::getTimeOnInit(); $dateTo = DATE::timestamp2DateTimeBdd($dateTo); doPostSynch($wsName, $dateFrom, $dateTo); } } /* POST synchronisations */ function doPostSynch($wsName, $dateFrom, $dateTo) { global $dao, $postOSIReq, $CONF_LastrequestLbl, $isOkResponses, $nbChildrenProducts, $nbResponse200, $nbResponseError, $nbResponse409, $nbNoReference; /* Check if allow to get this request */ $isAllow = Scheduler::isAllowedToRequest($wsName); if (!ForceRequest::isForcedRequest() && !$isAllow) {