mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 14:22:40 +08:00
This reverts commit 8e10878e1a37a608b0e1705bf9d0a06a295b8a63. Something is broken on a friday so reverting first before I pick this up again next Monday.
This commit is contained in:

committed by
GitHub

parent
8b963986b3
commit
92d7d24d0f
@ -4,7 +4,6 @@ require "cache"
|
||||
require "open3"
|
||||
require "plugin/instance"
|
||||
require "version"
|
||||
require "git_utils"
|
||||
|
||||
module Discourse
|
||||
DB_POST_MIGRATE_PATH ||= "db/post_migrate"
|
||||
@ -830,23 +829,42 @@ module Discourse
|
||||
end
|
||||
|
||||
def self.git_version
|
||||
@git_version ||= GitUtils.git_version
|
||||
@git_version ||=
|
||||
begin
|
||||
git_cmd = "git rev-parse HEAD"
|
||||
self.try_git(git_cmd, Discourse::VERSION::STRING)
|
||||
end
|
||||
end
|
||||
|
||||
def self.git_branch
|
||||
@git_branch ||= GitUtils.git_branch
|
||||
@git_branch ||=
|
||||
self.try_git("git branch --show-current", nil) ||
|
||||
self.try_git("git config user.discourse-version", "unknown")
|
||||
end
|
||||
|
||||
def self.full_version
|
||||
@full_version ||= GitUtils.full_version
|
||||
@full_version ||=
|
||||
begin
|
||||
git_cmd = 'git describe --dirty --match "v[0-9]*" 2> /dev/null'
|
||||
self.try_git(git_cmd, "unknown")
|
||||
end
|
||||
end
|
||||
|
||||
def self.last_commit_date
|
||||
@last_commit_date ||= GitUtils.last_commit_date
|
||||
@last_commit_date ||=
|
||||
begin
|
||||
git_cmd = 'git log -1 --format="%ct"'
|
||||
seconds = self.try_git(git_cmd, nil)
|
||||
seconds.nil? ? nil : DateTime.strptime(seconds, "%s")
|
||||
end
|
||||
end
|
||||
|
||||
def self.try_git(git_cmd, default_value)
|
||||
GitUtils.try_git(git_cmd, default_value)
|
||||
begin
|
||||
`#{git_cmd}`.strip
|
||||
rescue StandardError
|
||||
default_value
|
||||
end.presence || default_value
|
||||
end
|
||||
|
||||
# Either returns the site_contact_username user or the first admin.
|
||||
|
Reference in New Issue
Block a user