From 7340aceddb963a8b911162c08097f76b6eb1ef84 Mon Sep 17 00:00:00 2001 From: shreyas Date: Thu, 3 Nov 2016 16:11:23 +0530 Subject: [PATCH] [Fix] Set default backup limit for sites which are not set --- frappe/patches.txt | 1 + frappe/patches/v7_1/set_backup_limit.py | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 frappe/patches/v7_1/set_backup_limit.py diff --git a/frappe/patches.txt b/frappe/patches.txt index b0883bbebe..5b46911f0b 100644 --- a/frappe/patches.txt +++ b/frappe/patches.txt @@ -144,3 +144,4 @@ execute:frappe.db.set_value("Print Settings", "Print Settings", "add_draft_headi frappe.patches.v7_0.cleanup_list_settings execute:frappe.db.set_default('language', '') frappe.patches.v7_1.refactor_integration_broker +frappe.patches.v7_1.set_backup_limit diff --git a/frappe/patches/v7_1/set_backup_limit.py b/frappe/patches/v7_1/set_backup_limit.py new file mode 100644 index 0000000000..f32c35ce0c --- /dev/null +++ b/frappe/patches/v7_1/set_backup_limit.py @@ -0,0 +1,9 @@ +from __future__ import unicode_literals +from frappe.utils import cint +import frappe + +def execute(): + backup_limit = frappe.db.get_single_value('System Settings', 'backup_limit') + + if cint(backup_limit) == 0: + frappe.db.set_value('System Settings', 'System Settings', 'backup_limit', 3)