New Foswiki release 2.1.6 is available with important security fixes.
Sourceforge foswiki email lists being discontinued. Subscribe to the new Foswiki announce and discuss lists at MailingLists

Item9827: Foswiki::Meta interface change breaks plugins

Priority: Urgent
Current State: Closed
Released In: 1.1.1
Target Release: patch
Applies To: Engine
Component: Foswiki::Meta
Reported By: MichaelTempest
Waiting For:
Last Change By: KennethLavrsen
distro:142fd927aa4a changed the interface to Foswiki::Meta::getRevisionInfo() from
getRevisionInfo($fromrev) -> ( $date, $author, $rev, $comment )
... to ...
getRevisionInfo($fromrev) -> \%info 

This breaks plugins (e.g. PublishPlugin) that use Foswiki::Meta::getRevisionInfo().

Foswiki::Func::readTopic returns a Foswiki::Meta object. That object is not documented as opaque. Rather, the readTopic documentation says This class is fully documented in the source code documentation shipped with the release, or can be inspected in the lib/Foswiki/ file

Thus, I think it is reasonable for PublishPlugin to use Foswiki::Meta::getRevisionInfo(). So, the interface should not have changed in a non-compatible way.

I propose to restore functionality by changing Foswiki::Meta::getRevisionInfo() as follows:
---   (revision 9559)
+++   (working copy)
@@ -1227,6 +1227,11 @@
    * ={author}= canonical user ID
    * ={version}= the revision number
+---++ ObjectMethod getRevisionInfo() -> ( $revDate, $author, $rev, $comment )
+Limited backwards compatibility for plugins that assume the 1.0.x interface
+The comment is *always* blank
 sub getRevisionInfo {
@@ -1261,7 +1266,16 @@
         # cache the result
-    return $info;
+    if (wantarray)
+    {
+        # Backwards compatibility for 1.0.x plugins
+        return ( $info->{date}, $info->{author}, $info->{version}, '' );
+    }
+    else
+    {
+        return $info;
+    }
 # Determines, and caches, the topic revision info of the base version,

-- MichaelTempest - 14 Oct 2010

Oh, bugger. Yes, your change is good.

-- CrawfordCurrie - 14 Oct 2010

ItemTemplate edit

Summary Foswiki::Meta interface change breaks plugins
ReportedBy MichaelTempest
Codebase 1.1.0, trunk
SVN Range
AppliesTo Engine
Component Foswiki::Meta
Priority Urgent
CurrentState Closed
Checkins distro:664473a75032 distro:b72c5fc7cfbe
TargetRelease patch
ReleasedIn 1.1.1
Topic revision: r6 - 25 Oct 2010, KennethLavrsen - This page was cached on 20 Sep 2018 - 13:12.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy