Skip to content

Commit

Permalink
Update "GET SERVERPREFS" command to open only the databases that were…
Browse files Browse the repository at this point in the history
… opened when the database server was last shut down (#44)
  • Loading branch information
matsuo committed Nov 9, 2024
1 parent 264fa30 commit 136f8c2
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Features
- FileMaker Admin API PKI Authentication
- View and change the settings for the persistent cache (for FileMaker Server 2024)
- View and change the setting for blocking new users (for FileMaker Server 2024)
- View the setting for opening the databases that were opened when the database server was last shut down (for FileMaker Server 2024 (21.1))

Supported Servers
-----
Expand Down
43 changes: 41 additions & 2 deletions fmcsadmin.go
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,7 @@ func (c *cli) Run(args []string) int {
case "authenticatedstream", "parallelbackupenabled":
case "persistcacheenabled", "syncpersistcache", "databaseserverautorestart":
case "blocknewusersenabled":
case "onlyopenlastopeneddatabases":
default:
exitStatus = 10001
}
Expand Down Expand Up @@ -1130,6 +1131,8 @@ func (c *cli) Run(args []string) int {
printOptions = append(printOptions, "databaseserverautorestart")
case "blocknewusersenabled":
printOptions = append(printOptions, "blocknewusersenabled")
case "onlyopenlastopeneddatabases":
printOptions = append(printOptions, "onlyopenlastopeneddatabases")
default:
exitStatus = 10001
}
Expand Down Expand Up @@ -1158,6 +1161,9 @@ func (c *cli) Run(args []string) int {
printOptions = append(printOptions, "databaseserverautorestart")
printOptions = append(printOptions, "blocknewusersenabled")
}
if !usingCloud && version >= 21.1 {
printOptions = append(printOptions, "onlyopenlastopeneddatabases")
}
}

if version >= 19.2 && startupRestoration {
Expand Down Expand Up @@ -1220,6 +1226,18 @@ func (c *cli) Run(args []string) int {
}
}
}

if option == "onlyopenlastopeneddatabases" {
if usingCloud {
// for Claris FileMaker Cloud
exitStatus = 3
} else {
// for Claris FileMaker Server
if version < 21.1 {
exitStatus = 3
}
}
}
}
}

Expand Down Expand Up @@ -3927,6 +3945,10 @@ func getServerGeneralConfigurations(urlString string, token string, printOptions
var maxProConnections int
var maxPSOS int
var startupRestorationEnabled bool
var onlyOpenLastOpenedDatabases bool

versionString, _ := getServerVersionString(strings.Replace(urlString, "/config/general", "/metadata", 1), token)
version, _ := getServerVersionAsFloat(versionString)

body, _, err := callURL("GET", urlString, token, nil)
if err != nil {
Expand Down Expand Up @@ -3974,8 +3996,15 @@ func getServerGeneralConfigurations(urlString string, token string, printOptions
settings = append(settings, -1)
}

versionString, _ := getServerVersionString(strings.Replace(urlString, "/config/general", "/metadata", 1), token)
version, _ := getServerVersionAsFloat(versionString)
if version >= 21.1 {
// for Claris FileMaker Server 21.1.1 or later
_ = scan.ScanTree(v, "/response/onlyOpenLastOpenedDatabases", &onlyOpenLastOpenedDatabases)
if onlyOpenLastOpenedDatabases {
settings = append(settings, 1)
} else {
settings = append(settings, 0)
}
}

// output
if result == 0 {
Expand Down Expand Up @@ -4050,6 +4079,16 @@ func getServerGeneralConfigurations(urlString string, token string, printOptions
getServerSettingAsBool(strings.Replace(urlString, "/general", "/blocknewusers", 1), token, []string{option})
}
}

if option == "onlyopenlastopeneddatabases" {
if version >= 21.1 {
if onlyOpenLastOpenedDatabases {
fmt.Println("OnlyOpenLastOpenedDatabases = true [default: false] ")
} else {
fmt.Println("OnlyOpenLastOpenedDatabases = false [default: false] ")
}
}
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions release-notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ fmcsadmin
This software is distributed under the Apache License, Version 2.0, see LICENSE.txt and NOTICE.txt for more information.

Version: 2.3.0-dev (in development)
- Add support for Claris FileMaker Server 2024 (21.1).
- Add support for macOS Sequoia 15.
- Update "GET SERVERPREFS" command to open the databases that were opened when the database server was last shut down for Claris FileMaker Server 2024 (21.1). (Usage: "fmcsadmin get serverprefs OnlyOpenLastOpenedDatabases")
- Built with Go 1.23.
- [INFO] Drop support for Claris FileMaker Server 19.6.
- [INFO] Drop support for macOS Monterey 12.
Expand Down

0 comments on commit 136f8c2

Please sign in to comment.