[pmwiki-users] Batch-mode for PmWiki?

jens at quefaire.de jens at quefaire.de
Mon Nov 30 14:20:55 CST 2015

Dear Hans,
Zitat von Hans <design1 at softflow.uk>:

> This is a developer question:
> I am working on a recipe to create static HTML pages from within
> PmWiki. The purpose is to have a "mirror" of a wiki site as static
> pages to be served to the public, as the saving of dynamic PHP pages
> is taking too long now on the shared hosting site I am using (10 to 15
> seconds for one page, compared to about 1 second for a static HTML
> page).

I'm the author of JjsCMS <http://www.pmwiki.org/wiki/Cookbook/JjsCMS>.  
JjsCMS was my first attempt at publishing a pmwiki as static html  
pages. It's a bit complicated to set up, especially due to the rules  
that are needed to strip unwanted elements from the output, but did  
the job for me until the static publishing became too limited my  

There's a small additional recipe  
<http://www.pmwiki.org/wiki/Cookbook/JJSApprovePage> that is meant to  
make it possible to limit publishing to selected pages that carry an  
"approved" attribute.

The more advanced version of JjsCMS I'm using as of today implements a  
much cleaner method of saving stripped wiki files from the "private"  
source pmwiki into the pagestore of a limited public instance of pmwiki.

> I can create a satisfactory single HTML page via a custom
> action, or as part of the normal page update via $EditFunctions.
> When I want to create multiple HTML pages in one go via another custom
> action, my function is calling the single-page HTML export function
> repeatedly, which is nearly satisfactory, but not quite.
> The problem is that page variables are getting evaluated only once,
> for the page first calling the handler function. Is there a way to
> make PmWiki "restart" after every page processed, to evaluate page
> variables fresh for every page, some kind of batch mode?
> I cannot see this in the code, so would be very grateful for some
> hints!

In order to iterate over many (all) pages without running into a  
server timeout, I wrote JJSIterator  
<http://www.pmwiki.org/wiki/Cookbook/JJSIterator>. It allows to  
iterate over all wiki pages and thereby saving the static version with  
JjsCMS. JJSIterator is driven by the client, so it isn't of any help,  
if you expect the export to be initiated and completely controlled by  
the server.

> Perhaps I can add a second question here:
> The exported static HTML pages are only meant for general public view,
> i.e. corresponding to a site visitor having "read" authorisation, not
> any "edit" authorisation. The page look is accordingly, without any
> "action" links and toolbars etc. The two custom actions for single and
> multiple HTML page export need "edit" or "admin" authorisation.
> It would be very useful, when the HTML export function is running, to
> have it process the page as if it is read-only, but the function is
> running with "edit" or "admin" authorisation. Can this be possible?

Perhaps the simplest solution would be to mirror the wiki with a tool  
like wget or curl?
> This would be useful, because one would not need to insert
> custom conditional markup into wiki pages, to suppress the page parts
> which are for editors or admins only.
Please feel free to contact me - unfortunately I'm not able to monitor  
the ...Talk pages of my recipies.


More information about the pmwiki-users mailing list