LoadModule($remoteRepository, true); $moduleManager->InstallModule(); // ------------------------------------------------------------------------------- function LoadFile($sourceFile, $destinationFile) { $sourceFile = str_replace('\\','/',$sourceFile); if (strpos($sourceFile, 'https')===0) { echo 'Load File '.$sourceFile."\n"; $curl_handle=curl_init(); curl_setopt($curl_handle, CURLOPT_URL,$sourceFile); curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT,10); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER,true); curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl_handle, CURLOPT_FAILONERROR, true); $fileContent = curl_exec($curl_handle); if ($fileContent===false) { throw new Exception('Download of File '.$sourceFile.' failed !!!'); } //echo 'Loaded '.str_replace(chr(13),'',str_replace(chr(10),'',substr($fileContent,1,200))).'...'.PHP_EOL; curl_close($curl_handle); //$fileContent = html_entity_decode($fileContent, ENT_COMPAT, 'UTF-8'); } else { $fileContent = file_get_contents($sourceFile); } $destinationFile = str_replace('\\','/',$destinationFile); $destinationFilePath = pathinfo($destinationFile, PATHINFO_DIRNAME); if (!file_exists($destinationFilePath)) { if (!mkdir($destinationFilePath, 0755, true)) { throw new Exception('Create Directory '.$destinationFilePath.' failed!'); } } $destinationFile = str_replace('/InitializationFiles/Default/','/InitializationFiles/',$destinationFile); if (!file_put_contents($destinationFile, $fileContent)) { sleep(1); echo 'Create File '.$destinationFile.' failed --> Retry ...'; if (!file_put_contents($destinationFile, $fileContent)) { throw new Exception('Create File '.$destinationFile.' failed!'); } } } // ------------------------------------------------------------------------------------------------ function Register_IPSUtils() { $file = IPS_GetKernelDir().'scripts/__autoload.php'; if (!file_exists($file)) { echo 'Create File __autoload.php'; file_put_contents($file, ''); } $FileContent = file_get_contents($file); $pos = strpos($FileContent, 'IPSUtils.inc.php'); if ($pos === false) { echo 'Register IPSUtils.inc.php in File __autoload.php'; $includeCommand = ' include_once IPS_GetKernelDir()."scripts/IPSLibrary/app/core/IPSUtils/IPSUtils.inc.php";'; $FileContent = str_replace('?>', $includeCommand.PHP_EOL.'?>', $FileContent); file_put_contents($file, $FileContent); } } ?>