2013-11-20 07:29:58 +00:00
|
|
|
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
2013-08-05 09:29:54 +00:00
|
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
|
2013-04-10 08:24:13 +00:00
|
|
|
import webnotes, os, webnotes.utils
|
|
|
|
|
|
|
|
def execute():
|
2013-09-25 07:10:33 +00:00
|
|
|
files_path = webnotes.utils.get_site_path(webnotes.conf.files_path)
|
2013-05-30 18:09:24 +00:00
|
|
|
webnotes.conn.auto_commit_on_many_writes = 1
|
|
|
|
|
2013-04-10 08:24:13 +00:00
|
|
|
for f in webnotes.conn.sql("""select name, file_name from
|
|
|
|
`tabFile Data`""", as_dict=True):
|
2013-04-10 08:52:06 +00:00
|
|
|
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)
|
2013-05-30 18:09:24 +00:00
|
|
|
|
2013-09-24 06:59:35 +00:00
|
|
|
webnotes.conn.auto_commit_on_many_writes = 0
|