From 822e156942028d6165e0fe29a2a1c440b4cf692f Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Tue, 18 May 2021 09:59:10 +0200 Subject: [PATCH] Purge PDF listings page when new PDFs are uploaded This will update which versions have PDFs as well as their sizes. --- tools/purgehook/purgehook.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/purgehook/purgehook.py b/tools/purgehook/purgehook.py index fed909d1..3102a94f 100755 --- a/tools/purgehook/purgehook.py +++ b/tools/purgehook/purgehook.py @@ -29,6 +29,11 @@ if __name__ == "__main__": curs.execute("SELECT varnish_purge('^/files/' || %(u)s || '$')", { 'u': l.strip(), }) + + # If the purge is for documentation PDF, also purge the xkey for docs pdfs, + # so we update the list of which are available. + if l.startswith('documentation/pdf/'): + curs.execute("SELECT varnish_purge_xkey('pgdocs_pdf')") elif l.startswith('templates/'): # On regular website, if it's a template do an xkey purge of all pages using that template tmpl = l[len('templates/'):].strip()