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

module WikiPages
  class BaseService < ::BaseService
    private

    def execute_hooks(page, action = 'create')
      page_data = Gitlab::DataBuilder::WikiPage.build(page, current_user, action)
      @project.execute_hooks(page_data, :wiki_page_hooks)
      @project.execute_services(page_data, :wiki_page_hooks)
      increment_usage(action)
    end

    # This method throws an error if the action is an unanticipated value.
    def increment_usage(action)
      Gitlab::UsageDataCounters::WikiPageCounter.count(action)
    end
  end
end