function Migrate_Structure($module, $oldPath, $newPath, $filePath) { $oldCategoryId = @get_ObjectIDByPath($oldPath, true); if ($oldCategoryId==null) { echo "$oldPath not found ...\n"; return; } // Download new Module Scripts $moduleManager = new IPSModuleManager($module); //$moduleManager->DeployModule(); $moduleManager->LoadModule(); // Migrate existing Structure CreateCategoryPath($newPath); $newCategoryPath = str_replace('.app.', '.data.', $newPath); $newCategoryId = CreateCategoryPath($newCategoryPath); foreach (IPS_GetChildrenIDs($oldCategoryId) as $idx=>$childId) { $object = IPS_GetObject($childId); switch($object['ObjectType']) { case 0: // Category case 1: // Instance echo "Migrate Category=$childId, Name=".IPS_GetName($childId)."\n"; Migrate_Category($childId, $filePath); IPS_SetParent($childId, $newCategoryId); break; case 2: // Variable echo "Migrate Variable=$childId, Name=".IPS_GetName($childId)."\n"; IPS_SetParent($childId, $newCategoryId); break; case 3: // Script Delete_Script($childId, $filePath); break; default: echo "Unknown Object=$childId, Name=".IPS_GetName($childId)."\n"; } echo "Move $childId from $oldCategoryId to $newCategoryId ($newCategoryPath)\n"; } if (!IPS_DeleteCategory($oldCategoryId)) { echo "Error deleting old Category ".IPS_GetName($oldCategoryId)."\n"; exit; } echo '-------------------------------------------------------------------------------------------------------------'.PHP_EOL; echo '---- Bestehende Variablen von Modul '.$module.' wurden in die neue Strukture migriert'.PHP_EOL; echo '----'.PHP_EOL; echo '---- Anpassung der Konfiguration und erneute Installation muss manuell gemacht werden !!!'.PHP_EOL; echo '---- ACHTUNG: Pfad für WebFront und Mobile Installation haben sich geändert (liegt jetzt unter "Visualization.WebFront"'.PHP_EOL; echo '---- bzw. "Visualization.Mobile". Pfad im Init File (/IPSLibrary/install/InitializationFiles/<<Module>>.ini'.PHP_EOL; echo '---- anpassen oder Links manuell verschieben.'.PHP_EOL; echo '---- Im Zweifel einfach die bestehenden Strukture des jeweiligen Modules löschen, und eine erneute Installation'.PHP_EOL; echo '---- Installation ausführen.'.PHP_EOL; echo '-------------------------------------------------------------------------------------------------------------'.PHP_EOL; }
$moduleManager = new IPSModuleManager($module, $repository); $moduleManager->UpdateModule(); } break; case 'Install': if (IPSModuleManagerGUI_GetLock($action, true)) { IPSLogger_Inf(__file__, 'IPSModuleManagerGUI - Installation of Module '.$module); $moduleManager = new IPSModuleManager($module); $moduleManager->InstallModule(); } break; case 'Load': if (IPSModuleManagerGUI_GetLock($action, true)) { IPSLogger_Inf(__file__, 'IPSModuleManagerGUI - Load Files of Module '.$module.' from Repository "'.$repository.'"'); $moduleManager = new IPSModuleManager($module, $repository); $moduleManager->LoadModule(); } IPSModuleManagerGUI_SetPage(IPSMMG_ACTION_MODULE, $module); break; case 'Delete': if (IPSModuleManagerGUI_GetLock($action, true)) { IPSLogger_Inf(__file__, 'IPSModuleManagerGUI - Delete of Module '.$module); $moduleManager = new IPSModuleManager($module); $moduleManager->DeleteModule(); } IPSModuleManagerGUI_SetPage(IPSMMG_ACTION_OVERVIEW, $module); break; default: IPSModuleManagerGUI_SetPage($action, $module, $info); } IPSModuleManagerGUI_Refresh();
); // Download Files echo 'Download of ModuleManager'.PHP_EOL; foreach ($fileList as $file) { LoadFile($remoteRepository.$file, $localRepository.$file); } //Registration of IPSUtils in autoload.php Register_IPSUtils(); // Installation of ModuleManager echo 'Installation of ModuleManager'.PHP_EOL; include_once IPS_GetKernelDir().'scripts\\IPSLibrary\\app\\core\\IPSUtils\\IPSUtils.inc.php'; IPSUtils_Include ('IPSModuleManager.class.php', 'IPSLibrary::install::IPSModuleManager'); $moduleManager = new IPSModuleManager('IPSModuleManager'); $moduleManager->LoadModule($remoteRepository, true); $moduleManager->InstallModule(); // ------------------------------------------------------------------------------- function LoadFile($sourceFile, $destinationFile) { if (strpos($sourceFile, 'https')===0) { $sourceFile = str_replace('\\','/',$sourceFile); 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_FAILONERROR, true); $fileContent = curl_exec($curl_handle);