[pmwiki-users] anti-spam multi-page-restore tool

Peter & Melodye Bowers pbowers at pobox.com
Sun Mar 30 05:21:48 CDT 2008


>For example -- suppose I'm webmaster for a soccer club and want to be 
>able to offer team websites to the teams of the club.  I create a 
>GenericTeam group with a couple basic pages to get them started.  
>Then when the 'SpeedyDemons' want a team site, all I do is go to 
>the WikiMaster utility, and create SpeedyDemons team site from 
>GenericTeam, done deal, the Speedy Demons have their team web site...   
>Ideally, one could perhaps even automate a variant of WikiMaster so 
>SpeedyDemons could sign up for their own team site, with the proper
password. 
 
There are tools out there that can already do this ( i.e.,  I'm pretty sure
I've read that fox  has significant template file capabilities)...  Here's
how you would do it with WikiSh:
 
Create your templates in some (presumably protected) group.  Let's say
GenericTeam.Page1 and GenericTeam.Page2.  Then on GenericTeam.Admin you
would put this markup:
 
===(snip GenericTeam.Admin)===
{(wikish_form QUICKFORM PROCESS)}
New Group: 
(:input text name=GroupName:)\\
(:input submit name=submit value=Create:)
 
{(wikish source {$FullName}#validate)}
 
(:if false:)
[[#validate]]
if test -n "${submit}"
then
   if ! test -n "${GroupName}"
   then
      echo "ERROR: Must specify the new group name."
   else
      if test -f ${GroupName}.Page1 || test -f ${GroupName}.Page2
      then
         echo "ERROR: ${GroupName} already exists."
      else
         echo "Creating New Team Page...\\\n\\\n"
         cp GenericTeam.Page1 GenericTeam.Page2 ${GroupName}
         echo "\\\n\\\n...DONE!"
      fi
   fi
fi
[[#validateend]]
(:if:)
 
(:messages:)
===(snip)===
 
If you are going to let other people create the groups then you might want
to do some other validations on the group name (no disallowed characters,
etc), but this will get you the basic operation and you can fine-tune it
from there.
 
-Peter
 
PS If you use this to test a bunch of times and if you don't have command
line access to your server then you are also going to want to use the {(rm
...)} command which comes with WikiSh to get rid of all your new test pages
at the end.  For instance, I created a Lions, Lion2, Lion3, etc group during
my testing.  When I was done I went to the control panel and ran the command
"ls Lion?.*" to see which files would be affected by that wildcard pattern
-- it was right so I changed the "ls" to "rm" and ran "rm Lion?.*" and that
deleted them all.  If you don't want the backup files
(Lion2.Page1,del-123456123) then use "rm -f Lion?.*" instead.




More information about the pmwiki-users mailing list