summaryrefslogtreecommitdiff
path: root/app/services/wiki_pages
diff options
context:
space:
mode:
authorAlex Kalderimis <akalderimis@gitlab.com>2019-07-21 01:26:19 +0000
committerDouwe Maan <douwe@gitlab.com>2019-07-21 01:26:19 +0000
commit7320758611b8d8c28fb179f970e015a72357b94d (patch)
treec74e9e90c6f0fd35f5b3cf08466c2947b39128ca /app/services/wiki_pages
parent66394bd1b7c98d7a6abbeade068b8b9c1b838ddf (diff)
downloadgitlab-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.rb6
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