Purge PDF listings page when new PDFs are uploaded
authorMagnus Hagander <magnus@hagander.net>
Tue, 18 May 2021 07:59:10 +0000 (09:59 +0200)
committerMagnus Hagander <magnus@hagander.net>
Tue, 18 May 2021 07:59:10 +0000 (09:59 +0200)
This will update which versions have PDFs as well as their sizes.

tools/purgehook/purgehook.py

index fed909d19f8801e9daed80e08968b8fd1b4a5948..3102a94fec7db6d0a61ae4be07d33a3a282c3a6e 100755 (executable)
@@ -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()