mirror of
https://github.com/documize/community.git
synced 2025-07-19 13:19:43 +02:00
Ensure Backup/Restore process activation keys
This commit is contained in:
parent
5153d49ad7
commit
73d91a2dae
3 changed files with 15 additions and 5 deletions
|
@ -46,6 +46,12 @@ func WriteServerError(w http.ResponseWriter, method string, err error) {
|
|||
w.Write([]byte("{Error: 'Internal server error'}"))
|
||||
}
|
||||
|
||||
// WriteError notifies HTTP client of general application error.
|
||||
func WriteError(w http.ResponseWriter, method string) {
|
||||
writeStatus(w, http.StatusBadRequest)
|
||||
w.Write([]byte("{Error: 'Internal server error'}"))
|
||||
}
|
||||
|
||||
// WriteDuplicateError notifies HTTP client of duplicate data that has been rejected.
|
||||
func WriteDuplicateError(w http.ResponseWriter, method, entity string) {
|
||||
writeStatus(w, http.StatusConflict)
|
||||
|
|
|
@ -235,7 +235,8 @@ func (b backerHandler) dmzOrg(files *[]backupItem) (err error) {
|
|||
err = b.Runtime.Db.Select(&o, `SELECT id, c_refid AS refid,
|
||||
c_title AS title, c_message AS message, c_domain AS domain,
|
||||
c_service AS conversionendpoint, c_email AS email, c_serial AS serial, c_active AS active,
|
||||
c_anonaccess AS allowanonymousaccess, c_authprovider AS authprovider,
|
||||
c_anonaccess AS allowanonymousaccess, c_authprovider AS authprovider,
|
||||
coalesce(c_sub,`+b.Runtime.StoreProvider.JSONEmpty()+`) AS subscription,
|
||||
coalesce(c_authconfig,`+b.Runtime.StoreProvider.JSONEmpty()+`) AS authconfig, c_maxtags AS maxtags,
|
||||
c_created AS created, c_revised AS revised
|
||||
FROM dmz_org`+w)
|
||||
|
|
|
@ -363,12 +363,13 @@ func (r *restoreHandler) dmzOrg() (err error) {
|
|||
_, err = r.Context.Transaction.Exec(r.Runtime.Db.Rebind(`
|
||||
INSERT INTO dmz_org (c_refid, c_company, c_title, c_message,
|
||||
c_domain, c_service, c_email, c_anonaccess, c_authprovider, c_authconfig,
|
||||
c_maxtags, c_verified, c_serial, c_active, c_created, c_revised)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`),
|
||||
c_maxtags, c_verified, c_serial, c_sub, c_active, c_created, c_revised)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`),
|
||||
org[i].RefID, org[i].Company, org[i].Title, org[i].Message,
|
||||
strings.ToLower(org[i].Domain), org[i].ConversionEndpoint, strings.ToLower(org[i].Email),
|
||||
org[i].AllowAnonymousAccess, org[i].AuthProvider, org[i].AuthConfig,
|
||||
org[i].MaxTags, true, org[i].Serial, org[i].Active, org[i].Created, org[i].Revised)
|
||||
org[i].MaxTags, true, org[i].Serial, org[i].Subscription,
|
||||
org[i].Active, org[i].Created, org[i].Revised)
|
||||
if err != nil {
|
||||
r.Context.Transaction.Rollback()
|
||||
err = errors.Wrap(err, fmt.Sprintf("unable to insert %s %s", filename, org[i].RefID))
|
||||
|
@ -400,6 +401,7 @@ func (r *restoreHandler) dmzOrg() (err error) {
|
|||
org[0].Message = r.Spec.Org.Message
|
||||
org[0].Serial = r.Spec.Org.Serial
|
||||
org[0].Title = r.Spec.Org.Title
|
||||
org[0].Subscription = r.Spec.Org.Subscription
|
||||
}
|
||||
|
||||
_, err = r.Context.Transaction.NamedExec(`UPDATE dmz_org SET
|
||||
|
@ -412,7 +414,8 @@ func (r *restoreHandler) dmzOrg() (err error) {
|
|||
c_maxtags=:maxtags,
|
||||
c_message=:message,
|
||||
c_title=:title,
|
||||
c_serial=:serial
|
||||
c_serial=:serial,
|
||||
c_sub=:subscription
|
||||
WHERE c_refid=:refid`, &org[0])
|
||||
if err != nil {
|
||||
r.Context.Transaction.Rollback()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue