mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-06 21:24:10 +00:00
feat: guard GetDb/ImportDB for MariaDB (unsupported SQLite-specific operations)
This commit is contained in:
parent
fd910efec2
commit
8a20cbd5c2
1 changed files with 6 additions and 0 deletions
|
|
@ -882,6 +882,9 @@ func (s *ServerService) GetConfigJson() (any, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ServerService) GetDb() ([]byte, error) {
|
func (s *ServerService) GetDb() ([]byte, error) {
|
||||||
|
if config.GetDBTypeFromJSON() == "mariadb" {
|
||||||
|
return nil, common.NewError("Database export is not supported for MariaDB")
|
||||||
|
}
|
||||||
// Update by manually trigger a checkpoint operation
|
// Update by manually trigger a checkpoint operation
|
||||||
err := database.Checkpoint()
|
err := database.Checkpoint()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -904,6 +907,9 @@ func (s *ServerService) GetDb() ([]byte, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ServerService) ImportDB(file multipart.File) error {
|
func (s *ServerService) ImportDB(file multipart.File) error {
|
||||||
|
if config.GetDBTypeFromJSON() == "mariadb" {
|
||||||
|
return common.NewError("Database import is not supported for MariaDB")
|
||||||
|
}
|
||||||
// Check if the file is a SQLite database
|
// Check if the file is a SQLite database
|
||||||
isValidDb, err := database.IsSQLiteDB(file)
|
isValidDb, err := database.IsSQLiteDB(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue