@@ -421,29 +421,51 @@ ClassMethod CreateTempDir() As %String
421421ClassMethod CleanupOldMappings () As %Status
422422{
423423 set sc = $$$OK
424- // Cleanup old mappings from oddStudioDocument
425- set key = " "
424+ // Get list of all namespaces
425+ new $namespace
426+ set $namespace = " %SYS"
427+ set status = ##class (%SYS.Namespace ).ListAll (.nsList )
428+ if $$$ISERR(status ) {
429+ return status
430+ }
431+
432+ // Iterate through each namespace and remove old mappings
433+ set namespace = " "
426434 for {
427- set key = $order (^oddStudioDocument (key ))
428- quit :key =" "
429- if (key [" %ZPM.PackageManager" ) || (key [" %ZHSLIB.PackageManager" ) {
430- kill ^oddStudioDocument (key )
435+ set namespace = $order (nsList (namespace ))
436+ if namespace = " " {
437+ quit
438+ }
439+ set $namespace = namespace
440+ // check if IPM is installed in this namespace
441+ if '$$$comClassDefined(" %IPM.Utils.Module" ) {
442+ continue
431443 }
432- }
433444
434- // These mappings were suggested as a temporary workaround for IRIS 2023.x,
435- // but whose underlying issues have been resolved in 2024.1 and later.
436- set status = ##class (%IPM.Utils.Module ).RemoveGlobalMapping ($namespace ," oddStudioDocument:(BEGIN):(" " %ZP" " )" ," IRISLIB" )
437- if $$$ISERR(status ) {
438- set sc = $$$ADDSC(sc , status )
439- }
440- set status = ##class (%IPM.Utils.Module ).RemoveGlobalMapping ($namespace ," oddStudioDocument:(" " %ZP" " ):(" " A" " )" ," IRISSYS" )
441- if $$$ISERR(status ) {
442- set sc = $$$ADDSC(sc , status )
443- }
444- set status = ##class (%IPM.Utils.Module ).RemoveGlobalMapping ($namespace ," oddStudioDocument:(" " Ens" " ):(" " Ent" " )" ," ENSLIB" )
445- if $$$ISERR(status ) {
446- set sc = $$$ADDSC(sc , status )
445+ // Cleanup old mappings from oddStudioDocument
446+ set key = " "
447+ for {
448+ set key = $order (^oddStudioDocument (key ))
449+ quit :key =" "
450+ if (key [" %ZPM.PackageManager" ) || (key [" %ZHSLIB.PackageManager" ) {
451+ kill ^oddStudioDocument (key )
452+ }
453+ }
454+
455+ // These mappings were suggested as a temporary workaround for IRIS 2023.x,
456+ // but whose underlying issues have been resolved in 2024.1 and later.
457+ set status = ##class (%IPM.Utils.Module ).RemoveGlobalMapping ($namespace ," oddStudioDocument:(BEGIN):(" " %ZP" " )" ," IRISLIB" )
458+ if $$$ISERR(status ) {
459+ set sc = $$$ADDSC(sc , status )
460+ }
461+ set status = ##class (%IPM.Utils.Module ).RemoveGlobalMapping ($namespace ," oddStudioDocument:(" " %ZP" " ):(" " A" " )" ," IRISSYS" )
462+ if $$$ISERR(status ) {
463+ set sc = $$$ADDSC(sc , status )
464+ }
465+ set status = ##class (%IPM.Utils.Module ).RemoveGlobalMapping ($namespace ," oddStudioDocument:(" " Ens" " ):(" " Ent" " )" ," ENSLIB" )
466+ if $$$ISERR(status ) {
467+ set sc = $$$ADDSC(sc , status )
468+ }
447469 }
448470
449471 return sc
0 commit comments