Skip to content

Feature: option to import changes for a single indexed page

Ghost User requested to merge feature/single-page into master

As they say in Hollywood: "For your consideration".

Why

Because it supports the following use cases:

  • Wiki web developers (specifically those from the khub team) have begun using pagesync as a way to develop templates directly through remote development, since the source editor on the khub wiki leaves more to be desired and some templates were getting too large to handle without syntax highlighting. This would give them the option to:
    • A - sync some changes from certain page files to the wiki while leaving others unsynced for now; instead of importing all changes at once
    • B - enable a vscode extension that runs a serverside script after a page save on the server - allowing to sync singular pages automatically after saving
  • It presents a new solution for automatic content updates / content-side logging. Say we have an overview page which weekly queries event updates from an external source like an online agenda, or weekly tracks the disk usage of the server for maintainers. A serverside script could perform those calls and add the results in content format to a specified pagesync page - then the single-page maintenance run could be called wihtin the same script to periodically update the one page without developer input.

How

We made use of the maintenance script and added an optional parameter. The parameter takes a synced page's content file as value. When this parameter is present, it calls a new hook which is a variation of GetAllPageInfo; this searches the index for the specified page and only returns that page's data. the rest of the maintenance scripts follows as expected. If the page isn't present, or it's not in the index, the script will do nothing or produce an error message

code example

php ~/public_html/extensions/WSPageSync/maintenance/WSps.maintenance.php --user 'Maintenance script' --page '0_mypage_slot_main.wiki'

Merge request reports