summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorJacopo <beschi.jacopo@gmail.com>2018-12-13 20:26:56 +0100
committerJacopo <beschi.jacopo@gmail.com>2019-02-27 11:52:35 +0100
commit5ae9a44aa17c8929627cc450f936cd960c143e25 (patch)
tree6a14d388f5687979a683d443868b4297ebc6838c /app/controllers
parent6fa88ed77e1693cda845efe49bf2c9a77aed2e4f (diff)
downloadgitlab-ce-5ae9a44aa17c8929627cc450f936cd960c143e25.tar.gz
Add project http fetch statistics API
The API get projects/:id/traffic/fetches allows user with write access to the repository to get the number of clones for the last 30 days.
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/projects/git_http_controller.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/controllers/projects/git_http_controller.rb b/app/controllers/projects/git_http_controller.rb
index 30e436365de..0c5328fc941 100644
--- a/app/controllers/projects/git_http_controller.rb
+++ b/app/controllers/projects/git_http_controller.rb
@@ -20,6 +20,8 @@ class Projects::GitHttpController < Projects::GitHttpClientController
# POST /foo/bar.git/git-upload-pack (git pull)
def git_upload_pack
+ enqueue_fetch_statistics_update
+
render_ok
end
@@ -67,6 +69,13 @@ class Projects::GitHttpController < Projects::GitHttpClientController
render plain: exception.message, status: :service_unavailable
end
+ def enqueue_fetch_statistics_update
+ return if wiki?
+ return unless project.daily_statistics_enabled?
+
+ ProjectDailyStatisticsWorker.perform_async(project.id)
+ end
+
def access
@access ||= access_klass.new(access_actor, project,
'http', authentication_abilities: authentication_abilities,