From 28b38d45e764222078dbf621f228f152fc608da3 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 8 Mar 2017 11:57:33 +0530 Subject: [PATCH] [fix] patches --- frappe/migrate.py | 2 ++ frappe/modules/patch_handler.py | 2 +- frappe/patches.txt | 1 + frappe/patches/v7_2/update_communications.py | 7 +++++-- frappe/patches/v8_0/update_published_in_global_search.py | 3 ++- frappe/website/context.py | 3 ++- frappe/www/error.py | 1 + 7 files changed, 14 insertions(+), 5 deletions(-) diff --git a/frappe/migrate.py b/frappe/migrate.py index 9922385e0d..8d9ed33b31 100644 --- a/frappe/migrate.py +++ b/frappe/migrate.py @@ -24,6 +24,7 @@ def migrate(verbose=True, rebuild_website=False): - sync fixtures - sync desktop icons - sync web pages (from /www)''' + frappe.flags.in_migrate = True clear_global_cache() # run patches @@ -53,3 +54,4 @@ def migrate(verbose=True, rebuild_website=False): clear_notifications() frappe.publish_realtime("version-update") + frappe.flags.in_migrate = False diff --git a/frappe/modules/patch_handler.py b/frappe/modules/patch_handler.py index 3bade9c3f5..a320f53a3a 100644 --- a/frappe/modules/patch_handler.py +++ b/frappe/modules/patch_handler.py @@ -98,7 +98,7 @@ def execute_patch(patchmodule, method=None, methodargs=None): def update_patch_log(patchmodule): """update patch_file in patch log""" - frappe.get_doc({"doctype": "Patch Log", "patch": patchmodule}).insert() + frappe.get_doc({"doctype": "Patch Log", "patch": patchmodule}).insert(ignore_permissions=True) def executed(patchmodule): """return True if is executed""" diff --git a/frappe/patches.txt b/frappe/patches.txt index 0054e6484f..c63bcf9178 100644 --- a/frappe/patches.txt +++ b/frappe/patches.txt @@ -1,6 +1,7 @@ execute:frappe.db.sql("""update `tabPatch Log` set patch=replace(patch, '.4_0.', '.v4_0.')""") #2014-05-12 frappe.patches.v5_0.convert_to_barracuda_and_utf8mb4 execute:frappe.utils.global_search.setup_global_search_table() +frappe.patches.v8_0.update_global_search_table frappe.patches.v7_0.update_auth frappe.patches.v7_1.rename_scheduler_log_to_error_log frappe.patches.v7_3.rename_page_role_to_has_role diff --git a/frappe/patches/v7_2/update_communications.py b/frappe/patches/v7_2/update_communications.py index 8bbe056f05..930b53cc00 100644 --- a/frappe/patches/v7_2/update_communications.py +++ b/frappe/patches/v7_2/update_communications.py @@ -8,8 +8,11 @@ def execute(): """ frappe.reload_doc("core", "doctype", "feedback_request") - frappe.db.sql("""update tabCommunication set content=ifnull(feedback, "feedback details not provided") - where communication_type="Feedback" and content is NULL""") + frappe.reload_doc("core", "doctype", "communication") + + if frappe.db.has_column('Communication', 'feedback'): + frappe.db.sql("""update tabCommunication set content=ifnull(feedback, "feedback details not provided") + where communication_type="Feedback" and content is NULL""") frappe.db.sql(""" update tabCommunication set sender_full_name="" where communication_type="Feedback" and sender_full_name='Guest None' """) diff --git a/frappe/patches/v8_0/update_published_in_global_search.py b/frappe/patches/v8_0/update_published_in_global_search.py index 09aa33706b..d10ea32b66 100644 --- a/frappe/patches/v8_0/update_published_in_global_search.py +++ b/frappe/patches/v8_0/update_published_in_global_search.py @@ -1,8 +1,9 @@ import frappe -from frappe.utils.global_search import rebuild_for_doctype def execute(): from frappe.website.router import get_doctypes_with_web_view + from frappe.utils.global_search import rebuild_for_doctype + if not 'published' in frappe.db.get_db_table_columns('__global_search'): frappe.db.sql('''alter table __global_search add column `title` varchar(140)''') diff --git a/frappe/website/context.py b/frappe/website/context.py index 82b8da865a..2738122411 100644 --- a/frappe/website/context.py +++ b/frappe/website/context.py @@ -51,7 +51,8 @@ def update_controller_context(context, controller): except frappe.PermissionError: raise except: - frappe.errprint(frappe.utils.get_traceback()) + if not frappe.flags.in_migrate: + frappe.errprint(frappe.utils.get_traceback()) if hasattr(module, "get_children"): context.children = module.get_children(context) diff --git a/frappe/www/error.py b/frappe/www/error.py index 8629121f0a..da64abfeb8 100644 --- a/frappe/www/error.py +++ b/frappe/www/error.py @@ -8,5 +8,6 @@ no_cache = 1 no_sitemap = 1 def get_context(context): + if frappe.flags.in_migrate: return print frappe.get_traceback().encode("utf-8") return {"error": frappe.get_traceback().replace("<", "<").replace(">", ">") }