Description
After converting a wiki to 1.6 markup, the AbandonedPages macro is not very useful: it reports that nearly every page was last modified when the upgrade was done.
This also makes the page AbandonedPages huge: it seems to report every single page in the wiki!
Similarly, nearly every page says "last updated <upgrade-date> by localhost", even if the page was really last modified 2 years ago by John Doe. You have to look in "Revision History" (?action=info) to see what the last real edit was.
Oddly enough, RecentChanges is not affected: it only reports real edits.
Steps to reproduce
- migrate a wiki from pre-1.6 to post-1.6 (I'm doing 1.5.8 to 1.7.1)
- start the newly-upgraded wiki
view AbandonedPages
- note that nearly every page is reported to have been modified at the same time, when you ran the migration script
Example
First screenshot: RecentChanges correctly showing only "real" edits, i.e. skipping the "Convert to 1.6 markup" changes.
Second screenshot: AbandonedPages incorrectly showing all pages as having been changed at the same time, when I did the upgrade. (Note: the page that claims to have been last edited on 2007-10-12 is because I manually edited data/<pagename>/edit-log for that page. Ignore it.)
Component selection
Page or editlog
Details
MoinMoin Version |
1.7.1 |
OS and Version |
Ubuntu 7.04 (feisty fawn) |
Python Version |
2.5.1 |
Server Setup |
standalone |
Server Details |
|
Language you are using the wiki in |
en |
Workaround
Unknown.
Discussion
Here is a patch that fixes both AbandonedPages and the misleading "last edited ..." message at the bottom of every page. I have not looked at RecentChanges to see why it does the right thing, so there is probably room for better code reuse here.
--- a/MoinMoin/Page.py Wed Aug 20 11:34:25 2008 -0400 +++ b/MoinMoin/Page.py Wed Aug 20 13:08:59 2008 -0400 @@ -529,7 +529,9 @@ class Page(object): wanted_rev = "%08d" % self.get_real_rev() edit_log = editlog.EditLog(request, rootpagename=self.page_name) for entry in edit_log.reverse(): - if entry.rev == wanted_rev: + if entry.isMigrationEntry(): + continue + if entry.rev <= wanted_rev: break else: entry = () # don't use None diff -r a4f26f13e9d8 MoinMoin/logfile/editlog.py --- a/MoinMoin/logfile/editlog.py Wed Aug 20 11:34:25 2008 -0400 +++ b/MoinMoin/logfile/editlog.py Wed Aug 20 12:42:51 2008 -0400 @@ -137,6 +137,15 @@ class EditLogLine: text + request.formatter.span(0)) + def isMigrationEntry(self): + """ Return true if this log entry represents a data-conversion step + done by a MoinMoin migration script. + + @rtype: bool + """ + return (self.hostname == "localhost" and + not self.userid and + self.comment == "converted to 1.6 markup") class EditLog(LogFile): """ Used for accessing the global edit-log (e.g. by RecentChanges) as
Plan
- Priority:
- Assigned to:
- Status: no bug, it's a side-effect of the mig script editing your pages to convert them to new markup
Followup from original reporter: I disagree. If it's OK for the migration script to change the meaning of AbandonedPages, why is it not OK for the migration script to change the meaning of RecentChanges? To be consistent, 5 minutes after an upgrade every page should show up in RecentChanges as "modified 5 min ago". MoinMoin handles that case just fine; migration does not affect RecentChanges. So why is it allowed to affect AbandonedPages?