1 of 26

PagePort

Installable MediaWiki pages

PX

COMPATIBLE

READY

GitHub

2 of 26

Repeated efforts

Packages

We recreate the same elements to deliver the same feature to many projects:

  • Templates
  • Forms
  • Properties
  • Categories
  • Widgets
  • Styles
  • Scripts

What if we can make our work reusable across projects?

3 of 26

Implementation

>�1.30

REQUIRED

MediaWiki

ZIP

OPTIONAL

PHP

PagePort provides a maintenance script to export and import a collection of wiki pages.

PX

JSON

GIT-BOOK

4 of 26

Exporting to git-book format

From a category

From a list

From the entire wiki

php maintenance/exportPages.php --category Test --out ~/export/

php maintenance/exportPages.php --pagelist pages.txt --out ~/export/

php maintenance/exportPages.php --full --out ~/export/

--zip ~/full.zip

ZIP

READY

GitHub

5 of 26

Git-book Directory Structure

PagePort creates a directory for each namespace and adds a file for each page.

File naming follows a pagename.mediawiki convention and the namespace is the directory name :

  • Main
    • Ratings.mediawiki
  • Template
    • RatingWidget.mediawiki
    • Rating.mediawiki
  • Form
    • Rating.mediawiki …

6 of 26

Exporting a PageExchange JSON

From a category

From a list

If omitted, the filename will be autogenerated based on the time() function

php maintenance/exportPages.php --category Test --out ~/export/

php maintenance/exportPages.php --pagelist pages.txt --out ~/export/

test.json --json

list.json --json

PX

COMPATIBLE

php maintenance/exportPages.php --category Test --json

7 of 26

Exporting a PageExchange JSON

Rewrite pages URLs to point them to a GitHub repository at "some/Git-BookRepo":

php maintenance/exportPages.php --category Test \

--out ~/export/test.json --json --github "some/Git-BookRepo"

PX

COMPATIBLE

READY

GitHub

8 of 26

Exporting a PageExchange JSON

Package metadata can be added right here:

PX

COMPATIBLE

php maintenance/exportPages.php --category Test --out ~/export/test.json --json \

--version 1.0 --package "MyPackage" --desc "My description" \

--extensions "SemanticMediaWiki,PageForms" \

--dependencies "OtherPackage,AlienPackage"

9 of 26

Other nifty stuff

--clean

PagePort will clean up its working directory before exporting a new collection

10 of 26

Other nifty stuff

PagePort can even delete pages from the wiki based on a gitbook structure

php maintenance/deletePages.php --source "~/export"

11 of 26

Development automation

Internal

PX compatibility and dependencies check.

INCLUDED

CI

TESTS

12 of 26

Integrity

In many aspects PagePort acts as a real package manager

PACK

REMOVE

INSTALL

13 of 26

Integrity

In many aspects PagePort acts as a real package manager

CHECK DEPENDENCIES

PACKAGES

EXTENSIONS

14 of 26

PagePort

RATINGS PACKAGE

  • SemanticMediawiki
  • SemanticResultFormats
  • MyVariables
  • PageForms

REQUIRES

EXAMPLE

15 of 26

Ratings

autoedit

average

PF

SMW

custom NS

MW

PAGEID/USERNAME

16 of 26

Installation

Clone the repo:

Navigate to the MediaWiki root directory:

Import the pages:

git clone https://github.com/WikiTeq/mediawiki-ratings.git ~/mediawiki-ratings

cd /mediawiki

php extensions/PagePort/maintenance/importPages.php --source ~/mediawiki-ratings

17 of 26

We only need to explain where our page code resides

PageExchange

  • Adds a GUI for “packages” installation / uninstallation:
    • Special:Packages

  • Ensures that pages in the MediaWiki namespace needed for the package functionality are loaded:
    • .css
    • .js
    • custom system messages

by YARON KOREN

18 of 26

We only need to explain where our page code resides

Point to the JSON location in LocalSettings.php:

$wgPageExchangePackageFiles[] = 'https://raw.githubusercontent.com/WikiTeq/mediawiki-ratings/master/page-exchange.json';

PX

COMPATIBLE

--github

Remember our JSON

is aware of our repo

19 of 26

Package Management GUI

PX

Special:Packages

Our first attempt

has failed …

  • Missing namespaces
  • Unmet dependencies
    • Extensions
    • Other packages

20 of 26

Package Management GUI

PX

Special:Packages

CAN INSTALL

21 of 26

Package Management GUI

PX

Special:Packages

INSTALL

22 of 26

Package Management GUI

PX

Special:Packages

JOB QUEUE

23 of 26

Package Management GUI

+

PX

Special:Packages

UPDATE DB

JOB QUEUE

24 of 26

Package Management CLI

PagePort

Clean up the working directory and clone again /

update existing local repo

git pull

--clean / git clone

php extensions/PagePort/maintenance/importPages.php --source ~/mediawiki-ratings

25 of 26

Package Management CLI

PagePort

deletePages.php

Delete pages from wiki based on a git-book structure

php maintenance/deletePages.php --source ~/mediawiki-ratings

26 of 26

Thank You!

Ike Hecht + WikiTeq