When loading the current version of docs, also purge /current/

This commit is contained in:
Magnus Hagander
2012-09-24 12:38:49 +02:00
parent f912a70655
commit 45f53d5d03

View File

@ -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()