ReindexCategories

Summary: Update link targets and page index for PmWiki 2.3.0
Version: 20220122
Prerequisites: PmWiki 2.3.1 or later
Status: beta
Maintainer: Petko
License: GPL
Categories: Administration
Users: +1 (view / edit)

Description

Update link targets and page index for PmWiki 2.3.0.

PageLists in PmWiki 2.3.0 are capable of finding pages in categories, when the page contains a category markup [[!MyCategory]] while ignoring pages containing simple links [[Category/MyCategory]].

This requires the pages to be reindexed, which happens after a page is edited and saved.

This recipe allows a wiki administrator to reindex all pages in bulk.

Installation

  1. Update to PmWiki 2.3.1 or later.
  2. Disable Cookbook:PageListMultiTargets if you have it.
  3. Place reindexcat.phpΔ in your pmwiki/cookbook directory.
  4. Add to local/config.php this code:
    if ($action=="reindexcat") {
      include_once("cookbook/reindexcat.php");
    }

Usage

First and foremost, create a backup snapshot of your wiki.d directory, for example, create a ZIP archive with it. In case something goes wrong, you'll be able to revert to your previous state.

As administrator, open a URL on your website like pmwiki.php?action=reindexcat or index.php?action=reindexcat or ...wiki/Main/HomePage?action=reindexcat

The recipe will find all pages that have category links of the old format, will regenerate the link targets with the new format, and will save the pages that need updating, and will queue them for updating the wiki.d/.pageindex file.

You'll see a report listing the pages reviewed, written, or skipped.

If it makes sense for your wiki, you can edit the page Category.GroupFooter and change the pagelist directive to use category={*$Name} instead of link={*$FullName}.

Notes

Depending on the number of your pages, and the server hardware, this may take several seconds. If this hits the System limits, reload the page until it finishes.

If the processing takes longer than 10 seconds, the function will skip the remaining pages and will list them, with the message to reload the page to continue.

Change log / Release notes

  • 20210121 Instead of deleting the full page index, now only the modified pages will be queued for update. List skipped pages due to timeout.
  • 20211223 First release, having been used on my home wiki and on pmwiki.org.

See also

  • Reindex   Force re-creation of entire .pageindex

Contributors

Written and maintained by Petko

Comments

See discussion at ReindexCategories-Talk?

User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.