[pmwiki-users] SpellChecker on a Farm

Ciaran ciaranj at gmail.com
Sun Sep 17 15:30:19 CDT 2006

On 9/17/06, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> [Does anyone besides me think "Snakes on a Plane" whenever seeing
> the subject "SpellChecker on a Farm" over and over again?  ;-) ]
> > Pico wrote:
> > : JB wrote:
> > : > Pico wrote:
> > : > : I revised your edit to the documentation because there was no need
> > : > : to provide different sets of include lines for farms and
> non-farms; all
> > : > : installs can use the same line:
> > : > : include_once("$FarmD/cookbook/spellchecker.php");
> > : >
> > : > I do not think that is right.  Sometimes a local wiki which uses
> farm
> > : > recipes has one recipe that only it uses.
> > :
> > : I don't agree that this (and, for that matter, every other recipe)
> > : should have two different installation instructions for farm and
> > : non-farm installs just because someone with a farm might want to
> > : physically place the recipe in a field, instead of simply invoking it
> > : from the local field config.
> > : Does anyone think that JB has the better approach here and, if so,
> > : should it be adopted for all recipes?
> Here's what I think:
> First, I absolutely do not want to see two different farm/non-farm
> installation instructions in every recipe.
> Almost by definition, administering a wikifarm implies that the farm
> administrator be (or become) a bit more familiar with the way that
> filesystem paths and urls work in their particular farm environment.
> So, the standard instructions for a basic recipe ought to be for the
> simple non-farm case, and farm administrators should be making the
> adjustment to use include_once("$FarmD/...") as appropriate.  This
> is consistent with the way PmWiki's documentation is set up.
> Of course, if the recipe is primarily intended only for farm environments,
> then it's okay to use $FarmD/... for everything.
> On Sun, Sep 17, 2006 at 11:42:03AM -0400, Scott Connard wrote:
> > What concerns me a little more is the need to edit the source to change
> > "$PubDirUrl" to "$FarmPubDirUrl" for the SpellChecker script.  Is this
> > required for many other cookbook scripts?  Is there a way to engineer
> > a common solution for this problem?
> It doesn't happen often, as can be seen from the fact that there aren't
> many messages about such on the mailing list.
> Yes, there are ways to for recipes to make it easier on wikifarms.
> Option 1:  Use configuration variables
> --------------------------------------
> One easy way to deal with this is for the recipe itself to have its own
> configuration variable as opposed to always using $PubDirUrl or
> $FarmPubDirUrl.  Note that this is what PmWiki tends to do for its
> scripts and modules.
> In the case of the spellchecker.php recipe, it'd be a simple matter
> for it to do:
>     SDV($SpellerUrl, "$PubDirUrl/speller");
> and replace all instances of "$PubDirUrl/speller" or
> "$FarmPubDirUrl/speller" in the recipe with "$SpellerUrl".
> Someone using spellcheck.php in a farm then sets a custom value
> for $SpellerUrl prior to including the recipe:
>     $SpellerUrl = "$FarmPubDirUrl/speller";
>     include_once("$FarmD/cookbook/spellchecker.php");
> Option 2: Have the recipe detect when it's in a farm context
> ------------------------------------------------------------
> I haven't ever tried this, but one possibility might to have a recipe
> detect when it's being called in a farm context, by comparing its
> filename to the $FarmD variable.  Thus, spellchecker.php might do:
>     if (strncmp(__FILE__, $FarmD, strlen($FarmD)) == 0)
>       SDV($SpellerUrl, "$FarmPubDirUrl/speller");
>     else
>       SDV($SpellerUrl, "$PubDirUrl/speller");
> Thus, if a script does include_once("$FarmD/cookbook/spellchecker.php")
> the
> spellchecker.php script will detect that it's been called with the $FarmD
> prefix and use the $FarmPubDirUrl value, otherwise it uses $PubDirUrl.
> Note that in either case I'm initializing the configuration variable
> using SDV so that the administrator can override the default.
> One thing I do not want to see happen is that this sort of
> thing become required for recipes -- it can be listed as a guideline,
> but I don't want to be rejecting or criticizing recipe submissions
> simply because the author didn't consider wikifarms.
> > Should ALL code referencing $PubDirUrl look in $PubDirUrl first and
> > then failing that look in $FarmPubDirUrl (if it is different than
> $PubDirUrl)?
> Here lies part of the confusion between files and urls -- how exactly
> does a script look in a url (such as $PubDirUrl)?
> Pm
> P.S.:  I think the spellchecker recipe ought to standardize on either
> "speller" or "spellchecker" for its names, and not use both.
> I'll probably rewrite the recipe to do that, and to incorporate the
> $FarmD detection as given above.

It really needs to incorporate a php-only spell-checker, but there wasn't a
suitable one available at the time I originally
'ported/contributed/proposed' this recipe, however one of the links on the
recipe pages now lists 'pspellX' as a possible fall-back position, it would
be nice if the script is being re-visted to bring that on-board ?

 - Ciaran [too tied up in a .Net + Java world to fix his old PHP/PmWiki
scripts currently :( ]

> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users

- Ciaran
(I now have far too many G-Mail invites available, anyone who wants one,
gets one)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/pmwiki-users/attachments/20060917/3dfa6766/attachment.html 

More information about the pmwiki-users mailing list