Allow restoring from backups in development mode even if the setting is

off.
This commit is contained in:
Robin Ward 2014-08-28 17:02:26 -04:00
parent 464a922910
commit 9e2c72e277
5 changed files with 8 additions and 13 deletions

View File

@ -9,7 +9,7 @@ export default Ember.ArrayController.extend({
restoreDisabled: Em.computed.alias("status.restoreDisabled"),
restoreTitle: function() {
if (!Discourse.SiteSettings.allow_restore) {
if (!this.get('status.allowRestore')) {
return I18n.t("admin.backups.operations.restore.is_disabled");
} else if (this.get("status.isOperationRunning")) {
return I18n.t("admin.backups.operation_already_running");

View File

@ -1,16 +1,9 @@
/**
Data model for representing the status of backup/restore
@class BackupStatus
@extends Discourse.Model
@namespace Discourse
@module Discourse
**/
Discourse.BackupStatus = Discourse.Model.extend({
restoreDisabled: Em.computed.not("restoreEnabled"),
restoreEnabled: function() {
return Discourse.SiteSettings.allow_restore && !this.get("isOperationRunning");
}.property("isOperationRunning")
return this.get('allowRestore') && !this.get("isOperationRunning");
}.property("isOperationRunning", "allowRestore")
});

View File

@ -31,7 +31,8 @@ Discourse.AdminBackupsRoute = Discourse.Route.extend({
}).then(function (status) {
return Discourse.BackupStatus.create({
isOperationRunning: status.is_operation_running,
canRollback: status.can_rollback
canRollback: status.can_rollback,
allowRestore: status.allow_restore
});
});
},

View File

@ -628,7 +628,7 @@ legal:
backups:
allow_restore:
client: true
client: false
default: false
maximum_backups:
client: true

View File

@ -56,6 +56,7 @@ module BackupRestore
{
is_operation_running: is_operation_running?,
can_rollback: can_rollback?,
allow_restore: Rails.env.development? || SiteSetting.allow_restore
}
end