reload the page when read_only mode is disabled

This commit is contained in:
Régis Hanol 2014-02-14 00:27:25 +01:00
parent 41d16a3657
commit a8b3269fdb
3 changed files with 14 additions and 9 deletions

View File

@ -30,8 +30,13 @@ Discourse.addInitializer(function() {
Discourse.MessageBus.subscribe("/global/read-only", function (enabled) {
Discourse.set("isReadOnly", enabled);
if (enabled && !Discourse.User.currentProp("hideReadOnlyAlert")) {
bootbox.alert(I18n.t("read_only_mode.enabled"));
if (enabled) {
if (!Discourse.User.currentProp("hideReadOnlyAlert")) {
bootbox.alert(I18n.t("read_only_mode.enabled"));
}
} else {
// force a reload
document.location.reload();
}
});

View File

@ -149,9 +149,13 @@ module BackupRestore
end
def self.after_fork
# reconnect to redis
$redis.client.reconnect
# reconnect the rails cache (uses redis)
Rails.cache.reconnect
# tells the message we've forked
MessageBus.after_fork
# /!\ HACK /!\ force sidekiq to create a new connection to redis
Sidekiq.instance_variable_set(:@redis, nil)
end

View File

@ -38,17 +38,13 @@ module Import
validate_metadata
extract_dump
restore_dump
#----------- CRITICAL --------------
switch_schema!
#----------- CRITICAL --------------
log "Finalizing restore..."
# TOFIX: MessageBus is busted...
migrate_database
reconnect_database
extract_uploads
@ -268,10 +264,10 @@ module Import
def rollback
log "Trying to rollback..."
if BackupRestore.can_rollback?
log "Rolling back to previous working state..."
log "Rolling back..."
BackupRestore.rename_schema("backup", "public")
else
log "No backup schema was created yet!"
log "There was no need to rollback"
end
end