In the drupal 6 porting issue I wrote this:
...the forums listing shows the wrong time for the last post in that forum (but the stuff inside is correct and so is the comment time...), but that can probably be ignored.
This is much more serious than I thought and also happens on Drupal5.
What really happens:
1. Topics are imported with correct timestamp.
2. Forum orders topics correctly, but (I think) the forum main page will give wrong time for last post - even though in the details it is correct.
3. comments import properly, giving the last post time correctly too. This actually re orders the topics putting them in the correct place.
4. Those topics without comments are not reordered - they stay at the top.
In short the final ordering is:
1. Sticky topics
2. topics with zero comments, ordered by reverse creation date.
3. Topics with posts ordered by reverse creation date.
I think the problem is that node_save sets the timestamp as of the time for when the import of that node occurs. It will need to be over ridden.
Comments
Comment #1
naheemsays commentedhttp://drupal.org/node/172904 has got a fix for after the horse has bolted (a query to type into phpmyadmin to fix everything).
The proper solutions that I can think of atm are:
1. Get a new function phpbb2drupal_node_save, which is a simplified version of node_save and will use the correct changed time. Pretty simple and we already do this for poll_save and comment_save.
2. Get a patch into core where changed time is only set as current if there is no changed time already set - but this may not get in as it affects all node updates, but is only useful in special cases such as node import.
3. Add a hack to replace the changed time in the database after the node has been saved.
I will go with one, add a patch to the issue queue for 2 and let others decide wether it should go in or not.
Comment #2
naheemsays commentedSeems like I got ahead of myself. $node->changed does not seem to be the problem.
Comment #3
naheemsays commentedOption 3 works. Adding the following code in a couple of places (once for topics, once for polls) fixes things:
($node->changed IS the problem, but this fix works...)
Comment #4
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #5
Fogg commentedI still had this issue with the latest release of the module for phpbb2.
I fixed it by downloading the creation time from the phpbb tables and uploading them manually to the drupal table. Here is what I have done.
Download this output to local disk, then reformat it so that every line looks like this
I did that using OpenOffice, but Excel will do the same trick.
I know that the whole part would be possible in one query, but my SQL knowledge is probably not advanced enough ;)
Now all node have the proper creation date, but still the sorting does not work, as it sorts on last comment and there is no comment. So we will fake this by copying the values from node to node statistics using this query:
Et voilà, now my sorting is just fine ;)
Comment #6
Fogg commentedHmm, was not completly correct. The last query will update all records and therefor remove the so far correct entries if there where comments already.
This can be fixed again with this query: