2018-07-18 12:03:33 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-02-28 02:26:52 -05:00
|
|
|
module WikiPages
|
|
|
|
class BaseService < ::BaseService
|
|
|
|
private
|
|
|
|
|
|
|
|
def execute_hooks(page, action = 'create')
|
2017-07-20 11:12:06 -04:00
|
|
|
page_data = Gitlab::DataBuilder::WikiPage.build(page, current_user, action)
|
2016-02-28 02:26:52 -05:00
|
|
|
@project.execute_hooks(page_data, :wiki_page_hooks)
|
|
|
|
@project.execute_services(page_data, :wiki_page_hooks)
|
2019-07-20 21:26:19 -04:00
|
|
|
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)
|
2016-02-28 02:26:52 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-09-13 09:26:31 -04:00
|
|
|
|
|
|
|
WikiPages::BaseService.prepend_if_ee('EE::WikiPages::BaseService')
|