Skip to content
Snippets Groups Projects
Commit 5308b51e authored by Ahmad Hassan's avatar Ahmad Hassan
Browse files

Output done for wiki and repo

parent 69de7b42
No related branches found
No related tags found
1 merge request!10495Merge Requests - Assignee
Loading
Loading
@@ -4,7 +4,6 @@ require_relative 'helper'
module Backup
class Repository
include Backup::Helper
# rubocop:disable Metrics/AbcSize
 
attr_reader :progress
 
Loading
Loading
@@ -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)
Loading
Loading
@@ -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
 
Loading
Loading
@@ -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, "..")]
Loading
Loading
@@ -223,7 +216,6 @@ module Backup
end
end
end
# rubocop:enable Metrics/AbcSize
 
protected
 
Loading
Loading
@@ -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
 
Loading
Loading
@@ -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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment