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) {
w.Header().Add("X-Documize-Version", AppVersion)
w.Header().Add("Cache-Control", "no-cache")
// if certFile != "" && keyFile != "" {
// w.Header().Add("Strict-Transport-Security", "max-age=63072000; includeSubDomains")
// }
next(w, r)
}

View file

@ -35,10 +35,10 @@ var unlockDB func()
// Check that the database is configured correctly and that all the required tables exist.
// 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
lockDB=lDB
unlockDB=ulDB
lockDB = lDB
unlockDB = ulDB
csBits := strings.Split(connectionString, "/")
if len(csBits) > 1 {
@ -67,6 +67,11 @@ func Check(Db *sqlx.DB, connectionString string,lDB func() (bool, error),ulDB fu
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
vParts := strings.Split(version, ".")
if len(vParts) < 3 {