Skip to content

Commit 5d74fc4

Browse files
committed
fix: resolved issue with instance wide settings being in protected global
1 parent 1ab0d27 commit 5d74fc4

File tree

8 files changed

+152
-5
lines changed

8 files changed

+152
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
### Added
1212
- New UI for the basic mode Sync (#415)
1313

14+
### Fixed
15+
- Instance wide settings are placed in proper global (#444)
16+
1417
## [2.4.1] - 2024-08-02
1518

1619
### Added

cls/SourceControl/Git/Change.cls

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,4 +237,3 @@ Storage Default
237237
}
238238

239239
}
240-
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
Class SourceControl.Git.DiscardState Extends (%Persistent, %JSON.Adaptor)
2+
{
3+
4+
Property FullExternalName As %String(MAXLEN = "") [ Required ];
5+
6+
Property InternalName As %String [ Required ];
7+
8+
Property Contents As %Stream.GlobalCharacter(LOCATION = "^DiscardStateContents");
9+
10+
Property Username As %String [ Required ];
11+
12+
Property Branch As %String [ Required ];
13+
14+
Property Timestamp As %TimeStamp [ Required ];
15+
16+
Method RestoreToFileTree()
17+
{
18+
set fileStream = ##class(%Stream.FileCharacter).%OpenId(..FullExternalName,,.sc)
19+
$$$ThrowOnError(sc)
20+
do fileStream.CopyFrom(..Contents)
21+
$$$ThrowOnError(fileStream.%Save())
22+
do ##class(SourceControl.Git.Utils).ImportItem(..InternalName, 1, 1)
23+
do ##class(SourceControl.Git.Utils).AddToServerSideSourceControl(..InternalName)
24+
$$$ThrowOnError(..%DeleteId(..%Id()))
25+
}
26+
27+
ClassMethod SaveDiscardState(InternalName As %String) As %Status
28+
{
29+
set discardState = ..%New()
30+
set discardState.FullExternalName = ##class(SourceControl.Git.Utils).FullExternalName(InternalName)
31+
set discardState.InternalName = InternalName
32+
33+
set fileStream = ##class(%Stream.FileCharacter).%New()
34+
set fileStream.Filename = discardState.FullExternalName
35+
do fileStream.%Open()
36+
do discardState.Contents.CopyFrom(fileStream)
37+
do fileStream.%Close()
38+
set discardState.Username = $USERNAME
39+
set discardState.Branch = ##class(SourceControl.Git.Utils).GetCurrentBranch()
40+
set discardState.Timestamp = $zdatetime($horolog, 3)
41+
42+
set st = discardState.%Save()
43+
44+
quit st
45+
}
46+
47+
ClassMethod DiscardStatesInBranch() As %DynamicArray
48+
{
49+
set currentBranch = ##class(SourceControl.Git.Utils).GetCurrentBranch()
50+
set statement = "SELECT ID FROM SourceControl_Git.DiscardState WHERE branch = ?"
51+
set resultSet = ##class(%SQL.Statement).%ExecDirect(, statement, currentBranch)
52+
set discardStates = []
53+
while resultSet.%Next() {
54+
set discardState = ..%OpenId(resultSet.ID)
55+
do discardState.%JSONExportToString(.JSONStr)
56+
set discardStateObject = ##class(%DynamicAbstractObject).%FromJSON(JSONStr)
57+
set discardStateObject.Id = resultSet.ID
58+
do discardStates.%Push(discardStateObject)
59+
}
60+
61+
quit discardStates
62+
}
63+
64+
Storage Default
65+
{
66+
<Data name="DiscardStateDefaultData">
67+
<Value name="1">
68+
<Value>%%CLASSNAME</Value>
69+
</Value>
70+
<Value name="2">
71+
<Value>FullExternalName</Value>
72+
</Value>
73+
<Value name="3">
74+
<Value>InternalName</Value>
75+
</Value>
76+
<Value name="4">
77+
<Value>Contents</Value>
78+
</Value>
79+
<Value name="5">
80+
<Value>Username</Value>
81+
</Value>
82+
<Value name="6">
83+
<Value>Branch</Value>
84+
</Value>
85+
<Value name="7">
86+
<Value>Timestamp</Value>
87+
</Value>
88+
</Data>
89+
<DataLocation>^SourceControl22B9.DiscardStateD</DataLocation>
90+
<DefaultData>DiscardStateDefaultData</DefaultData>
91+
<ExtentSize>1</ExtentSize>
92+
<IdLocation>^SourceControl22B9.DiscardStateD</IdLocation>
93+
<IndexLocation>^SourceControl22B9.DiscardStateI</IndexLocation>
94+
<Property name="%%CLASSNAME">
95+
<AverageFieldSize>2</AverageFieldSize>
96+
<OutlierSelectivity>.999999:</OutlierSelectivity>
97+
<Selectivity>0.0001%</Selectivity>
98+
</Property>
99+
<Property name="%%ID">
100+
<AverageFieldSize>3</AverageFieldSize>
101+
<Selectivity>1</Selectivity>
102+
</Property>
103+
<Property name="Branch">
104+
<AverageFieldSize>8</AverageFieldSize>
105+
<OutlierSelectivity>.999999:"branch"</OutlierSelectivity>
106+
<Selectivity>0.0001%</Selectivity>
107+
</Property>
108+
<Property name="Contents">
109+
<OutlierSelectivity>.999999:$lb("15","%Stream.GlobalCharacter","^DiscardStateContents")</OutlierSelectivity>
110+
<Selectivity>0.0001%</Selectivity>
111+
</Property>
112+
<Property name="FullExternalName">
113+
<AverageFieldSize>53</AverageFieldSize>
114+
<OutlierSelectivity>.999999:"C:\temp\USER\cls\medicine\cls\medicine\testfile.cls"</OutlierSelectivity>
115+
<Selectivity>0.0001%</Selectivity>
116+
</Property>
117+
<Property name="InternalName">
118+
<AverageFieldSize>23</AverageFieldSize>
119+
<OutlierSelectivity>.999999:"medicine.testfile.CLS"</OutlierSelectivity>
120+
<Selectivity>0.0001%</Selectivity>
121+
</Property>
122+
<Property name="Timestamp">
123+
<AverageFieldSize>21</AverageFieldSize>
124+
<OutlierSelectivity>.999999:"2024-08-12 14:09:28"</OutlierSelectivity>
125+
<Selectivity>0.0001%</Selectivity>
126+
</Property>
127+
<Property name="Username">
128+
<AverageFieldSize>13</AverageFieldSize>
129+
<OutlierSelectivity>.999999:"UnknownUser"</OutlierSelectivity>
130+
<Selectivity>0.0001%</Selectivity>
131+
</Property>
132+
<SQLMap name="IDKEY">
133+
<BlockCount>-4</BlockCount>
134+
</SQLMap>
135+
<StreamLocation>^SourceControl22B9.DiscardStateS</StreamLocation>
136+
<Type>%Storage.Persistent</Type>
137+
}
138+
139+
}

cls/SourceControl/Git/Extension.cls

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,4 +403,3 @@ Method AddToSourceControl(InternalName As %String, Description As %String = "")
403403
}
404404

405405
}
406-

cls/SourceControl/Git/Utils.cls

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Parameter GitContextMenuItems = ",%Diff,%Blame,";
1818

1919
ClassMethod %SYSNamespaceStorage() As %String [ CodeMode = expression ]
2020
{
21-
$Replace(..#Storage,"^","^["""_..#InstallNamespace_"""]")
21+
$Replace(..#Storage,"^SYS","^%SYS")
2222
}
2323

2424
/// Returns root temp folder
@@ -183,6 +183,13 @@ ClassMethod IsImportAfter(menuItemName As %String) As %Boolean [ CodeMode = expr
183183
$Find(..#ImportAfterGitMenuItems, ","_menuItemName_",") > 0
184184
}
185185

186+
ClassMethod MigrateInstanceSettings()
187+
{
188+
if '$data(@..%SYSNamespaceStorage()@("%gitBinPath")) {
189+
merge ^%SYS("SourceControl", "Git") = ^["%SYS"]SYS("SourceControl", "Git")
190+
}
191+
}
192+
186193
ClassMethod UserAction(InternalName As %String, MenuName As %String, ByRef Target As %String, ByRef Action As %String, ByRef Reload As %Boolean, ByRef Msg As %String) As %Status
187194
{
188195
#define Force 1
@@ -2563,4 +2570,3 @@ ClassMethod BaselineExport(pCommitMessage = "", pPushToRemote = "") As %Status
25632570
}
25642571

25652572
}
2566-

cls/SourceControl/Git/WebUIDriver.cls

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,4 +269,3 @@ ClassMethod GetPackageVersion() As %Library.DynamicObject
269269
}
270270

271271
}
272-
Lines changed: 1 addition & 0 deletions
Loading

module.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
<Invoke Class="SourceControl.Git.Utils" Method="Localize" />
3535
<Invoke Class="SourceControl.Git.Utils" Method="ConfigureWeb" />
3636
<Invoke Class="SourceControl.Git.Utils" Method="CheckInitialization" />
37+
<Invoke Class="SourceControl.Git.Utils" Method="MigrateInstanceSettings" />
3738

3839
<Invoke Class="SourceControl.Git.Utils" Method="ResetSourceControlClass" Phase="Unconfigure" />
3940
</Module>

0 commit comments

Comments
 (0)