PmWiki: Link to List of Missing or Orphaned Pages (“Wanted Pages”)

Now this is entirely out of the usual scope of what I’m writing about here, but it was so difficult an answer to find that I just have to publish it.

The objective: Provide users with a list of all missing pages in your instance of PmWiki (sometimes called “Wanted Pages” in that huge search engine’s results), so that writers can concentrate on filling in the blanks instead of re-re-re-rewriting existing articles.

A way towards solution: One solution is PmWiki’s on-board RefCount function, which is said to need activation in config.php with include_once("$FarmD/scripts/refcount.php"); but worked without me doing anything like that in version 2.2.80 (October 2015) – or maybe I forgot that I did. Ahem. Anyways, if RefCount is active, you can use the ?action=RefCount to search for a variety of types of pages, including “All”, “Existing”, “Missing” or “Orphaned” pages.

Of course, linking to that page action doesn’t help at all when you want to provide your users with a ready-made list such as (:pagelist:) or (:searchresults:) would produce.

The solution is: Pass arguments to RefCount within the URL, that is, as a “query string”!

The answer came to me in the form of a long-buried PmWiki-users list post from 2006 by genius Kurt Devlin, which not only recommended to give the RefCount form its arguments (including “submit”!) within the query string, but also to escape the brackets when using this URL in a WikiLink:

I wound up forcing the form parameters onto the command line. My first attempt at this was using broken, but it looks like it’s working now. This
should get me by until pagelist is updated.[]=PmWiki&flist[]=PmWiki&showrefs=checked&submit=Search

To get this to work as a wiki link, I had to escape the brackets. For example,
* [[Main.HomePage?action=refcount&whichrefs=missing&tlist%5B%5D=all&flist%5B%5D=all&showrefs=checked&submit=Search | 'Most Wanted' List]]

This, however, didn’t let me filter by groups, and the first thing when I saw brackets was an intuitive – and totally wrong: “Grumph. This must be Arrrrray Thingy! Must fill edged brackets with comma-separated Group entries to filter results by. Ugh!” If I had taken a closer look at Kurt’s example, then I would immediately have seen what this stackoverflow answer points out: In query strings, you want to fill arrays by doing &myArray[]=newEntry for each new entry you want to add to that array.

Thus, to show my users all currently empty but linked to articles in their 3 Categories of interest, “SessionLogs”, “Players” and “Characters” and omit all those “missing pages” in PmWiki/ or Site/ etc.), I needed to do:

* [[Main.HomePage?action=refcount&whichrefs=missing&tlist%5B%5D=SessionLogs&tlist%5B%5D=Players&tlist%5B%5D=Characters&flist%5B%5D=all&showrefs=checked&submit=Search | Missing Pages to Edit Stuff Into]]

Et voilà! (translator’s note, because I saw it again during my search: No, it’s not written “et viola”, because it’s not about French string instruments but about something previously hidden that’s appearing suddenly)

I hope this helps someone spare the time I needed to dig it. No idea why it isn’t directly in PmWiki’s documentation of RefCount, useful as it is.

Christopher Köbel

IT / IT-Marketing / Tech in DE / FR / EN | XING Profil

Veröffentlicht in English Articles, Howtos in English Getagged mit:

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.