mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Raise an error if metadata is not extracted correctly.
This commit is contained in:
parent
5da768b4fe
commit
7e80810de1
@ -201,7 +201,9 @@ module BackupRestore
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
Oj.load_file(@meta_filename)
|
data = Oj.load_file(@meta_filename)
|
||||||
|
raise "Failed to load metadata file." if !data
|
||||||
|
data
|
||||||
else
|
else
|
||||||
if @filename =~ /-#{BackupRestore::VERSION_PREFIX}(\d{14})/
|
if @filename =~ /-#{BackupRestore::VERSION_PREFIX}(\d{14})/
|
||||||
{ "version" => Regexp.last_match[1].to_i }
|
{ "version" => Regexp.last_match[1].to_i }
|
||||||
@ -214,6 +216,9 @@ module BackupRestore
|
|||||||
def validate_metadata
|
def validate_metadata
|
||||||
log "Validating metadata..."
|
log "Validating metadata..."
|
||||||
log " Current version: #{@current_version}"
|
log " Current version: #{@current_version}"
|
||||||
|
|
||||||
|
raise "Metadata has not been extracted correctly." if !@metadata
|
||||||
|
|
||||||
log " Restored version: #{@metadata["version"]}"
|
log " Restored version: #{@metadata["version"]}"
|
||||||
|
|
||||||
error = "You're trying to restore a more recent version of the schema. You should migrate first!"
|
error = "You're trying to restore a more recent version of the schema. You should migrate first!"
|
||||||
|
Loading…
Reference in New Issue
Block a user