[pmwiki-users] Rethinking $RecipeInfo (was: Keeping recipes up to date)

Patrick R. Michaud pmichaud at pobox.com
Thu Feb 15 13:07:33 CST 2007


On Thu, Feb 15, 2007 at 08:37:23AM -0600, Patrick R. Michaud wrote:
> On Thu, Feb 15, 2007 at 09:18:25AM +0100, Jiri Hladůvka / OBUTEX wrote:
> > Patrick R. Michaud napsal(a):
> > >Over time many people have asked for a way to keep track of
> > >when new versions of recipes become available on pmwiki.org .
> >
> > I have a lot of recipes installed but only 4 lines are displayed by 
> > RecipeUpdates recipe.  Maybe I have old recipes (not having 
> > version identification) while there is the newer version
> > in PmWiki.org already equipped with version info.
> 
> [...] if a script in cookbook/ hasn't been loaded by the
> local configuration, we don't yet have a way to be able
> to determine any version information for that script.

In thinking about this further, since I suspect there may
be a lot of sites that load recipe scripts only in certain
situations (e.g., only in a particular group or in response
to specific ?action= requests), perhaps we need to rethink
the whole $RecipeInfo approach.

I now see that a limitation of the $RecipeInfo array approach
is that it's effective only when a script is actually
loaded, which is a problem for sites (like pmwiki.org)
that selectively load recipes.  What we really want is a way 
to statically detect version information in a script
without actually loading it.

It's relatively easy to scan the files in cookbook/ for
strings matching a given pattern, so perhaps we just
need a way of specifying recipe information in the comments
of script files.  Perhaps something as simple as...?

    # RecipeInfo: Name=RandomQuotes Version=2007-02-15 

Then, recipeupdates.php would scan the files in cookbook/ 
for "RecipeInfo:" strings and process them to get the
recipe name and version information for any recipes that
weren't already loaded.

Most recipes could then simply provide a RecipeInfo:
line in the comments instead of explicitly setting
values of $RecipeInfo.

For scripts that don't normally appear in cookbook/ (e.g., skins),
we could continue to support the $RecipeInfo array in order
for them to have versions checked.  Or we could encode
optional RecipeInfo information in skin templates, which scripts/skins.php
can automatically extract when the template is loaded:

    <!-- RecipeInfo: Name=LeanSkin Version=2007-02-15 -->

Comments?  Anyone see any better answers, or think that this 
might be too much trouble to go to?

Pm



More information about the pmwiki-users mailing list