Skip to content

Commit 546fa99

Browse files
committed
Move code removing old mappings to installer
1 parent c9316ec commit 546fa99

File tree

3 files changed

+35
-32
lines changed

3 files changed

+35
-32
lines changed

preload/cls/IPM/Installer.cls

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,4 +416,37 @@ ClassMethod CreateTempDir() As %String
416416
return ##class(%File).NormalizeDirectory(tDir)
417417
}
418418

419+
/// This method is called directly in LoadNewModule() instead of with an <Invoke> in the module.xml
420+
/// because the old mappings break load/install before any <Invokes> can be run.
421+
ClassMethod CleanupOldMappings() As %Status
422+
{
423+
set sc = $$$OK
424+
// Cleanup old mappings from oddStudioDocument
425+
set key = ""
426+
for {
427+
set key = $order(^oddStudioDocument(key))
428+
quit:key=""
429+
if (key["%ZPM.PackageManager") || (key["%ZHSLIB.PackageManager") {
430+
kill ^oddStudioDocument(key)
431+
}
432+
}
433+
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)
447+
}
448+
449+
return sc
450+
}
451+
419452
}

src/cls/IPM/Lifecycle/Base.cls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,7 @@ Method %Verify(ByRef pParams) As %Status
13221322

13231323
// Map the package manager itself equivalently in the VERIFY namespace.
13241324
$$$ThrowOnError(##class(%IPM.Utils.Build).MapRoutineEquivalently("%IPM.*",tInitNS,,tNewNamespace))
1325+
$$$ThrowOnError(##class(%IPM.Utils.Build).MapRoutineEquivalently("IPM.*",tInitNS,,tNewNamespace))
13251326
$$$ThrowOnError(##class(%IPM.Utils.Build).MapPackageEquivalently("%IPM",tInitNS,tNewNamespace))
13261327

13271328
// Map globals for %IPM.Repo.Definition and %IPM.Repo.Filesystem.Cache

src/cls/IPM/Utils/Module.cls

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ ClassMethod LoadNewModule(
11001100

11011101
// If installing new version of IPM, clean up old mappings
11021102
if newModuleObj.Name=$$$IPMModuleName {
1103-
$$$ThrowOnError(..CleanupOldMappings())
1103+
$$$ThrowOnError(##class(IPM.Installer).CleanupOldMappings())
11041104
}
11051105
}
11061106
if moduleCurrent '= "" {
@@ -2420,35 +2420,4 @@ ClassMethod GetDeployedProjectName(moduleName As %String) As %String [ CodeMode
24202420
moduleName_$$$DeployedProjectSuffix
24212421
}
24222422

2423-
/// This method is called directly in LoadNewModule() instead of with an <Invoke> in the module.xml
2424-
/// because the old mappings break load/install before any <Invokes> can be run.
2425-
ClassMethod CleanupOldMappings() As %Status
2426-
{
2427-
set sc = $$$OK
2428-
// Cleanup old mappings from oddStudioDocument
2429-
set key = ""
2430-
for {
2431-
set key = $order(^oddStudioDocument(key))
2432-
quit:key=""
2433-
if (key["%ZPM.PackageManager") || (key["%ZHSLIB.PackageManager") {
2434-
kill ^oddStudioDocument(key)
2435-
}
2436-
}
2437-
2438-
set status = ##class(%IPM.Utils.Module).RemoveGlobalMapping($namespace,"oddStudioDocument:(BEGIN):(""%ZP"")","IRISLIB")
2439-
if $$$ISERR(status) {
2440-
set sc = $$$ADDSC(sc, status)
2441-
}
2442-
set status = ##class(%IPM.Utils.Module).RemoveGlobalMapping($namespace,"oddStudioDocument:(""%ZP""):(""A"")","IRISSYS")
2443-
if $$$ISERR(status) {
2444-
set sc = $$$ADDSC(sc, status)
2445-
}
2446-
set status = ##class(%IPM.Utils.Module).RemoveGlobalMapping($namespace,"oddStudioDocument:(""Ens""):(""Ent"")","ENSLIB")
2447-
if $$$ISERR(status) {
2448-
set sc = $$$ADDSC(sc, status)
2449-
}
2450-
2451-
return sc
2452-
}
2453-
24542423
}

0 commit comments

Comments
 (0)