2018-11-17 00:37:17 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-02-12 15:38:10 +00:00
|
|
|
module Gitlab
|
|
|
|
module ImportExport
|
|
|
|
class WikiRestorer < RepoRestorer
|
|
|
|
def initialize(project:, shared:, path_to_bundle:, wiki_enabled:)
|
|
|
|
super(project: project, shared: shared, path_to_bundle: path_to_bundle)
|
|
|
|
|
2019-09-27 09:06:26 +00:00
|
|
|
@project = project
|
2018-02-12 15:38:10 +00:00
|
|
|
@wiki_enabled = wiki_enabled
|
|
|
|
end
|
|
|
|
|
|
|
|
def restore
|
2019-09-27 09:06:26 +00:00
|
|
|
project.wiki if create_empty_wiki?
|
2018-02-12 15:38:10 +00:00
|
|
|
|
|
|
|
super
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2019-09-27 09:06:26 +00:00
|
|
|
attr_accessor :project, :wiki_enabled
|
|
|
|
|
2018-02-12 15:38:10 +00:00
|
|
|
def create_empty_wiki?
|
2019-09-27 09:06:26 +00:00
|
|
|
!File.exist?(path_to_bundle) && wiki_enabled
|
2018-02-12 15:38:10 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|