summaryrefslogtreecommitdiff
path: root/lib/backup
diff options
context:
space:
mode:
authorAhmad Hassan <ahmad.hassan612@gmail.com>2018-06-18 16:42:39 +0200
committerAhmad Hassan <ahmad.hassan612@gmail.com>2018-06-19 16:24:16 +0200
commit5308b51ef43dceb3832edb4156bf3ece51099b67 (patch)
treea655a9cb75a215888a35b0ee58c1fa923cbb377c /lib/backup
parent69de7b42cf7d3f0c99d63f1778f7f0b9d15ddfd8 (diff)
downloadgitlab-ce-5308b51ef43dceb3832edb4156bf3ece51099b67.tar.gz
Output done for wiki and repo
Diffstat (limited to 'lib/backup')
-rw-r--r--lib/backup/repository.rb17
1 files changed, 3 insertions, 14 deletions
diff --git a/lib/backup/repository.rb b/lib/backup/repository.rb
index 127c2477810..605a913cc6f 100644
--- a/lib/backup/repository.rb
+++ b/lib/backup/repository.rb
@@ -4,7 +4,6 @@ require_relative 'helper'
module Backup
class Repository
include Backup::Helper
- # rubocop:disable Metrics/AbcSize
attr_reader :progress
@@ -16,7 +15,6 @@ module Backup
prepare
Project.find_each(batch_size: 1000) do |project|
- # Create namespace dir or hashed path if missing
progress.print " * #{display_repo_path(project)} ... "
if project.hashed_storage?(:repository)
@@ -27,22 +25,19 @@ module Backup
if !empty_repo?(project)
backup_project(project)
+ progress.puts "[DONE]".color(:green)
else
progress.puts "[SKIPPED]".color(:cyan)
end
wiki = ProjectWiki.new(project)
- path_to_wiki_repo = Gitlab::GitalyClient::StorageSettings.allow_disk_access do
- path_to_repo(wiki)
- end
- if File.exist?(path_to_wiki_repo) && !empty_repo?(wiki)
+ if !empty_repo?(wiki)
backup_project(wiki)
+ progress.puts "[DONE] Wiki".color(:green)
else
progress.puts "[SKIPPED] Wiki".color(:cyan)
end
-
- progress.puts "[DONE]".color(:green)
end
end
@@ -100,8 +95,6 @@ module Backup
path = repository_storage.legacy_disk_path
return unless File.exist?(path)
- # Move all files in the existing repos directory except . and .. to
- # repositories.old.<timestamp> directory
bk_repos_path = File.join(Gitlab.config.backup.path, "tmp", "#{name}-repositories.old." + Time.now.to_i.to_s)
FileUtils.mkdir_p(bk_repos_path, mode: 0700)
files = Dir.glob(File.join(path, "*"), File::FNM_DOTMATCH) - [File.join(path, "."), File.join(path, "..")]
@@ -223,7 +216,6 @@ module Backup
end
end
end
- # rubocop:enable Metrics/AbcSize
protected
@@ -261,9 +253,7 @@ module Backup
def prepare
FileUtils.rm_rf(backup_repos_path)
- # Ensure the parent dir of backup_repos_path exists
FileUtils.mkdir_p(Gitlab.config.backup.path)
- # Fail if somebody raced to create backup_repos_path before us
FileUtils.mkdir(backup_repos_path, mode: 0700)
end
@@ -279,7 +269,6 @@ module Backup
end
def empty_repo?(project_or_wiki)
- # Protect against stale caches
project_or_wiki.repository.expire_emptiness_caches
project_or_wiki.repository.empty?
end