kopia lustrzana https://github.com/wagtail/wagtail
Additional safeguard to check if a cached site is from an older version of Wagtail (#6515)
rodzic
14f1d8d59a
commit
a541510417
|
@ -10,7 +10,7 @@ Changelog
|
|||
2.11.1 (xx.xx.xxxx) - IN DEVELOPMENT
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* ...
|
||||
* Fix: Ensure that cached `wagtail_site_root_paths` structures from older Wagtail versions are invalidated (Sævar Öfjörð Magnússon)
|
||||
|
||||
|
||||
2.11 LTS (02.11.2020)
|
||||
|
|
|
@ -13,4 +13,4 @@ What's new
|
|||
Bug fixes
|
||||
~~~~~~~~~
|
||||
|
||||
* ...
|
||||
* Ensure that cached ``wagtail_site_root_paths`` structures from older Wagtail versions are invalidated (Sævar Öfjörð Magnússon)
|
||||
|
|
|
@ -299,7 +299,11 @@ class Site(models.Model):
|
|||
"""
|
||||
result = cache.get('wagtail_site_root_paths')
|
||||
|
||||
if result is None:
|
||||
# Wagtail 2.11 changed the way site root paths were stored. This can cause an upgraded 2.11
|
||||
# site to break when loading cached site root paths that were cached with 2.10.2 or older
|
||||
# versions of Wagtail. The line below checks if the any of the cached site urls is consistent
|
||||
# with an older version of Wagtail and invalidates the cache.
|
||||
if result is None or any(len(site_record) == 3 for site_record in result):
|
||||
result = []
|
||||
|
||||
for site in Site.objects.select_related('root_page', 'root_page__locale').order_by('-root_page__url_path', '-is_default_site', 'hostname'):
|
||||
|
|
Ładowanie…
Reference in New Issue