Commit fbe03c506ff5e5714f4feacc33e42c5d4931dbbc
1 parent
be942d74
Exists in
master
and in
4 other branches
Improved namespace activation task
Showing
1 changed file
with
27 additions
and
0 deletions
Show diff stats
lib/tasks/gitlab/activate_namespaces.rake
@@ -13,5 +13,32 @@ namespace :gitlab do | @@ -13,5 +13,32 @@ namespace :gitlab do | ||
13 | end | 13 | end |
14 | end | 14 | end |
15 | end | 15 | end |
16 | + | ||
17 | + Group.find_each(batch_size: 500) do |group| | ||
18 | + if group.ensure_dir_exist | ||
19 | + print '.'.green | ||
20 | + else | ||
21 | + print 'F'.red | ||
22 | + end | ||
23 | + end | ||
24 | + | ||
25 | + git_path = Gitlab.config.git_base_path | ||
26 | + | ||
27 | + Project.where('namespace_id IS NOT NULL').find_each(batch_size: 500) do |project| | ||
28 | + next unless project.group | ||
29 | + | ||
30 | + group = project.group | ||
31 | + | ||
32 | + next if File.exists?(File.join(git_path, project.path_with_namespace)) | ||
33 | + | ||
34 | + next unless File.exists?(File.join(git_path, project.path)) | ||
35 | + | ||
36 | + begin | ||
37 | + Gitlab::ProjectMover.new(project, '', group.path).execute | ||
38 | + print '.'.green | ||
39 | + rescue | ||
40 | + print 'F'.red | ||
41 | + end | ||
42 | + end | ||
16 | end | 43 | end |
17 | end | 44 | end |