From b68fbf053212de3e3fbff645d53b01d51b8f0b58 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 30 May 2013 23:39:24 +0530 Subject: [PATCH] [update file size patch] [fix] auto commit on many writes for the duration of the patch --- patches/april_2013/p06_update_file_size.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/patches/april_2013/p06_update_file_size.py b/patches/april_2013/p06_update_file_size.py index 8709c7b6420..760c3cb0449 100644 --- a/patches/april_2013/p06_update_file_size.py +++ b/patches/april_2013/p06_update_file_size.py @@ -2,11 +2,13 @@ import webnotes, os, webnotes.utils def execute(): files_path = webnotes.utils.get_path("public", "files") + webnotes.conn.auto_commit_on_many_writes = 1 + for f in webnotes.conn.sql("""select name, file_name from `tabFile Data`""", as_dict=True): if f.file_name: filepath = os.path.join(files_path, f.file_name) if os.path.exists(filepath): webnotes.conn.set_value("File Data", f.name, "file_size", os.stat(filepath).st_size) - - \ No newline at end of file + + webnotes.conn.auto_commit_on_many_writes = 0 \ No newline at end of file