summaryrefslogtreecommitdiffstats
path: root/templates/admin
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-01-10 19:03:23 +0800
committerGitHub <noreply@github.com>2024-01-10 11:03:23 +0000
commit2df7563f3176aa8c7dcb070f660d53da4bb66e78 (patch)
treeacf64c3f4d40f15e0fc28d4f6060644172cc46f0 /templates/admin
parenta80debc208fbf0ecf6ca734e454cae08adafb570 (diff)
downloadgitea-2df7563f3176aa8c7dcb070f660d53da4bb66e78.tar.gz
gitea-2df7563f3176aa8c7dcb070f660d53da4bb66e78.zip
Recommend/convert to use case-sensitive collation for MySQL/MSSQL (#28662)
Mainly for MySQL/MSSQL. It is important for Gitea to use case-sensitive database charset collation. If the database is using a case-insensitive collation, Gitea will show startup error/warning messages, and show the errors/warnings on the admin panel's Self-Check page. Make `gitea doctor convert` work for MySQL to convert the collations of database & tables & columns. * Fix #28131 ## :warning: BREAKING :warning: It is not quite breaking, but it's highly recommended to convert the database&table&column to a consistent and case-sensitive collation.
Diffstat (limited to 'templates/admin')
-rw-r--r--templates/admin/navbar.tmpl3
-rw-r--r--templates/admin/self_check.tmpl36
2 files changed, 39 insertions, 0 deletions
diff --git a/templates/admin/navbar.tmpl b/templates/admin/navbar.tmpl
index b22db1d1fc..fa79f0f759 100644
--- a/templates/admin/navbar.tmpl
+++ b/templates/admin/navbar.tmpl
@@ -4,6 +4,9 @@
<a class="{{if .PageIsAdminDashboard}}active {{end}}item" href="{{AppSubUrl}}/admin">
{{ctx.Locale.Tr "admin.dashboard"}}
</a>
+ <a class="{{if .PageIsAdminSelfCheck}}active {{end}}item" href="{{AppSubUrl}}/admin/self_check">
+ {{ctx.Locale.Tr "admin.self_check"}}
+ </a>
<details class="item toggleable-item" {{if or .PageIsAdminUsers .PageIsAdminEmails .PageIsAdminOrganizations .PageIsAdminAuthentications}}open{{end}}>
<summary>{{ctx.Locale.Tr "admin.identity_access"}}</summary>
<div class="menu">
diff --git a/templates/admin/self_check.tmpl b/templates/admin/self_check.tmpl
new file mode 100644
index 0000000000..0f1ca68e00
--- /dev/null
+++ b/templates/admin/self_check.tmpl
@@ -0,0 +1,36 @@
+{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin config")}}
+
+<div class="admin-setting-content">
+ <h4 class="ui top attached header">
+ {{ctx.Locale.Tr "admin.self_check"}}
+ </h4>
+ <div class="ui attached segment">
+ {{if .DatabaseCheckHasProblems}}
+ {{if .DatabaseType.IsMySQL}}
+ <div class="gt-p-3">{{ctx.Locale.Tr "admin.self_check.database_fix_mysql"}}</div>
+ {{else if .DatabaseType.IsMSSQL}}
+ <div class="gt-p-3">{{ctx.Locale.Tr "admin.self_check.database_fix_mssql"}}</div>
+ {{end}}
+ {{if .DatabaseCheckCollationMismatch}}
+ <div class="ui red message">{{ctx.Locale.Tr "admin.self_check.database_collation_mismatch" .DatabaseCheckResult.ExpectedCollation}}</div>
+ {{end}}
+ {{if .DatabaseCheckCollationCaseInsensitive}}
+ <div class="ui warning message">{{ctx.Locale.Tr "admin.self_check.database_collation_case_insensitive" .DatabaseCheckResult.DatabaseCollation}}</div>
+ {{end}}
+ {{if .DatabaseCheckInconsistentCollationColumns}}
+ <div class="ui red message">
+ {{ctx.Locale.Tr "admin.self_check.database_inconsistent_collation_columns" .DatabaseCheckResult.DatabaseCollation}}
+ <ul class="gt-w-100">
+ {{range .DatabaseCheckInconsistentCollationColumns}}
+ <li>{{.}}</li>
+ {{end}}
+ </ul>
+ </div>
+ {{end}}
+ {{else}}
+ <div class="gt-p-3">{{ctx.Locale.Tr "admin.self_check.no_problem_found"}}</div>
+ {{end}}
+ </div>
+</div>
+
+{{template "admin/layout_footer" .}}