[Pmwiki-users] Re: PmWiki potential bug fix

Patrick R. Michaud pmichaud
Fri Dec 17 10:21:21 CST 2004

On Fri, Dec 17, 2004 at 05:57:28PM +0100, Dominique Faure wrote:
> Hi,
> I think I've found more a typo than a real bug in pmwiki-2.0beta10:
> In file 'pmwiki.php' at line 73, you defines:
> ===8<------------------------------------------------------------
> $RecentChangesFmt = array(
>  'Main.AllRecentChanges' =>
>    '* [[$Group.$Name]]  . . . $CurrentTime $[by] $AuthorLink',
>  '$Group.RecentChanges' =>
>    '* [[$Group/$Name]]  . . . $CurrentTime $[by] $AuthorLink');
> ===8<------------------------------------------------------------
> Then few lines after (97):
> ===8<------------------------------------------------------------
> $DefaultGroup = 'Main';
> ===8<------------------------------------------------------------
> IMHO, $DefaultGroup should be defined before $RecentChangesFmt and
> in this last's initialization, 'Main.AllRecentChanges' should be
> changed to '$DefaultGroup.AllRecentChanges' to complete the default
> group redefinition feature.

Actually, it's not a bug--it's designed this way on purpose.  
Several comments:

1.  This has actually come up in the past and the current implementation
    is deliberate.  We want to avoid the "surprise" that an adminstrator
    may have when he/she changes $DefaultGroup and then later discovers
    that Main.AllRecentChanges is no longer working and has no indication
    of why it's not working.  (Avoid "Spooky action at a distance")

2.  It doesn't matter if $DefaultGroup is defined before or after
    $RecentChangesFmt, as the substitution takes place (via FmtPageName)
    when the recent changes files are being written, not when the
    variable is being set.  It has to be this way, otherwise a customized
    setting for $DefaultGroup (which comes later) would never take effect.

3.  Just changing Main.AllRecentChanges to be $DefaultGroup.RecentChanges
    wouldn't complete the group redefinition feature -- we'd also have
    to figure out what to do with Main.SearchWiki, Main.PageNotFound,
    Main.SideBar, and the other things that are tied by default to 
    group Main.

However, it would probably be very worthwhile to write a cookbook recipe
that describes all of the steps that would be involved in completely
changing everything that is in "Main" to the $DefaultGroup.


More information about the pmwiki-users mailing list