debian-mirror-gitlab/lib/gitlab/pages_transfer.rb

39 lines
888 B
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
2020-11-24 15:15:51 +05:30
# To make a call happen in a new Sidekiq job, add `.async` before the call. For
# instance:
#
# PagesTransfer.new.async.move_namespace(...)
#
2017-08-17 22:00:37 +05:30
module Gitlab
class PagesTransfer < ProjectTransfer
2021-03-11 19:13:27 +05:30
METHODS = %w[move_namespace move_project rename_project rename_namespace].freeze
2020-11-24 15:15:51 +05:30
2021-03-11 19:13:27 +05:30
class Async
2020-11-24 15:15:51 +05:30
METHODS.each do |meth|
define_method meth do |*args|
2021-03-11 19:13:27 +05:30
next unless Feature.enabled?(:pages_update_legacy_storage, default_enabled: true)
2020-11-24 15:15:51 +05:30
PagesTransferWorker.perform_async(meth, args)
end
end
end
2021-03-11 19:13:27 +05:30
METHODS.each do |meth|
define_method meth do |*args|
next unless Feature.enabled?(:pages_update_legacy_storage, default_enabled: true)
super(*args)
end
end
2020-11-24 15:15:51 +05:30
def async
@async ||= Async.new
end
2017-08-17 22:00:37 +05:30
def root_dir
Gitlab.config.pages.path
end
end
end