BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
1edff534
Unverified
Commit
1edff534
authored
Jun 03, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove projects before group/user. Remove namespace directory async
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
61cfd1d2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
2 deletions
+19
-2
namespace.rb
app/models/namespace.rb
+9
-2
delete_user_service.rb
app/services/delete_user_service.rb
+5
-0
destroy_group_service.rb
app/services/destroy_group_service.rb
+5
-0
No files found.
app/models/namespace.rb
View file @
1edff534
...
...
@@ -72,7 +72,7 @@ class Namespace < ActiveRecord::Base
path
.
gsub!
(
/[^a-zA-Z0-9_\-\.]/
,
""
)
# Users with the great usernames of "." or ".." would end up with a blank username.
# Work around that by setting their username to "blank", followed by a counter.
# Work around that by setting their username to "blank", followed by a counter.
path
=
"blank"
if
path
.
blank?
counter
=
0
...
...
@@ -99,7 +99,14 @@ class Namespace < ActiveRecord::Base
end
def
rm_dir
gitlab_shell
.
rm_namespace
(
path
)
# Move namespace directory into trash.
# We will remove it later async
new_path
=
"
#{
path
}
+
#{
id
}
+deleted"
gitlab_shell
.
mv_namespace
(
path
,
new_path
)
# Remove namespace directroy async with delay so
# GitLab has time to remove all projects first
GitlabShellWorker
.
perform_in
(
5
.
minutes
,
:rm_namespace
,
new_path
)
end
def
move_dir
...
...
app/services/delete_user_service.rb
View file @
1edff534
...
...
@@ -4,6 +4,11 @@ class DeleteUserService
user
.
errors
[
:base
]
<<
'You must transfer ownership or delete groups before you can remove user'
user
else
# TODO: Skip remove repository so Namespace#rm_dir works
user
.
personal_projects
.
each
do
|
project
|
::
Projects
::
DestroyService
.
new
(
project
,
current_user
,
{}).
execute
end
user
.
destroy
end
end
...
...
app/services/destroy_group_service.rb
View file @
1edff534
...
...
@@ -6,6 +6,11 @@ class DestroyGroupService
end
def
execute
# TODO: Skip remove repository so Namespace#rm_dir works
@group
.
projects
.
each
do
|
project
|
::
Projects
::
DestroyService
.
new
(
project
,
current_user
,
{}).
execute
end
@group
.
destroy
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment