def rebuild_all_caches(): req = request.RequestDummy() wiki_list = wikiutil.getWikiList(req) for wiki_name in wiki_list: req.switch_wiki(wiki_name) plist = wikiutil.getPageList(req) maintenance.buildCaches(wiki_name, plist, doprint=True) req.db_disconnect()
common_css = ''.join(common_file.readlines()) common_file.close() print_file = open(os.path.join(css_location, 'print.css')) print_css = ''.join(print_file.readlines()) print_file.close() logo_background_file = open(os.path.join(img_location, 'floater.png')) logo_background = ''.join(logo_background_file.readlines()) logo_background_file.close() if config.image_logo: logo_file = open(os.path.join(config.web_root, config.url_prefix[1:], config.image_logo)) logo = ''.join(logo_file.readlines()) logo_background_file.close() flat_page_dict = { 'Wiki Settings': buildDB.basic_pages['Wiki Settings'], 'Wiki Settings/CSS': buildDB.basic_pages['Wiki Settings/CSS'], 'Wiki Settings/Images': buildDB.basic_pages['Wiki Settings/Images'] } flat_page_dict['Wiki Settings/CSS'].files = [ ("screen.css", screen_css), ("common.css", common_css), ("print.css", print_css) ] images_list = [ ("logo_background.png", logo_background) ] if config.image_logo: images_list.append(("logo.png", logo)) flat_page_dict['Wiki Settings/Images'].files = images_list buildDB.insert_pages(cursor, flat_page_dict) plist = wikiutil.getPageList(req) maintenance.buildCaches(plist) req.db_disconnect()
all_pages.update(init_basic_pages('global')) if __name__ == '__main__': from Sycamore import request # building for first time..don't try to load config from db req = request.RequestDummy(process_config=False) cursor = req.cursor init_db(cursor) create_tables(cursor) create_views(cursor) create_config(req) create_other_stuff(req) print "inserting basic pages..." insert_pages(req) build_search_index() setup_admin(req) req.db_disconnect() # commit before building caches req = request.RequestDummy(process_config=True) wiki_list = wikiutil.getWikiList(req) for wiki_name in wiki_list: req.config = config.Config(wiki_name, req, process_config=True) plist = wikiutil.getPageList(req) maintenance.buildCaches(wiki_name, plist, doprint=True) req.db_disconnect() print "-------------" print ("All done! Now, start up the sycamore server and " "create the admin account!")