Extension:WSPageSync

MediaWiki extensions manual
OOjs UI icon advanced.svg
WSPageSync
Release status: beta
Wspagesync.png
Implementation Parser extension , API
Description Export and import wiki pages
Author(s) Charlot Cobben (Sen-Saitalk)
Latest version 0.9.9.7 (14/05/2021)
Compatibility policy Master maintains backward compatibility.
MediaWiki 1.31.1 +
PHP 7+
License GNU General Public License 2.0 only
Download BitBucket Download
Readme
ChangeLog
WSPageSync

Check usage and version matrix.

The WSPageSync extension allows for storing any wiki page content to a file on the server. Allowing for it be e.g. pushed to git or bitbucket and deployed on another server. So basically a way to transport content pages from one wiki to another.

InstallationEdit

  • Download and place the file(s) in a directory called WSPageSync in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    $wgWSPageSync['filePath']=<path where to store synced files>
    wfLoadExtension( 'WSPageSync' );
    
  •   Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

ConfigurationEdit

WSPageSync needs a full path to a directory to store the file that can be synced. e.g. $IP/wspsFiles

This can be set in the localsettings as  :

$wgWSPageSync['filePath'] =  $IP . '/wspsFiles';

Make sure the map has the correct rights for WSPageSync to store files.

It is also a good practice to store these files outside of your html folder. The content of pages are stored as raw wikitext and although you can store synced files in sub folders hidden within the root, they are potentially visible.

UsageEdit

See also the Special page section below.

Basically, if you are a sysop, any page that can be synced will have a slider in the top menu. Click on it and it will turn blue indicating it is synced ( a notification will also be shown ). If the slider is already blue when you visit a page, it simply means the page is already synced and is being monitored for changes. Click the slider again for the page to be excluded from syncing.

User rightsEdit

sysop/admins are allowed to set a page to be synced. All other users have no such ability.

Special PageEdit

When you visit Special:WSPageSync as a sysop or administrator you can use a Semantic Media Query to quickly add pages to be synced from that query.

The Special Page also shows all currently synced pages.

Finally you can also delete all synced pages from the Special page. This will not delete any pages in the Wiki, only the ones stored on the server by WSPageSync.

Maintenance scriptEdit

In order to import previous exported pages there is a Maintenance script that can be run.

OptionsEdit

summary
Additional text that will be added to the files imported History.
user
Your username. Will be added to the import log. [mandatory]
use-timestamp
Use the modification date of the page as the timestamp for the edit.
overwrite
Overwrite existing pages. If --use-timestamp is passed, this will only overwrite pages if the file has been modified since the page was last modified.
rc
Place revisions in RecentChanges.

ExampleEdit

SERVER_NAME=<myservername> php extensions/WSPageSync/maintenance/WSps.maintenance.php --user 'Maintenance script' --rc --summary 'Fill database' --overwrite

ScenarioEdit

We usually have a developing environment. When developing is done, we push our code to a repository. From there we create a Docker container and we deploy it to a Testing server. From there it is deployed to an Acceptance server and finally to production.

This is all fine with PHP and or JavaScript code, but we also create templates and widgets that are fundamental for it all to work properly.

With PageSync, we can now also push our Template, Widgets or any important Wiki page to our repository. When deploying a container, the WSPageSync maintenance script is automatically run and therefore also updating pages in the Wiki.

Version historyEdit

Version 0.9.9.7

Sub special pages visual fix for most MW skins

Version 0.9.9.6

Not using user received from API anymore. Added check to only show sync button if a page can actually be synced. ( introduced by SkinTemplateNavigation::Universal )

Version 0.9.9.5

Fix for skins other than Chameleon

Version 0.9.9.4

Delete un-used translations

Version 0.9.9.1 - 0.9.9.3

Clean-up

Version 0.9.9

Initial Community release

See alsoEdit

EMWCon Spring 2021  : There was a presentation on WSPageSync. The presentation file can be downloaded. You can also watch the presentation on Youtube.