From 45f53d5d032672757281ecefdfddd4e5f9da4d04 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Mon, 24 Sep 2012 12:38:49 +0200 Subject: [PATCH] When loading the current version of docs, also purge /current/ --- tools/docs/docload.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/docs/docload.py b/tools/docs/docload.py index c88df7eb..7254bbd3 100755 --- a/tools/docs/docload.py +++ b/tools/docs/docload.py @@ -76,12 +76,14 @@ tf = tarfile.open(tarfilename) curs = connection.cursor() # Verify that the version exists, and what we're loading -curs.execute("SELECT latestminor FROM core_version WHERE tree=%(v)s", {'v': ver}) +curs.execute("SELECT current FROM core_version WHERE tree=%(v)s", {'v': ver}) r = curs.fetchall() if len(r) != 1: print "Version %s not found in the system, cannot load!" % ver sys.exit(1) +iscurrent = r[0][0] + # Remove any old docs for this version (still protected by a transaction while # we perform the load) curs.execute("DELETE FROM docs WHERE version=%(v)s", {'v': ver}) @@ -113,6 +115,8 @@ if ver == "0": ver = "devel" curs.execute("SELECT varnish_purge('^/docs/' || %(v)s || '/')", {'v': ver}) +if iscurrent: + curs.execute("SELECT varnish_purge('^/docs/current/')") transaction.commit_unless_managed() connection.close()