mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
1133f0f826
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
Former-commit-id: 0c8eb7bea0cdf9745385fae660532bda9368c7be [formerly 5fb38e8b21346fa41fe0602929cd4f7f6fa19fa2] [formerly 9f39ca06f86dcb7c64b69ed4227789581f140397 [formerly f396602084
]]
Former-commit-id: f310a5b4d7b1a54026dba8ccb637bf2ad5bf531a [formerly da06cb70d42ae5c2a4b0927f661b0026ae972792]
Former-commit-id: 23d0481a4cb60a70ab1b59bd8042c3923d161917
32 lines
811 B
Go
32 lines
811 B
Go
package cmd
|
|
|
|
import (
|
|
"github.com/filebrowser/filebrowser/v2/storage/bolt/importer"
|
|
"github.com/spf13/cobra"
|
|
v "github.com/spf13/viper"
|
|
)
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(upgradeCmd)
|
|
|
|
upgradeCmd.Flags().String("old.database", "", "")
|
|
upgradeCmd.Flags().String("old.config", "", "")
|
|
upgradeCmd.MarkFlagRequired("old.database")
|
|
}
|
|
|
|
var upgradeCmd = &cobra.Command{
|
|
Use: "upgrade",
|
|
Short: "Upgrades an old configuration",
|
|
Long: `Upgrades an old configuration. This command DOES NOT
|
|
import share links because they are incompatible with
|
|
this version.`,
|
|
Args: cobra.NoArgs,
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
oldDB := mustGetString(cmd, "old.database")
|
|
oldConf := mustGetString(cmd, "old.config")
|
|
|
|
err := importer.Import(oldDB, oldConf, v.GetString("database"))
|
|
checkErr(err)
|
|
},
|
|
}
|