mirror of
https://github.com/postgres/pgweb.git
synced 2025-07-25 16:02:27 +00:00
Include docs load timestamp in developer docs
This makes it possible to figure out when the docs were actually loaded, since developer docs don't carry a version number. This is actually going to be the docs *load* timestamp, and not build timestamp, but they should be close enough together that it shouldn't matter. Fixes #108
This commit is contained in:
@ -12,6 +12,7 @@ class Version(PgModel, models.Model):
|
||||
relnotes = models.CharField(max_length=32, null=False, blank=False)
|
||||
current = models.BooleanField(null=False, blank=False, default=False)
|
||||
supported = models.BooleanField(null=False, blank=False, default=True)
|
||||
docsloaded = models.DateTimeField(null=True, blank=True, help_text="The timestamp of the latest docs load. Really only used for developer docs for now, but set for all of them.")
|
||||
|
||||
def __unicode__(self):
|
||||
return self.versionstring
|
||||
|
@ -15,6 +15,7 @@ from models import DocPage, DocComment
|
||||
from forms import DocCommentForm
|
||||
|
||||
def docpage(request, version, typ, filename):
|
||||
loaddate = None
|
||||
# Get the current version both to map the /current/ url, and to later
|
||||
# determine if we allow comments on this page.
|
||||
currver = Version.objects.filter(current=True)[0].tree
|
||||
@ -24,6 +25,7 @@ def docpage(request, version, typ, filename):
|
||||
if not typ == 'static':
|
||||
raise Http404("Only static version of developer docs available")
|
||||
ver = Decimal(0)
|
||||
loaddate = Version.objects.get(tree=Decimal(0)).docsloaded
|
||||
else:
|
||||
ver = Decimal(version)
|
||||
|
||||
@ -54,6 +56,7 @@ def docpage(request, version, typ, filename):
|
||||
'comments': comments,
|
||||
'can_comment': (typ=="interactive" and ver==currver),
|
||||
'doc_index_filename': indexname,
|
||||
'loaddate': loaddate,
|
||||
})
|
||||
|
||||
def docsrootpage(request, version, typ):
|
||||
|
@ -37,7 +37,7 @@
|
||||
<div id="docTextSize">Text Size: <a href="#" onclick="setActiveStyleSheet('Normal Text'); return false;" onkeypress="return false;" title="Normal Text Size">Normal</a> / <a href="#" onclick="setActiveStyleSheet('Large Text'); return false;" onkeypress="return false;" title="Large Text Size">Large</a></div>
|
||||
</div>
|
||||
<div id="docNav">
|
||||
<a href="/" title="Home">Home</a> → <a href="/docs" title="Documentation">Documentation</a> → <a href="/docs/manuals" title="Manuals">Manuals</a> → <a href="/docs/{{doc_nav_version}}/{{doc_type}}/{{doc_index_filename}}">PostgreSQL {{doc_nav_version}}</a>
|
||||
<a href="/" title="Home">Home</a> → <a href="/docs" title="Documentation">Documentation</a> → <a href="/docs/manuals" title="Manuals">Manuals</a> → <a href="/docs/{{doc_nav_version}}/{{doc_type}}/{{doc_index_filename}}">PostgreSQL {{doc_nav_version}}</a>{%if loaddate%} ({{loaddate|date:"Y-m-d H:i:s"}}){%endif%}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -104,6 +104,9 @@ for member in tf:
|
||||
load_doc_file(inner_member.name, inner_tar.extractfile(inner_member))
|
||||
tf.close()
|
||||
|
||||
# Update the docs loaded timestamp
|
||||
curs.execute("UPDATE core_version SET docsloaded=CURRENT_TIMESTAMP WHERE tree=%(v)s", {'v': ver})
|
||||
|
||||
# Issue varnish purge for all docs of this version
|
||||
if ver == "0":
|
||||
# Special handling of developer docs...
|
||||
|
Reference in New Issue
Block a user