blob: a877c7649b08e41729f25f96d8cb276c77ceff25 [file] [log] [blame]
Rushabh Mehta40182ba2012-06-19 14:15:13 +05301def execute():
2 import webnotes
Rushabh Mehta40182ba2012-06-19 14:15:13 +05303 import webnotes.model.sync
4
Anand Doshi72c945b2012-06-22 20:01:07 +05305 # sync web page, blog doctype
Rushabh Mehta40182ba2012-06-19 14:15:13 +05306 webnotes.model.sync.sync('website', 'web_page')
Anand Doshi72c945b2012-06-22 20:01:07 +05307 webnotes.model.sync.sync('website', 'blog')
8
9 cleanup()
10
11 save_pages()
Rushabh Mehta40182ba2012-06-19 14:15:13 +053012
Anand Doshi72c945b2012-06-22 20:01:07 +053013def cleanup():
14 import webnotes
15
16 # delete pages from `tabPage` of module Website or of type Webpage
17 webnotes.conn.sql("""\
18 delete from `tabPage`
19 where module='Website' and ifnull(web_page, 'No') = 'Yes'""")
20
Anand Doshie47def82012-07-09 15:56:12 +053021 # change show_in_website value in item table to 0 or 1
22 webnotes.conn.sql("""\
23 update `tabItem`
24 set show_in_website = if(show_in_website = 'Yes', 1, 0)
25 where show_in_website is not null""")
Anand Doshi40fce892012-07-09 20:02:52 +053026
27 # move comments from comment_doctype Page to Blog
28 webnotes.conn.sql("""\
29 update `tabComment` comm, `tabBlog` blog
30 set comm.comment_doctype = 'Blog', comm.comment_docname = blog.name
31 where comm.comment_docname = blog.page_name""")
32
Anand Doshie47def82012-07-09 15:56:12 +053033
Anand Doshi72c945b2012-06-22 20:01:07 +053034def save_pages():
35 """save all web pages, blogs to create content"""
Anand Doshi87901882012-07-11 20:04:32 +053036 import website.web_cache
37 website.web_cache.rebuild_web_cache()