mirror of
https://github.com/discourse/discourse.git
synced 2025-03-22 20:18:53 +08:00
reload the page when read_only mode is disabled
This commit is contained in:
parent
41d16a3657
commit
a8b3269fdb
@ -30,8 +30,13 @@ Discourse.addInitializer(function() {
|
|||||||
|
|
||||||
Discourse.MessageBus.subscribe("/global/read-only", function (enabled) {
|
Discourse.MessageBus.subscribe("/global/read-only", function (enabled) {
|
||||||
Discourse.set("isReadOnly", enabled);
|
Discourse.set("isReadOnly", enabled);
|
||||||
if (enabled && !Discourse.User.currentProp("hideReadOnlyAlert")) {
|
if (enabled) {
|
||||||
bootbox.alert(I18n.t("read_only_mode.enabled"));
|
if (!Discourse.User.currentProp("hideReadOnlyAlert")) {
|
||||||
|
bootbox.alert(I18n.t("read_only_mode.enabled"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// force a reload
|
||||||
|
document.location.reload();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -149,9 +149,13 @@ module BackupRestore
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.after_fork
|
def self.after_fork
|
||||||
|
# reconnect to redis
|
||||||
$redis.client.reconnect
|
$redis.client.reconnect
|
||||||
|
# reconnect the rails cache (uses redis)
|
||||||
Rails.cache.reconnect
|
Rails.cache.reconnect
|
||||||
|
# tells the message we've forked
|
||||||
MessageBus.after_fork
|
MessageBus.after_fork
|
||||||
|
# /!\ HACK /!\ force sidekiq to create a new connection to redis
|
||||||
Sidekiq.instance_variable_set(:@redis, nil)
|
Sidekiq.instance_variable_set(:@redis, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -38,17 +38,13 @@ module Import
|
|||||||
validate_metadata
|
validate_metadata
|
||||||
|
|
||||||
extract_dump
|
extract_dump
|
||||||
|
|
||||||
restore_dump
|
restore_dump
|
||||||
|
|
||||||
#----------- CRITICAL --------------
|
|
||||||
switch_schema!
|
switch_schema!
|
||||||
#----------- CRITICAL --------------
|
|
||||||
|
|
||||||
log "Finalizing restore..."
|
# TOFIX: MessageBus is busted...
|
||||||
|
|
||||||
migrate_database
|
migrate_database
|
||||||
|
|
||||||
reconnect_database
|
reconnect_database
|
||||||
|
|
||||||
extract_uploads
|
extract_uploads
|
||||||
@ -268,10 +264,10 @@ module Import
|
|||||||
def rollback
|
def rollback
|
||||||
log "Trying to rollback..."
|
log "Trying to rollback..."
|
||||||
if BackupRestore.can_rollback?
|
if BackupRestore.can_rollback?
|
||||||
log "Rolling back to previous working state..."
|
log "Rolling back..."
|
||||||
BackupRestore.rename_schema("backup", "public")
|
BackupRestore.rename_schema("backup", "public")
|
||||||
else
|
else
|
||||||
log "No backup schema was created yet!"
|
log "There was no need to rollback"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user