2013-02-20 04:16:50 +08:00
|
|
|
require_dependency 'discourse_hub'
|
|
|
|
require_dependency 'discourse_updates'
|
|
|
|
|
|
|
|
module Jobs
|
|
|
|
class VersionCheck < Jobs::Base
|
|
|
|
|
|
|
|
def execute(args)
|
2013-02-21 23:19:02 +08:00
|
|
|
if SiteSetting.version_checks
|
2013-03-25 23:35:33 +08:00
|
|
|
begin
|
|
|
|
json = DiscourseHub.discourse_version_check
|
|
|
|
DiscourseUpdates.latest_version = json['latestVersion']
|
|
|
|
DiscourseUpdates.critical_updates_available = json['criticalUpdates']
|
|
|
|
DiscourseUpdates.missing_versions_count = json['missingVersionsCount']
|
|
|
|
rescue => e
|
|
|
|
raise e unless Rails.env == 'development' # Fail version check silently in development mode
|
|
|
|
end
|
2013-02-21 23:19:02 +08:00
|
|
|
end
|
2013-02-20 04:16:50 +08:00
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|