mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
Initial release of Discourse
This commit is contained in:
35
lib/export/export.rb
Normal file
35
lib/export/export.rb
Normal file
@ -0,0 +1,35 @@
|
||||
module Export
|
||||
|
||||
class UnsupportedExportSource < RuntimeError; end
|
||||
class FormatInvalidError < RuntimeError; end
|
||||
class FilenameMissingError < RuntimeError; end
|
||||
class ExportInProgressError < RuntimeError; end
|
||||
|
||||
def self.current_schema_version
|
||||
ActiveRecord::Migrator.current_version.to_s
|
||||
end
|
||||
|
||||
def self.models_included_in_export
|
||||
@models_included_in_export ||= begin
|
||||
Rails.application.eager_load! # So that all models get loaded now
|
||||
ActiveRecord::Base.descendants
|
||||
end
|
||||
end
|
||||
|
||||
def self.export_running_key
|
||||
'exporter_is_running'
|
||||
end
|
||||
|
||||
def self.is_export_running?
|
||||
$redis.get(export_running_key) == '1'
|
||||
end
|
||||
|
||||
def self.set_export_started
|
||||
$redis.set export_running_key, '1'
|
||||
end
|
||||
|
||||
def self.set_export_is_not_running
|
||||
$redis.del export_running_key
|
||||
end
|
||||
|
||||
end
|
Reference in New Issue
Block a user