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
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
1 deletion
+18
-1
namespace.rb
app/models/namespace.rb
+8
-1
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
...
@@ -99,7 +99,14 @@ class Namespace < ActiveRecord::Base
...
@@ -99,7 +99,14 @@ class Namespace < ActiveRecord::Base
end
end
def
rm_dir
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
end
def
move_dir
def
move_dir
...
...
app/services/delete_user_service.rb
View file @
1edff534
...
@@ -4,6 +4,11 @@ class DeleteUserService
...
@@ -4,6 +4,11 @@ class DeleteUserService
user
.
errors
[
:base
]
<<
'You must transfer ownership or delete groups before you can remove user'
user
.
errors
[
:base
]
<<
'You must transfer ownership or delete groups before you can remove user'
user
user
else
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
user
.
destroy
end
end
end
end
...
...
app/services/destroy_group_service.rb
View file @
1edff534
...
@@ -6,6 +6,11 @@ class DestroyGroupService
...
@@ -6,6 +6,11 @@ class DestroyGroupService
end
end
def
execute
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
@group
.
destroy
end
end
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