[drupal-devel] [bug] node created timestamp changes on node edit

killes drupal-devel at drupal.org
Sat Aug 6 13:34:36 UTC 2005


Issue status update for 
http://drupal.org/node/24002
Post a follow up: 
http://drupal.org/project/comments/add/24002

 Project:      Drupal
-Version:      4.6.0
+Version:      cvs
 Component:    node.module
 Category:     bug reports
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  adrinux
 Updated by:   killes at www.drop.org
-Status:       patch (code needs review)
+Status:       patch (ready to be committed)
 Attachment:   http://drupal.org/files/issues/created.patch (602 bytes)

Ok, it is a bit difficult to see why this fixes the problem, but yes it
does. The incorrect data format causes node->created to change by up to
59 seconds which can cause time ordered nodes eg from uploads  to change
position.


I've re-roles the patch for cvs from http://drupal.org/node/26960 and
attach it here.




killes at www.drop.org



Previous comments:
------------------------------------------------------------------------

Tue, 31 May 2005 16:57:22 +0000 : adrinux

When an image node is edited it changes position in the gallery, and in
image taxonomy listings. This is not the usual 'most recently edited'
item floating to the top. The edited image simply shifts to a different
place in the gallery with no apparent logic.


As far as I can tell this happens because image module sorts the images
in a gallery by the node creation timestamp, and for some reason the
creation timestamp is being incremented a little on editing the node.
(Of course the changed timestamp also changes as expected.)


Here's and example.
Lets take this gallery http://sphop.perlucida.com/image/tid/62


And change the title from *sphp_2002_061_henk.jpg* to *Seagulls* on
this image:
http://sphop.perlucida.com/node/322


Prior to the change we have the following (info extracted from the db):
nid: 322
title: sphp_2002_061_henk.jpg
created: 1117550744
changed: 1117550744


And the image is listed between *sphp_2002_062_henk.jpg* and
*sphp_2002_060_henk.jpg* as you'd expect.


We change the title and image moves to appear between
*sphp_2002_067_henk.jpg* and *sphp_2002_066_henk.jpg* as you can see:
http://sphop.perlucida.com/image/tid/62?from=12


The db now gives:
nid: 322
title: Seagulls
created: 1117550756
changed: 1117558316


So, why does the *created* timestamp change at all, and can I stop that
happening?


I should say that the images in the gallery were initially imported
using import_image.module - but I don't see what this could have to do
with that.




------------------------------------------------------------------------

Thu, 30 Jun 2005 00:59:08 +0000 : dtan

Attachment: http://drupal.org/files/issues/node.module.created.patch (591 bytes)

You'll notice that there is an authored on text box. . .it doesn't
provide seconds, so when the timestamp is created, it picks up the
current minutes seconds.   Thus if you edit a node (any type) and view
its created field in the db, and continuously repeat over 60 seconds,
you will see the created loop back down.  


Here is the patch. . .which is actually applied to the *node.module*.




------------------------------------------------------------------------

Thu, 30 Jun 2005 01:42:51 +0000 : clydefrog

dtan, your patch contains html.




------------------------------------------------------------------------

Thu, 30 Jun 2005 03:40:03 +0000 : dtan

Attachment: http://drupal.org/files/issues/node_module_created.patch (591 bytes)

another one :)




------------------------------------------------------------------------

Thu, 30 Jun 2005 15:13:57 +0000 : Jose A Reyero

Hey dtan, I'd say very good catch  :-) , tested the patch and seems to
be ok.


Anyway, I think this bugfix needs to be posted to Drupal core.




------------------------------------------------------------------------

Thu, 30 Jun 2005 19:22:49 +0000 : mfb

+1




------------------------------------------------------------------------

Fri, 01 Jul 2005 07:31:10 +0000 : adrinux

No time to test this until next week myself, but It's already got two
+'s so I'm moving it to core and re-titleing.
Thanks to dtan for hunting this one down :)




------------------------------------------------------------------------

Mon, 18 Jul 2005 15:01:28 +0000 : adrinux

Had time to test dtan's patch properly and can now say definitively that
it does fix this problem.


That is, without this patch the node created timestamp changes on a
node edit. With this patch applied only the node changed timestamp
changes, as you'd expect.


So +1 on this getting applied ASAP.




------------------------------------------------------------------------

Mon, 18 Jul 2005 15:17:19 +0000 : adrinux

I made a version of this patch for CVS HEAD:
http://drupal.org/node/26960







More information about the drupal-devel mailing list