gitlab-org--gitlab-foss/lib/gitlab/pages_transfer.rb

38 lines
888 B
Ruby

# frozen_string_literal: true
# To make a call happen in a new Sidekiq job, add `.async` before the call. For
# instance:
#
# PagesTransfer.new.async.move_namespace(...)
#
module Gitlab
class PagesTransfer < ProjectTransfer
METHODS = %w[move_namespace move_project rename_project rename_namespace].freeze
class Async
METHODS.each do |meth|
define_method meth do |*args|
next unless Feature.enabled?(:pages_update_legacy_storage, default_enabled: true)
PagesTransferWorker.perform_async(meth, args)
end
end
end
METHODS.each do |meth|
define_method meth do |*args|
next unless Feature.enabled?(:pages_update_legacy_storage, default_enabled: true)
super(*args)
end
end
def async
@async ||= Async.new
end
def root_dir
Gitlab.config.pages.path
end
end
end