summaryrefslogtreecommitdiff
path: root/app/services/pages/delete_service.rb
blob: f7d3d70aad6d1f43eed65f1f20e52f3448ed8227 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

module Pages
  class DeleteService < BaseService
    def execute
      project.mark_pages_as_not_deployed

      # project.pages_domains.delete_all will just nullify project_id:
      # > If no :dependent option is given, then it will follow the default
      # > strategy for `has_many :through` associations.
      # > The default strategy is :nullify which sets the foreign keys to NULL.
      PagesDomain.for_project(project).delete_all

      DestroyPagesDeploymentsWorker.perform_async(project.id)

      # TODO: remove this call https://gitlab.com/gitlab-org/gitlab/-/issues/320775
      PagesRemoveWorker.perform_async(project.id) if ::Settings.pages.local_store.enabled
    end
  end
end