Version checks include the branch

This commit is contained in:
Neil Lalonde 2014-09-09 17:04:10 -04:00
parent b2460d7395
commit 19cba7bb0f
2 changed files with 11 additions and 2 deletions

View File

@ -201,6 +201,16 @@ module Discourse
end end
end end
def self.git_branch
return $git_branch if $git_branch
begin
$git_branch ||= `git rev-parse --abbrev-ref HEAD`.strip
rescue
$git_branch = "unknown"
end
end
# Either returns the site_contact_username user or the first admin. # Either returns the site_contact_username user or the first admin.
def self.site_contact_user def self.site_contact_user
user = User.find_by(username_lower: SiteSetting.site_contact_username.downcase) if SiteSetting.site_contact_username.present? user = User.find_by(username_lower: SiteSetting.site_contact_username.downcase) if SiteSetting.site_contact_username.present?

View File

@ -6,10 +6,9 @@ module DiscourseHub
def self.version_check_payload def self.version_check_payload
{ {
installed_version: Discourse::VERSION::STRING installed_version: Discourse::VERSION::STRING
} }.merge!( Discourse.git_branch == "unknown" ? {} : {branch: Discourse.git_branch})
end end
def self.discourse_version_check def self.discourse_version_check
get('/version_check', version_check_payload) get('/version_check', version_check_payload)
end end