It would be good to set correct date of last modification of comments and nodes. The import does not do this. Instead, the date of import is used. The following queries should do the job:

update comment set changed = created;
update node n set n.changed = (select changed from comment where nid = n.nid order by cid desc limit 0, 1) where n.type = 'forum';
update node_comment_statistics ncs, node n set ncs.last_comment_timestamp = n.changed where ncs.nid = n.nid;

Comments

darksnow’s picture

This should have already been happening. I just did the migration I wrote this module for and found that some nodes and comments had the correct date, some didn't.

There's something a bit more subtle than it just not working, but thanks for the query it will be helpful if I need to post process the import to fix this. Ideally though, those values should be set explicitly in the import

Renekcl’s picture

I also have this issue. Every timestamps of last post is set to date of migration.

Can i use the script above to correct this?

g10’s picture

same here… after migrating the topics the dates are correct, once the posts are migrated, they have the date of the migration

challenge’s picture

Title: Set date of last modification » Set date of last modification / migration automatically edits topics!
Category: feature » bug

tried with latest code.

When importing topics, on main forum page (drupalpath/forum) and subforums pages the "last post" column shows the date of migration instead of the real topic/post date.

I opened the topic and surprise: the creation date is the correct date, BUT EVERY TOPIC IS AUTOMATICALLY EDITED BY ITS AUTHOR AT THE TIME OF MIGRATION.

so every topic has this at the end: "edited by authorname on date/time of migration "

This destroys the sorting in main forum page, because all topics are sorted with time of migration as last post date... all the same date.

ONLY EXCEPTION: if topic was already edited in phpbb3, it does not alter it with the migration date.

--
It happens only with topics. When I migrate posts they are not edited and they only show the correct date.

JeremyFrench’s picture

Status: Active » Fixed
challenge’s picture

Status: Fixed » Active

I tried.
Don't know if it's a different issue so, sorry if I shouldn't reopen this.

Now when opening the topics, they are not edited and it's showing the correct date. This is good.

BUT

on main forum page (http://drupalpath/forum) at "last post" column it's still showing date of migration.

e.g.: If you check the forum right after migration you'll see all your forums with "last post" "10 seconds ago" ( it starts counting from date of migration), but when you open the last topic in that forum, the correct date is showed.

so when you open the topic, everything is fine. When you see a list of topics, or a main forum view, last topic date is still wrong.

try to see if you can reproduce it.

JeremyFrench’s picture

If you try to re import the posts (even if nothing needs importing) it should go away and reset to correct values.

There is a bug in migrate #1799854: Query to rebuild comment statistics is wrong. which is causing this. I have tried to paper over it, but only at the end of the posts migration.

challenge’s picture

Status: Active » Fixed

Well you're right, I didn't import the posts and the issue appears when importing only topics :D
after importing the posts all is good.

thanks

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.