[Pmwiki-users] Fwd: about the makeWikiPage script...

Tom Hoover tom
Fri Sep 26 07:02:17 CDT 2003


On Wed, Sep 24, 2003 at 10:58:40AM -0400, Crisses wrote:
> (Note I attempted to send a mail to the author of the script over a 
> month ago first, if he's here, HELP? :) )

I'm sorry, but I don't remember receiving an email from you...anyway,
I'm here!  :-)

> Is anyone using the makeWikiPage script?

Me

> 1) I had to include a PATH="..." statement in the bash script because 
> the bash script was not locating all the programs called by the script. 
>  For safety's sake it might be a good inclusion in the script...  Mine 
> is:
> 
> PATH="/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin:."

I run Debian Linux here.  I use standard *nix utilities in the bash
script, and all are found in either /bin or /usr/bin on my system.  I
assumed (and maybe incorrectly) that these utilities are found in the
path of all *nix systems.  I won't add path statement to the script, as
there's no way I can come up with one that would work with everyone's
system.  I will, however, add a note to the script that the user ensure
that all the utilities used are available on the PATH.

> 2) wiki file names are broken from what I can tell.  If I write a 
> normal subject line like "Help Me" and send it to the wiki, it comes 
> out as a journal entry (which I renamed to "Update-YYYYMMDD" afterwards 
> by altering the relevant line in the script).  So now, it's appending 
> correctly, it's writing to journal named wiki pages correctly, but the 
> only thing it ISN'T doing is listening to the subject line of the 
> emails.

If it's not recognizing the subject line, then procmail isn't passing
the subject line to the script.  You can see from the following snippet
of the script, that the journal entry is only created if the subject is
not passed to the script on the command line:

 if [ -z "$1" ]      #is filename blank?  if so, create journal entry
 then
   FileName=`date +$WikiGroup.Journal-%Y%m%d`

> stripping "Re" will leave in ": " on my emails) so I'm unable to debug 
> that aspect of the script.  It's possible the stripping is there 
> somewhere, and I'm just not recognizing it.

FYI, ':' is stripped out by 'tr' down in the script.

> Alternatively, I was wondering if PmWiki might not be able to run a 
> script that grabs text files created by a procmail recipe in a special 
> folder:
> 
> procmail sends the mail to a bash script that creates a text file in a 
> folder, let's say a folder named "newmail" in the PmWiki folder.
> each time PmWiki is run, it checks if "newmail" folder is empty
>    when the folder is NOT empty, it takes the text files and creates 
> new pages from them
>    it moves the processed file(s) to "oldmail" so that the newmail 
> folder will be empty when it's done.

That may a possibility.

> This helps preserve recent changes, all recent changes, etc. in the 
> wiki...otherwise the new pages created are entirely orphaned.

Correct...pages added by my script will not show up in recent changes.
I, however, run another cron job that creates an index of these new
pages.  This essentially provides me with an 'inbox' of pages that I
want to edit/cleanup, at which time they are integrated into the rest of
my wiki.  You can also use PmWiki to locate orphaned files.

> As for the changing of ownership/permissions on files by using a 
> cronjob: I'm unlikely to get my hosting service to allow me to add a 
> cronjob that runs every 5 minutes to reset ownership of files...is this 
> necessary?  Is there another way of doing that portion automatically?

Sorry, the cronjob is necessary due to my using the bash script.  The
script creates the wiki pages with the ownership of the user who ran
.procmail on the message.  The pages, at that point, are readable by
PmWiki, but cannot be edited.  In order for PmWiki to edit the pages,
they must be owned by the user that runs your webserver (on my system,
Apache is run by www-data).  Therefore, the current setup requires the
ownership to be reset.

This was a quick hack, but I'll see about creating a PmWiki
plugin, which will take care of the ownership issues.  One reason I
haven't bothered to look into this so far, is that the script handles
'appending' data to the end of existing wiki pages, rather than replacing
all text on the page.  It will probably be at least a couple of weeks
before I have time to create a plugin with the same functionality.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://contra.vosn.net/pipermail/pmwiki-users_pmichaud.com/attachments/20030926/d91c44c7/attachment.bin


More information about the pmwiki-users mailing list