Commit Graph
14 Commits
Author SHA1 Message Date
a4bfef265d Move db related basic functions to models/db (#17075)
* Move db related basic functions to models/db

* Fix lint

* Fix lint

* Fix test

* Fix lint

* Fix lint

* revert unnecessary change

* Fix test

* Fix wrong replace string

* Use *Context

* Correct committer spelling and fix wrong replaced words

Co-authored-by: zeripath <[email protected]>
2021-09-19 19:49:59 +08:00
Lunny XiaoandGitHub e2f0ab3343 Add doctor dbconsistency check for release and attachment (#16978) 2021-09-14 20:41:40 +01:00
Lunny XiaoandGitHub a807031a30 Fix storage Iterate bug and Add storage doctor to delete garbage attachments (#16971)
* Fix storage Iterate bug and Add storage doctor to delete garbage attachments

* Close object when used
2021-09-06 16:46:20 +02:00
zeripathandGitHub 1ce4fb256f Restore creation of git-daemon-export-ok files (#16508)
Somewhere along the line the creation of git-daemon-export-ok
files disappeared but the updating of these files when
repo visibility changes remained. The problem is that the
current state will create files even when the org or user
is private.

This PR restores creation correctly.

Fix #15521

Signed-off-by: Andrew Thornton <[email protected]>
2021-07-22 12:53:54 +01:00
b223d36195 Rework repository archive (#14723)
* Use storage to store archive files

* Fix backend lint

* Add archiver table on database

* Finish archive download

* Fix test

* Add database migrations

* Add status for archiver

* Fix lint

* Add queue

* Add doctor to check and delete old archives

* Improve archive queue

* Fix tests

* improve archive storage

* Delete repo archives

* Add missing fixture

* fix fixture

* Fix fixture

* Fix test

* Fix archiver cleaning

* Fix bug

* Add docs for repository archive storage

* remove repo-archive configuration

* Fix test

* Fix test

* Fix lint

Co-authored-by: 6543 <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
2021-06-23 17:12:38 -04:00
John OlheiserandGitHub 2f65c6b2f0 Add err to log (#15813)
Signed-off-by: jolheiser <[email protected]>
2021-05-10 20:48:23 +01:00
ee3fb92419 Delete references if repository gets deleted (#15681)
* Remove DeletedBranch and LFSLocks.

* Sort beans.

Co-authored-by: zeripath <[email protected]>
2021-04-30 21:10:39 +02:00
KN4CK3RandGitHub 2e85165349 Delete protected branch if repository gets removed (#15658)
* Added missing error parameters.

* Delete protected branch if repository gets removed.

* Added doctor fix.
2021-04-30 00:48:52 +02:00
6543andGitHub a3a65137ba Delete Labels & IssueLabels on Repo Delete too (#15039)
* Doctor: find IssueLabels without existing label

* on Repo Delete: delete labels & issue_labels too

* performance nits

* Add Migration: Delete orphaned IssueLabels

* Migration v174: use Sync2

* USE sess !!!

* better func name

* code format & comment

* RAW SQL

* Update models/migrations/v176.go

* next try?
2021-03-19 21:01:24 +02:00
dace0ce1b1 Prevent addition of labels from outside the repository or organisation in issues (#14912)
* Never add labels not from this repository or organisation and remove org labels on transfer

Prevent the addition of labels from outside of the repository or
organisation and remove organisation labels on transfer.

Related #14908

Signed-off-by: Andrew Thornton <[email protected]>

* switch to use sql

Signed-off-by: Andrew Thornton <[email protected]>

* remove AS

Signed-off-by: Andrew Thornton <[email protected]>

* subquery alias

Signed-off-by: Andrew Thornton <[email protected]>

* Give me some AS?

Signed-off-by: Andrew Thornton <[email protected]>

* double AS

Signed-off-by: Andrew Thornton <[email protected]>

* try try again

Signed-off-by: Andrew Thornton <[email protected]>

* once more around the merry go round

Signed-off-by: Andrew Thornton <[email protected]>

* fix api problem

Signed-off-by: Andrew Thornton <[email protected]>

* Add outside label consistency check into doctor

This PR adds another consistency check into doctor in order to detect
labels that have been added from outside of repositories and organisations

Fix #14908

Signed-off-by: Andrew Thornton <[email protected]>

* fix migration

Signed-off-by: Andrew Thornton <[email protected]>

* prep for merge

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: 6543 <[email protected]>
Co-authored-by: Lauris BH <[email protected]>
2021-03-19 21:25:14 +08:00
070c57867d Fix postgres ID sequences broken by recreate-table (#15015)
* Fix postgres ID sequences broken by recreate-table

Unfortunately there is a subtle problem with recreatetable on postgres which
leads to the sequences not being renamed and not being left at 0.

Fix #14725

Signed-off-by: Andrew Thornton <[email protected]>

* let us try information_schema instead

Signed-off-by: Andrew Thornton <[email protected]>

* try again

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: techknowlogick <[email protected]>
Co-authored-by: 6543 <[email protected]>
2021-03-18 02:06:40 -04:00
f82b1dd7c3 Prevent adding nil label to .AddedLabels or .RemovedLabels (#14623)
* Prevent adding nil label to .AddedLabels or .RemovedLabels

There are possibly a few old databases out there with malmigrated data that can
cause panics with empty labels being migrated.

This PR adds a few tests to prevent nil labels being added.

Fix #14466

Signed-off-by: Andrew Thornton <[email protected]>

* Add doctor command to remove the broken label comments

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: 6543 <[email protected]>
2021-02-10 10:50:44 +08:00
6543andGitHub 0e0424c8ec Add Doctor FixWrongUserType (#14522)
* Add Doctor FixWrongUserType

* use NoAutoTime
2021-01-29 19:30:43 +01:00
4569339a4b Refactor doctor (#12264)
* Refactor Logger

Refactor Logger to make a logger interface and make it possible to
wrap loggers for specific purposes.

* Refactor Doctor

    Move the gitea doctor functions into its own module.
    Use a logger for its messages instead of returning a results string[]

Signed-off-by: Andrew Thornton <[email protected]>

* Update modules/doctor/misc.go

Co-authored-by: 6543 <[email protected]>

* Update modules/doctor/misc.go

Co-authored-by: 6543 <[email protected]>

Co-authored-by: 6543 <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
2020-12-02 06:56:04 +02:00