MCPcopy Create free account
hub / github.com/xpf0000/FlyEnv / resetCurrentVersion

Method resetCurrentVersion

src/render/core/Module/Module.ts:76–104  ·  view source on GitHub ↗
(autoSave: boolean = false)

Source from the content-addressed store, hash-verified

74 private _fetchInstalledResolves: CallbackFn[] = []
75
76 resetCurrentVersion(autoSave: boolean = false) {
77 if (this.typeFlag !== 'php' && this.installed.length > 0) {
78 const appStore = AppStore()
79 const server = appStore.serverCurrent(this.typeFlag)
80 const currentVersion = server?.current?.version
81 const currentPath = server?.current?.path
82 const findCurrent =
83 currentVersion &&
84 currentPath &&
85 this.installed.find(
86 (d) => d.version && d.enable && d.version === currentVersion && d.path === currentPath
87 )
88 if (!findCurrent) {
89 const find = this.installed.find((d) => d.version && d.enable)
90 if (find) {
91 appStore.UPDATE_SERVER_CURRENT({
92 flag: this.typeFlag,
93 data: JSON.parse(JSON.stringify(find))
94 })
95 if (autoSave) {
96 appStore.saveConfig().catch()
97 }
98 return true
99 }
100 }
101 }
102
103 return false
104 }
105
106 async applyInstalledVersions(installed: SoftInstalled[]) {
107 const appStore = AppStore()

Callers 1

Calls 3

catchMethod · 0.80
saveConfigMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected