diff options
author | Alex Kalderimis <akalderimis@gitlab.com> | 2019-07-21 01:26:19 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2019-07-21 01:26:19 +0000 |
commit | 7320758611b8d8c28fb179f970e015a72357b94d (patch) | |
tree | c74e9e90c6f0fd35f5b3cf08466c2947b39128ca /app/services/wiki_pages | |
parent | 66394bd1b7c98d7a6abbeade068b8b9c1b838ddf (diff) | |
download | gitlab-ce-7320758611b8d8c28fb179f970e015a72357b94d.tar.gz |
Count wiki page creation
This adds a counter to count page creation, which is reflected in the
usage-data we collect.
The number created is stored in Redis, avoiding DB access.
Diffstat (limited to 'app/services/wiki_pages')
-rw-r--r-- | app/services/wiki_pages/base_service.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/services/wiki_pages/base_service.rb b/app/services/wiki_pages/base_service.rb index e259f5bd1bc..b9df690c2b7 100644 --- a/app/services/wiki_pages/base_service.rb +++ b/app/services/wiki_pages/base_service.rb @@ -8,6 +8,12 @@ module WikiPages 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 |