$iStatLog = ReadMandatoryParam($oP, 'log'); $iChange = ReadMandatoryParam($oP, 'change'); $sLastFullLoad = ReadMandatoryParam($oP, 'last_full_load', 'raw_data'); $iChunkSize = ReadMandatoryParam($oP, 'chunk'); $oP->p('Last full load: ' . $sLastFullLoad); $oP->p('Chunk size: ' . $iChunkSize); $oP->p('Source: ' . $iSource); try { $oSynchroDataSource = MetaModel::GetObject('SynchroDataSource', $iSource); $oLog = MetaModel::GetObject('SynchroLog', $iStatLog); $oChange = MetaModel::GetObject('CMDBChange', $iChange); if (strlen($sLastFullLoad) > 0) { $oLastFullLoad = new DateTime($sLastFullLoad); $oSynchroExec = new SynchroExecution($oSynchroDataSource, $oLastFullLoad); } else { $oSynchroExec = new SynchroExecution($oSynchroDataSource); } if ($oSynchroExec->DoSynchronizeChunk($oLog, $oChange, $iChunkSize)) { // The last line MUST follow this convention $oP->p("continue"); } else { // The last line MUST follow this convention $oP->p("finished"); } $oP->output(); } catch (Exception $e) { $oP->p("Error: " . $e->GetMessage()); $oP->add($e->getTraceAsString()); $oP->output(); exit(28); }