summaryrefslogtreecommitdiffstats
path: root/modules/doctor/dbconsistency.go
blob: 8c960cb4a8bdee3dab00d9fcbb3da60ce8fe634a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
// Copyright 2020 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

package doctor

import (
	"context"

	"code.gitea.io/gitea/models"
	"code.gitea.io/gitea/models/migrations"
	"code.gitea.io/gitea/modules/log"
	"code.gitea.io/gitea/modules/setting"
)

func checkDBConsistency(logger log.Logger, autofix bool) error {
	// make sure DB version is uptodate
	if err := models.NewEngine(context.Background(), migrations.EnsureUpToDate); err != nil {
		logger.Critical("Model version on the database does not match the current Gitea version. Model consistency will not be checked until the database is upgraded")
		return err
	}

	// find labels without existing repo or org
	count, err := models.CountOrphanedLabels()
	if err != nil {
		logger.Critical("Error: %v whilst counting orphaned labels")
		return err
	}
	if count > 0 {
		if autofix {
			if err = models.DeleteOrphanedLabels(); err != nil {
				logger.Critical("Error: %v whilst deleting orphaned labels")
				return err
			}
			logger.Info("%d labels without existing repository/organisation deleted", count)
		} else {
			logger.Warn("%d labels without existing repository/organisation", count)
		}
	}

	// find IssueLabels without existing label
	count, err = models.CountOrphanedIssueLabels()
	if err != nil {
		logger.Critical("Error: %v whilst counting orphaned issue_labels")
		return err
	}
	if count > 0 {
		if autofix {
			if err = models.DeleteOrphanedIssueLabels(); err != nil {
				logger.Critical("Error: %v whilst deleting orphaned issue_labels")
				return err
			}
			logger.Info("%d issue_labels without existing label deleted", count)
		} else {
			logger.Warn("%d issue_labels without existing label", count)
		}
	}

	// find issues without existing repository
	count, err = models.CountOrphanedIssues()
	if err != nil {
		logger.Critical("Error: %v whilst counting orphaned issues")
		return err
	}
	if count > 0 {
		if autofix {
			if err = models.DeleteOrphanedIssues(); err != nil {
				logger.Critical("Error: %v whilst deleting orphaned issues")
				return err
			}
			logger.Info("%d issues without existing repository deleted", count)
		} else {
			logger.Warn("%d issues without existing repository", count)
		}
	}

	// find pulls without existing issues
	count, err = models.CountOrphanedObjects("pull_request", "issue", "pull_request.issue_id=issue.id")
	if err != nil {
		logger.Critical("Error: %v whilst counting orphaned objects")
		return err
	}
	if count > 0 {
		if autofix {
			if err = models.DeleteOrphanedObjects("pull_request", "issue", "pull_request.issue_id=issue.id"); err != nil {
				logger.Critical("Error: %v whilst deleting orphaned objects")
				return err
			}
			logger.Info("%d pull requests without existing issue deleted", count)
		} else {
			logger.Warn("%d pull requests without existing issue", count)
		}
	}

	// find tracked times without existing issues/pulls
	count, err = models.CountOrphanedObjects("tracked_time", "issue", "tracked_time.issue_id=issue.id")
	if err != nil {
		logger.Critical("Error: %v whilst counting orphaned objects")
		return err
	}
	if count > 0 {
		if autofix {
			if err = models.DeleteOrphanedObjects("tracked_time", "issue", "tracked_time.issue_id=issue.id"); err != nil {
				logger.Critical("Error: %v whilst deleting orphaned objects")
				return err
			}
			logger.Info("%d tracked times without existing issue deleted", count)
		} else {
			logger.Warn("%d tracked times without existing issue", count)
		}
	}

	// find null archived repositories
	count, err = models.CountNullArchivedRepository()
	if err != nil {
		logger.Critical("Error: %v whilst counting null archived repositories")
		return err
	}
	if count > 0 {
		if autofix {
			updatedCount, err := models.FixNullArchivedRepository()
			if err != nil {
				logger.Critical("Error: %v whilst fixing null archived repositories")
				return err
			}
			logger.Info("%d repositories with null is_archived updated", updatedCount)
		} else {
			logger.Warn("%d repositories with null is_archived", count)
		}
	}

	// find label comments with empty labels
	count, err = models.CountCommentTypeLabelWithEmptyLabel()
	if err != nil {
		logger.Critical("Error: %v whilst counting label comments with empty labels")
		return err
	}
	if count > 0 {
		if autofix {
			updatedCount, err := models.FixCommentTypeLabelWithEmptyLabel()
			if err != nil {
				logger.Critical("Error: %v whilst removing label comments with empty labels")
				return err
			}
			logger.Info("%d label comments with empty labels removed", updatedCount)
		} else {
			logger.Warn("%d label comments with empty labels", count)
		}
	}

	// find label comments with labels from outside the repository
	count, err = models.CountCommentTypeLabelWithOutsideLabels()
	if err != nil {
		logger.Critical("Error: %v whilst counting label comments with outside labels", err)
		return err
	}
	if count > 0 {
		if autofix {
			updatedCount, err := models.FixCommentTypeLabelWithOutsideLabels()
			if err != nil {
				logger.Critical("Error: %v whilst removing label comments with outside labels", err)
				return err
			}
			log.Info("%d label comments with outside labels removed", updatedCount)
		} else {
			log.Warn("%d label comments with outside labels", count)
		}
	}

	// find issue_label with labels from outside the repository
	count, err = models.CountIssueLabelWithOutsideLabels()
	if err != nil {
		logger.Critical("Error: %v whilst counting issue_labels from outside the repository or organisation", err)
		return err
	}
	if count > 0 {
		if autofix {
			updatedCount, err := models.FixIssueLabelWithOutsideLabels()
			if err != nil {
				logger.Critical("Error: %v whilst removing issue_labels from outside the repository or organisation", err)
				return err
			}
			logger.Info("%d issue_labels from outside the repository or organisation removed", updatedCount)
		} else {
			logger.Warn("%d issue_labels from outside the repository or organisation", count)
		}
	}

	// TODO: function to recalc all counters

	if setting.Database.UsePostgreSQL {
		count, err = models.CountBadSequences()
		if err != nil {
			logger.Critical("Error: %v whilst checking sequence values")
		}
		if count > 0 {
			if autofix {
				err := models.FixBadSequences()
				if err != nil {
					logger.Critical("Error: %v whilst attempting to fix sequences")
					return err
				}
				logger.Info("%d sequences updated", count)
			} else {
				logger.Warn("%d sequences with incorrect values", count)
			}
		}
	}

	return nil
}

func init() {
	Register(&Check{
		Title:     "Check consistency of database",
		Name:      "check-db-consistency",
		IsDefault: false,
		Run:       checkDBConsistency,
		Priority:  3,
	})
}
ort/49843/stable30 Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/l10n/es_419.js
blob: aed5ae2bdf12d41122784203395cb37efd804568 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
OC.L10N.register(
    "files_sharing",
    {
    "Shared with others" : "Compartido con otros",
    "Shared with you" : "Compartido contigo",
    "Shared by link" : "Compartido por liga",
    "Nothing shared with you yet" : "Nada ha sido compartido contigo aún",
    "Files and folders others share with you will show up here" : "Los archivos y carpetas que sean compartidos contigo se mostrarán aquí",
    "Nothing shared yet" : "Nada compartido aún",
    "Files and folders you share will show up here" : "Los archivos y carpetas que compartas se mostrarán aquí",
    "No shared links" : "No hay ligas compartidas",
    "Files and folders you share by link will show up here" : "Los archivos y carpetas que compartas por ligas se mostrarán aquí",
    "Download" : "Descargar",
    "You can upload into this folder" : "Puedes cargar archivos dentro de esta carpeta",
    "No compatible server found at {remote}" : "No se encontró un servidor compatible en {remote}",
    "Invalid server URL" : "URL del servidor inválido",
    "Failed to add the public link to your Nextcloud" : "Se presentó una falla al agregar la liga pública a tu Nextcloud",
    "Share" : "Compartir",
    "No expiration date set" : "No se ha establecido la fecha de expiración",
    "Shared by" : "Compartido por",
    "Sharing" : "Compartiendo",
    "File shares" : "Archivos compartidos",
    "Downloaded via public link" : "Descargado mediante una liga pública",
    "Downloaded by {email}" : "Descargado por {email}",
    "{file} downloaded via public link" : "{file} descargado mediante una liga pública",
    "{email} downloaded {file}" : "{email} descargó {file}",
    "Shared with group {group}" : "Compartido con el gupo {group}",
    "Removed share for group {group}" : "Se eliminó el elemento compartido del grupo {group}",
    "{actor} shared with group {group}" : "{actor} compartió con el grupo {group}",
    "{actor} removed share for group {group}" : "{actor} eliminó el elemento compartido del grupo {group}",
    "You shared {file} with group {group}" : "Compartiste {file} con el grupo {group}",
    "You removed group {group} from {file}" : "Eliminaste al grupo {group} de {file}",
    "{actor} shared {file} with group {group}" : "{actor} compartió {file} con el grupo {group}",
    "{actor} removed group {group} from {file}" : "{actor} eliminó el grupo {group} de {file}",
    "Shared as public link" : "Compartido como una liga pública",
    "Removed public link" : "Liga pública eliminada",
    "Public link expired" : "La liga pública ha expirado",
    "{actor} shared as public link" : "{actor} compartió como una liga pública",
    "{actor} removed public link" : "{actor} eliminó la liga pública",
    "Public link of {actor} expired" : "La liga pública de {actor} ha expirado",
    "You shared {file} as public link" : "Compartiste {file} como una liga pública",
    "You removed public link for {file}" : "Eliminaste la liga pública de {file}",
    "Public link expired for {file}" : "La liga pública para {file} ha expirado",
    "{actor} shared {file} as public link" : "{actor} ha compartido {file} como una liga pública",
    "{actor} removed public link for {file}" : "{actor} eliminó la liga pública de {file}",
    "Public link of {actor} for {file} expired" : "La liga pública de {actor} para {file} ha expirado",
    "{user} accepted the remote share" : "{user} aceptó el elemento compartido remoto",
    "{user} declined the remote share" : "{user} declinó el elemento compartido remoto",
    "You received a new remote share {file} from {user}" : "Recibiste un nuevo elemento compartido remoto {file} de {user}",
    "{user} accepted the remote share of {file}" : "{user} aceptó el elemento compartido remoto de {file}",
    "{user} declined the remote share of {file}" : "{user} declinó el elemento compartido remoto de {file}",
    "{user} unshared {file} from you" : "{user} ha dejado de compartir {file} contigo",
    "Shared with {user}" : "Compartido con {user}",
    "Removed share for {user}" : "Se eliminó el elemento compartido para {user}",
    "{actor} shared with {user}" : "{actor} compartió con {user}",
    "{actor} removed share for {user}" : "{actor} eliminó el elemento compartido para {user}",
    "Shared by {actor}" : "Compartido por {actor}",
    "{actor} removed share" : "{actor} eliminó el elemento compartido",
    "You shared {file} with {user}" : "Compartiste {file} con {user}",
    "You removed {user} from {file}" : "Eliminaste a {user} de {file}",
    "{actor} shared {file} with {user}" : "{actor} compartió {file} con {user}",
    "{actor} removed {user} from {file}" : "{actor} eliminó a {user} de {file}",
    "{actor} shared {file} with you" : "{actor} ha compartido {file} contigo",
    "A file or folder shared by mail or by public link was <strong>downloaded</strong>" : "Un archivo o carpeta comparitdo por correo o por liga pública ha sido <strong>descargado</strong>",
    "A file or folder was shared from <strong>another server</strong>" : "Un archivo o carpeta fue compartido desde <strong>otro servidor</strong>",
    "A file or folder has been <strong>shared</strong>" : "Un archivo o carpeta ha sido <strong>compartido</strong>",
    "Wrong share ID, share doesn't exist" : "ID del elemento compartido equivocado, el elemento compartido no existe",
    "could not delete share" : "no fue posible borrar el elemento compartido",
    "Could not delete share" : "No fue posible borrar el elemento compartido",
    "Please specify a file or folder path" : "Por favor especifica un archivo o ruta de carpeta",
    "Wrong path, file/folder doesn't exist" : "La ruta es incorrecta, el correo / carpeta no existe ",
    "Could not create share" : "No fue posible crear el elemento compartido",
    "invalid permissions" : "permisos inválidos",
    "Please specify a valid user" : "Por favor especifica un usuario válido",
    "Group sharing is disabled by the administrator" : "Compartir en grupos está deshabilitado por el administrador",
    "Please specify a valid group" : "Por favor especifica un grupo válido",
    "Public link sharing is disabled by the administrator" : "Compartir ligas públicas está deshabilitado por el administrador",
    "Public upload disabled by the administrator" : "Cargas públicas deshabilitadas por el administrador",
    "Public upload is only possible for publicly shared folders" : "Las cargas públicas son posibles sólo para carpetas compartidas públicamente",
    "Invalid date, date format must be YYYY-MM-DD" : "La fecha es inválida, por favor sigue el formato AAAA-MM-DD",
    "You cannot share to a Circle if the app is not enabled" : "No puedes compartir al Círculo si la aplicación no está habilitada",
    "Please specify a valid circle" : "Por favor especifica un círculo válido",
    "Unknown share type" : "Tipo de elemento compartido desconocido",
    "Not a directory" : "No es una carpeta",
    "Could not lock path" : "No fue posible bloquear la ruta",
    "Wrong or no update parameter given" : "El parametro de actualización está erróneo o falta",
    "Can't change permissions for public share links" : "No es posible cambiar los permisos para ligas públicas compartidas",
    "Cannot increase permissions" : "No es posible incrementar los permisos",
    "shared by %s" : "compartido por %s",
    "Direct link" : "Liga directa",
    "Add to your Nextcloud" : "Agregar a tu Nextcloud",
    "Share API is disabled" : "El API para compartir está deshabilitado",
    "No entries found in this folder" : "No se encontraron elementos en esta carpeta",
    "Name" : "Nombre",
    "Share time" : "Compartido desde",
    "Expiration date" : "Fecha de expiración",
    "Sorry, this link doesn’t seem to work anymore." : "Lo sentimos, parece que esta liga ya no funciona. ",
    "Reasons might be:" : "Las causas podrían ser:",
    "the item was removed" : "el elemento fue eliminado",
    "the link expired" : "la liga expiró",
    "sharing is disabled" : "compartir está deshabilitado",
    "For more info, please ask the person who sent this link." : "Para mayores informes, contacta a la persona que le envió esta liga.",
    "Download %s" : "Descargar %s",
    "Upload files to %s" : "Cargar archivos a %s",
    "Select or drop files" : "Selecciona o suelta los archivos",
    "Uploading files…" : "Cargando archivos...",
    "Uploaded files:" : "Archivos cargados:",
    "{actor} removed you from {file}" : "{actor} lo eliminó de {file}",
    "Sharing %s failed because the back end does not allow shares from type %s" : "Se presentó  una falla al compartir %s, porque el backend no permite elementos compartidos de tipo %s",
    "This share is password-protected" : "Este elemento compartido está protegido con contraseña",
    "The password is wrong. Try again." : "La contraseña es incorrecta. Por favor inténtalo de nuevo.",
    "Password" : "Contraseña"
},
"nplurals=2; plural=(n != 1);");