2012-01-25 05:07:35 +00:00
|
|
|
# website patch
|
|
|
|
|
|
|
|
import webnotes
|
2012-01-27 06:47:09 +00:00
|
|
|
from webnotes.model.doc import Document
|
|
|
|
|
2012-01-25 05:07:35 +00:00
|
|
|
def execute():
|
2012-01-27 06:47:09 +00:00
|
|
|
add_website_manager()
|
|
|
|
cleanup_file_data()
|
2012-01-25 05:07:35 +00:00
|
|
|
update_patch_log()
|
|
|
|
from webnotes.modules import reload_doc
|
2012-02-02 11:10:01 +00:00
|
|
|
from webnotes.model import delete_doc
|
|
|
|
|
|
|
|
delete_doc('Website', 'Module Def', 'Website')
|
2012-01-27 10:27:17 +00:00
|
|
|
reload_doc('website', 'Module Def', 'Website')
|
2012-02-02 11:10:01 +00:00
|
|
|
reload_doc('website', 'Role', 'Website Manager')
|
|
|
|
|
|
|
|
webnotes.conn.sql("""delete from `tabModule Def Role` where parent='Website'"""):
|
|
|
|
d = Document('Module Def Role')
|
|
|
|
d.parent = 'Website'
|
|
|
|
d.role = 'Website Manager'
|
|
|
|
d.save()
|
|
|
|
|
2012-01-27 10:27:17 +00:00
|
|
|
reload_doc('website', 'doctype', 'about_us_settings')
|
2012-02-02 11:10:01 +00:00
|
|
|
reload_doc('website', 'doctype', 'about_us_team')
|
2012-01-27 12:30:14 +00:00
|
|
|
reload_doc('website', 'doctype', 'blog')
|
|
|
|
reload_doc('website', 'doctype', 'blog_subscriber')
|
2012-02-02 11:10:01 +00:00
|
|
|
reload_doc('website', 'doctype', 'contact_us_settings')
|
2012-02-01 09:17:29 +00:00
|
|
|
reload_doc('website', 'doctype', 'product')
|
2012-02-02 11:10:01 +00:00
|
|
|
reload_doc('website', 'doctype', 'product_group')
|
|
|
|
reload_doc('website', 'doctype', 'products_settings')
|
|
|
|
reload_doc('website', 'doctype', 'related_page')
|
|
|
|
reload_doc('website', 'doctype', 'style_settings')
|
|
|
|
reload_doc('website', 'doctype', 'top_bar_item')
|
2012-02-01 09:17:29 +00:00
|
|
|
reload_doc('website', 'doctype', 'web_page')
|
2012-02-02 11:10:01 +00:00
|
|
|
reload_doc('website', 'doctype', 'website_settings')
|
2012-01-25 05:07:35 +00:00
|
|
|
|
2012-01-27 10:27:17 +00:00
|
|
|
reload_doc('website', 'page', 'about')
|
2012-01-27 12:30:14 +00:00
|
|
|
reload_doc('website', 'page', 'blog')
|
2012-02-02 11:10:01 +00:00
|
|
|
reload_doc('website', 'page', 'contact')
|
2012-02-01 09:17:29 +00:00
|
|
|
reload_doc('website', 'page', 'products')
|
2012-02-02 11:10:01 +00:00
|
|
|
reload_doc('website', 'page', 'unsubscribe')
|
2012-01-27 10:27:17 +00:00
|
|
|
|
2012-01-27 06:47:09 +00:00
|
|
|
def add_website_manager():
|
|
|
|
"""add website manager to system manager"""
|
|
|
|
for i in webnotes.conn.sql("""select distinct parent from tabUserRole
|
|
|
|
where role='System Manager'"""):
|
|
|
|
if not webnotes.conn.sql("""select parent from tabUserRole
|
|
|
|
where role='Website Manager' and parent=%s""", i[0]):
|
|
|
|
d = Document('UserRole')
|
|
|
|
d.parent = i[0]
|
|
|
|
d.role = 'Website Manager'
|
|
|
|
d.save(1)
|
|
|
|
|
2012-01-25 09:36:28 +00:00
|
|
|
def cleanup_file_data():
|
|
|
|
webnotes.conn.commit()
|
|
|
|
webnotes.conn.sql("""alter table `tabFile Data` drop column blob_content""")
|
|
|
|
webnotes.conn.begin()
|
|
|
|
|
2012-01-25 05:07:35 +00:00
|
|
|
def update_patch_log():
|
|
|
|
webnotes.conn.commit()
|
|
|
|
webnotes.conn.sql("""alter table __PatchLog engine=InnoDB""")
|
|
|
|
webnotes.conn.begin()
|