I think everyone would agree we want a field to indicate when a user-created node was last updated, but the details are a little fuzzy.

What kinds of updates do we want to end up setting this field?

Obviously user edits to the doctext (for types including document). IMO changes to the title should also set it, as should changes to fields of non-document types (e.g. snippets). I'd also want Q&AEditor/SDC/janitor/pedagogue changes to set it. I don't care one way or the other whether hitting "Update" without having changed anything updates it. The field should probably be set the same as createtime at node creation (currently, lastedit often varies from createtime by one or more seconds because node and document are updated separately), not zero. Any other updates should IMO not set the field.

Implementation notes (some of which depend on things I say above that others may disagree with):

Having the lastedit field in document doesn't work for non-document types, or for having it match createtime, so it should move to node. I'd make it a datetime field, instead of a timestamp, since we don't want the magic autoupdate behaviour that timestamps have (though I think that only happens with the first timestamp field in the table). Also note that apparently timestamps are changed to return by default as strings as of MySQL 4.1. When the new node.lastedit field is added, it should be set the same as createtime.

Then the following changes should be enough:
Everything/NodeBase.pm (insertNode): add -lastedit => "now()"
Everything/HTML.pm (gotoNode) and handle_node_edits: fetch now() and set $NODE->{lastedit} to it before calling updateNode


In reply to maintaining a time of last edit for nodes by ysth

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.