BUGFIX: backup/restore operations keep track of the read-only mode status

This commit is contained in:
Régis Hanol 2014-03-28 12:15:53 +01:00
parent e23e92647e
commit d23585e444
2 changed files with 6 additions and 0 deletions

View File

@ -79,6 +79,7 @@ module Export
@archive_directory = File.join(Rails.root, "public", "backups", @current_db)
@archive_basename = File.join(@archive_directory, "#{SiteSetting.title.parameterize}-#{@timestamp}")
@logs = []
@readonly_mode_was_enabled = Discourse.readonly_mode?
end
def listen_for_shutdown_signal
@ -96,6 +97,7 @@ module Export
end
def enable_readonly_mode
return if @readonly_mode_was_enabled
log "Enabling readonly mode..."
Discourse.enable_readonly_mode
end
@ -293,6 +295,7 @@ module Export
end
def disable_readonly_mode
return if @readonly_mode_was_enabled
log "Disabling readonly mode..."
Discourse.disable_readonly_mode
end

View File

@ -95,6 +95,7 @@ module Import
@meta_filename = File.join(@tmp_directory, BackupRestore::METADATA_FILE)
@dump_filename = File.join(@tmp_directory, BackupRestore::DUMP_FILE)
@logs = []
@readonly_mode_was_enabled = Discourse.readonly_mode?
end
def listen_for_shutdown_signal
@ -112,6 +113,7 @@ module Import
end
def enable_readonly_mode
return if @readonly_mode_was_enabled
log "Enabling readonly mode..."
Discourse.enable_readonly_mode
end
@ -302,6 +304,7 @@ module Import
end
def disable_readonly_mode
return if @readonly_mode_was_enabled
log "Disabling readonly mode..."
Discourse.disable_readonly_mode
end