mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 12:19:12 +00:00
[update file size patch] [fix] auto commit on many writes for the duration of the patch
This commit is contained in:
@@ -2,6 +2,8 @@ import webnotes, os, webnotes.utils
|
|||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
files_path = webnotes.utils.get_path("public", "files")
|
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
|
for f in webnotes.conn.sql("""select name, file_name from
|
||||||
`tabFile Data`""", as_dict=True):
|
`tabFile Data`""", as_dict=True):
|
||||||
if f.file_name:
|
if f.file_name:
|
||||||
@@ -9,4 +11,4 @@ def execute():
|
|||||||
if os.path.exists(filepath):
|
if os.path.exists(filepath):
|
||||||
webnotes.conn.set_value("File Data", f.name, "file_size", os.stat(filepath).st_size)
|
webnotes.conn.set_value("File Data", f.name, "file_size", os.stat(filepath).st_size)
|
||||||
|
|
||||||
|
webnotes.conn.auto_commit_on_many_writes = 0
|
||||||
Reference in New Issue
Block a user