You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

58 line
1.5 KiB

  1. # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
  2. # MIT License. See license.txt
  3. from __future__ import unicode_literals
  4. import frappe
  5. import frappe.translate
  6. import frappe.modules.patch_handler
  7. import frappe.model.sync
  8. from frappe.utils.fixtures import sync_fixtures
  9. from frappe.sessions import clear_global_cache
  10. from frappe.desk.notifications import clear_notifications
  11. from frappe.website import render, router
  12. from frappe.desk.doctype.desktop_icon.desktop_icon import sync_desktop_icons
  13. from frappe.core.doctype.language.language import sync_languages
  14. from frappe.modules.utils import sync_customizations
  15. import frappe.utils.help
  16. def migrate(verbose=True, rebuild_website=False):
  17. '''Migrate all apps to the latest version, will:
  18. - run patches
  19. - sync doctypes (schema)
  20. - sync fixtures
  21. - sync desktop icons
  22. - sync web pages (from /www)'''
  23. frappe.flags.in_migrate = True
  24. clear_global_cache()
  25. # run patches
  26. frappe.modules.patch_handler.run_all()
  27. # sync
  28. frappe.model.sync.sync_all(verbose=verbose)
  29. frappe.translate.clear_cache()
  30. sync_fixtures()
  31. sync_customizations()
  32. sync_desktop_icons()
  33. sync_languages()
  34. frappe.get_doc('Portal Settings', 'Portal Settings').sync_menu()
  35. # syncs statics
  36. render.clear_cache()
  37. # add static pages to global search
  38. router.sync_global_search()
  39. frappe.db.commit()
  40. if not frappe.conf.get('global_help_setup'):
  41. # sync help if not set as global
  42. frappe.utils.help.sync()
  43. clear_notifications()
  44. frappe.publish_realtime("version-update")
  45. frappe.flags.in_migrate = False