2013-02-19 15:16:50 -05:00
|
|
|
require_dependency 'discourse_hub'
|
|
|
|
require_dependency 'discourse_updates'
|
|
|
|
|
|
|
|
module Jobs
|
|
|
|
class VersionCheck < Jobs::Base
|
|
|
|
|
|
|
|
def execute(args)
|
2013-02-21 10:19:02 -05:00
|
|
|
if SiteSetting.version_checks
|
2013-03-25 11:35:33 -04: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 10:19:02 -05:00
|
|
|
end
|
2013-02-19 15:16:50 -05:00
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|