MM-31063: Change constants to use CamelCase (#16608)

* MM-31063: Change constants to use CamelCase

* store package

* change allcaps to camel case (#16615)

* New tools.mod

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Этот коммит содержится в:
Agniva De Sarker
2021-01-04 11:32:29 +05:30
коммит произвёл GitHub
родитель 8b6ac5f5d2
Коммит c1dd23a3c8
158 изменённых файлов: 1485 добавлений и 1479 удалений

Просмотреть файл

@@ -17,18 +17,18 @@ import (
)
const (
SECURITY_URL = "https://securityupdatecheck.mattermost.com"
SECURITY_UPDATE_PERIOD = 86400000 // 24 hours in milliseconds.
PropSecurityURL = "https://securityupdatecheck.mattermost.com"
SecurityUpdatePeriod = 86400000 // 24 hours in milliseconds.
PROP_SECURITY_ID = "id"
PROP_SECURITY_BUILD = "b"
PROP_SECURITY_ENTERPRISE_READY = "be"
PROP_SECURITY_DATABASE = "db"
PROP_SECURITY_OS = "os"
PROP_SECURITY_USER_COUNT = "uc"
PROP_SECURITY_TEAM_COUNT = "tc"
PROP_SECURITY_ACTIVE_USER_COUNT = "auc"
PROP_SECURITY_UNIT_TESTS = "ut"
PropSecurityID = "id"
PropSecurityBuild = "b"
PropSecurityEnterpriseReady = "be"
PropSecurityDatabase = "db"
PropSecurityOS = "os"
PropSecurityUserCount = "uc"
PropSecurityTeamCount = "tc"
PropSecurityActiveUserCount = "auc"
PropSecurityUnitTests = "ut"
)
func (s *Server) DoSecurityUpdateCheck() {
@@ -44,21 +44,21 @@ func (s *Server) DoSecurityUpdateCheck() {
lastSecurityTime, _ := strconv.ParseInt(props[model.SYSTEM_LAST_SECURITY_TIME], 10, 0)
currentTime := model.GetMillis()
if (currentTime - lastSecurityTime) > SECURITY_UPDATE_PERIOD {
if (currentTime - lastSecurityTime) > SecurityUpdatePeriod {
mlog.Debug("Checking for security update from Mattermost")
v := url.Values{}
v.Set(PROP_SECURITY_ID, s.TelemetryId())
v.Set(PROP_SECURITY_BUILD, model.CurrentVersion+"."+model.BuildNumber)
v.Set(PROP_SECURITY_ENTERPRISE_READY, model.BuildEnterpriseReady)
v.Set(PROP_SECURITY_DATABASE, *s.Config().SqlSettings.DriverName)
v.Set(PROP_SECURITY_OS, runtime.GOOS)
v.Set(PropSecurityID, s.TelemetryId())
v.Set(PropSecurityBuild, model.CurrentVersion+"."+model.BuildNumber)
v.Set(PropSecurityEnterpriseReady, model.BuildEnterpriseReady)
v.Set(PropSecurityDatabase, *s.Config().SqlSettings.DriverName)
v.Set(PropSecurityOS, runtime.GOOS)
if len(props[model.SYSTEM_RAN_UNIT_TESTS]) > 0 {
v.Set(PROP_SECURITY_UNIT_TESTS, "1")
v.Set(PropSecurityUnitTests, "1")
} else {
v.Set(PROP_SECURITY_UNIT_TESTS, "0")
v.Set(PropSecurityUnitTests, "0")
}
systemSecurityLastTime := &model.System{Name: model.SYSTEM_LAST_SECURITY_TIME, Value: strconv.FormatInt(currentTime, 10)}
@@ -69,18 +69,18 @@ func (s *Server) DoSecurityUpdateCheck() {
}
if count, err := s.Store.User().Count(model.UserCountOptions{IncludeDeleted: true}); err == nil {
v.Set(PROP_SECURITY_USER_COUNT, strconv.FormatInt(count, 10))
v.Set(PropSecurityUserCount, strconv.FormatInt(count, 10))
}
if ucr, err := s.Store.Status().GetTotalActiveUsersCount(); err == nil {
v.Set(PROP_SECURITY_ACTIVE_USER_COUNT, strconv.FormatInt(ucr, 10))
v.Set(PropSecurityActiveUserCount, strconv.FormatInt(ucr, 10))
}
if teamCount, err := s.Store.Team().AnalyticsTeamCount(false); err == nil {
v.Set(PROP_SECURITY_TEAM_COUNT, strconv.FormatInt(teamCount, 10))
v.Set(PropSecurityTeamCount, strconv.FormatInt(teamCount, 10))
}
res, err := http.Get(SECURITY_URL + "/security?" + v.Encode())
res, err := http.Get(PropSecurityURL + "/security?" + v.Encode())
if err != nil {
mlog.Error("Failed to get security update information from Mattermost.")
return
@@ -99,7 +99,7 @@ func (s *Server) DoSecurityUpdateCheck() {
return
}
resBody, err := http.Get(SECURITY_URL + "/bulletins/" + bulletin.Id)
resBody, err := http.Get(PropSecurityURL + "/bulletins/" + bulletin.Id)
if err != nil {
mlog.Error("Failed to get security bulletin details")
return