1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-10 07:55:25 +02:00

Fixed up DB check code to strip MySL version suffix strings

This commit is contained in:
Harvey Kandola 2016-05-20 14:26:13 -07:00
parent d74a56aac1
commit f5d9fa49a3
3 changed files with 19 additions and 9 deletions

View file

@ -230,6 +230,11 @@ func cors(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
func metrics(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) { func metrics(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
w.Header().Add("X-Documize-Version", AppVersion) w.Header().Add("X-Documize-Version", AppVersion)
w.Header().Add("Cache-Control", "no-cache") w.Header().Add("Cache-Control", "no-cache")
// if certFile != "" && keyFile != "" {
// w.Header().Add("Strict-Transport-Security", "max-age=63072000; includeSubDomains")
// }
next(w, r) next(w, r)
} }

View file

@ -1,11 +1,11 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved. // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
// //
// This software (Documize Community Edition) is licensed under // This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html // GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
// //
// You can operate outside the AGPL restrictions by purchasing // You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license // Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>. // by contacting <sales@documize.com>.
// //
// https://documize.com // https://documize.com
@ -34,12 +34,12 @@ var lockDB func() (bool, error)
var unlockDB func() var unlockDB func()
// Check that the database is configured correctly and that all the required tables exist. // Check that the database is configured correctly and that all the required tables exist.
// It must be the first function called in the // It must be the first function called in the
func Check(Db *sqlx.DB, connectionString string,lDB func() (bool, error),ulDB func()) bool { func Check(Db *sqlx.DB, connectionString string, lDB func() (bool, error), ulDB func()) bool {
dbPtr = &Db dbPtr = &Db
lockDB=lDB lockDB = lDB
unlockDB=ulDB unlockDB = ulDB
csBits := strings.Split(connectionString, "/") csBits := strings.Split(connectionString, "/")
if len(csBits) > 1 { if len(csBits) > 1 {
web.SiteInfo.DBname = strings.Split(csBits[len(csBits)-1], "?")[0] web.SiteInfo.DBname = strings.Split(csBits[len(csBits)-1], "?")[0]
@ -67,6 +67,11 @@ func Check(Db *sqlx.DB, connectionString string,lDB func() (bool, error),ulDB fu
return false return false
} }
// See http://dba.stackexchange.com/questions/63763/is-there-any-difference-between-these-two-version-of-mysql-5-1-73-community-lo
version = strings.Replace(version, "-log", "", 1)
version = strings.Replace(version, "-debug", "", 1)
version = strings.Replace(version, "-demo", "", 1)
{ // check minimum MySQL version as we need JSON column type. 5.7.10 { // check minimum MySQL version as we need JSON column type. 5.7.10
vParts := strings.Split(version, ".") vParts := strings.Split(version, ".")
if len(vParts) < 3 { if len(vParts) < 3 {

View file

@ -1,11 +1,11 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved. // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
// //
// This software (Documize Community Edition) is licensed under // This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html // GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
// //
// You can operate outside the AGPL restrictions by purchasing // You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license // Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>. // by contacting <sales@documize.com>.
// //
// https://documize.com // https://documize.com