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

  1. migrate a wiki from pre-1.6 to post-1.6 (I'm doing 1.5.8 to 1.7.1)
  2. start the newly-upgraded wiki
  3. view AbandonedPages

  4. 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.

Moin-RecentChanges-good.png

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.)

Moin-AbandonedPages-bad.png

Component selection

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

(!) 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?

It is simply because the mig script creates a new revision for each converted pages' content. Each revision of a page is accompanied by an entry into the page-local edit-log (this is more or less technically required), but not into the global edit-log. This is done to be able to see what the mig script did (you can go to a page, invoke info action, see the entry the converter made, make a diff between last rev before and the converted rev). Thus, by creating the new revision, the conversion is reviewable and it does not just overwrite the last revision with the conversion output (that would make it non-reviewable). The global edit-log could have been updated also, but I decided it is better not to update it, as it is only used for generating RecentChanges and flooding it with entries for all converted pages would do more harm than good.

Plan


CategoryMoinMoinNoBug

MoinMoin: MoinMoinBugs/MigrationBreaksAbandonedPages (last edited 2008-08-30 10:34:03 by ThomasWaldmann)