Extension:External Data/Presets

A preset is a preconfigured data source found in the includes/presets directory. Most of presets describe a connection to a Docker container, Dockerfile's and docker-compose.yml snippets for which are also provided. Presets can be used to test the extension for regressions, retrieving some reference data or (with the tag emulation mode) embedding media content, especially various charts, replacing many specialised MediaWiki extensions.

Containers

edit

Most of the presets describe connections to dockerised applications. Some images for containers are pulled from Docker Hub, but four images have to be built from enclosed Docker files (not yet published at https://hub.docker.com):

Path to Dockerfile Description
includes/presets/postgresql/Dockerfile PostgreSQL server with DVD rental test database preinstalled
includes/presets/mssqlserver/Dockerfile Microsoft SQL Server with Northwind test database preinstalled
includes/presets/mongodb/Dockerfile MongoDB with USA postal zip codes test database preinstalled
includes/presets/cgi/Dockerfile A universal Dockerfile for wrapping various (with different build arguments) reference or media applications (Alpine APK packages, downloadable binaries, compiled C/C++ and Go, node.js, Python PIP packages) with a CGI script, converting them into web services

Parameters necessary to build and start containers are given in the included docker-compose.yml file: includes/presets/docker-compose.yml.

The containers can either be parts of the same Dicker compose/Docker swarm setup as the MediaWiki application and its frontend (if any), which is the preferred way, or can interact with a standalone MediaWiki installation.

Testing presets

edit

Testing presets are created to manually test this extension for regressions. A single testing preset can be activated with $wgExternalDataSources['preset name'] = \ExternalData\Presets\Test::source( 'preset name' ); in LocalSettings.php. To activate them all, add wgExternalDataSources['load test presets'] = true;.

Name Software Type Dockerfile External resource
ldap LDAP LDAP ldap.forumsys.com
local mySQL Database with prepared statements Wiki's database (externallinks and iwlinks joined with interwiki tables)
rfam mySQL Database mysql-rfam-public.ebi.ac.uk
rfam_prepared mySQL Database with prepared statements mysql-rfam-public.ebi.ac.uk
rfam_prepared_multiple mySQL Database with prepared statements (several per connection) mysql-rfam-public.ebi.ac.uk
secret mySQL Database with prepared statements (hidden data source) mysql-rfam-public.ebi.ac.uk
postgresql PostgreSQL PostgreSQL includes/presets/postgresql/Dockerfile with DVD rental example database
postgresql_prepared PostgreSQL PostgreSQL (prepared statements) includes/presets/postgresql/Dockerfile with DVD rental example database
mssqlserver Microsoft SQL Server MS SQL Server includes/presets/mssqlserver/Dockerfile with Northwind example database
mssqlserver_prepared Microsoft SQL Server MS SQL Server (with prepared statements) includes/presets/mssqlserver/Dockerfile with Northwind example database
mongodb MongoDB MongoDB includes/presets/mongodb/Dockerfile with USA postal zip codes database
file JSON file File extension.json of this extension
directory directory listing Directory includes directory of this extension

Reference presets

edit

Reference presets give the wiki access to certain software that can be used for reference. A single reference preset can be activated with $wgExternalDataSources['preset name'] = \ExternalData\Presets\Reference::source( 'preset name' ); in LocalSettings.php. To activate them all, add wgExternalDataSources['load reference presets'] = true;. Most of these datasources are technically web accessors to a CGI container (includes/presets/cgi/Dockerfile).

Name Software
man man
whatis man
apropos man
apk info Alpine apk info
apk dot Alpine apk dot (best with Graphviz)
whois whois
composer show composer show
youtube-dl youtube-dl serving video metadata as JSON
mmdbinspect mmdbinspect
tzdata tzdata
flags A service that provides SVG country flags for their codes invoked with ‎<flag iso2="il" width="80" height="40" />
pdf2txt pdfminder

Media presets

edit

Media presets give the wiki access to certain multimedia software, mostly various charts. A single media preset can be activated with $wgExternalDataSources['preset name'] = \ExternalData\Presets\Media::source( 'preset name' ); in LocalSettings.php. To activate them all, add wgExternalDataSources['load media presets'] = true;.

Most of these datasources are technically web accessors to a CGI container (includes/presets/cgi/Dockerfile).

Most of the data sources serve SVG that is embedded into wikitext. For that reason, the data sources work in tag emulation mode. Using the {{#tag:...}} syntax, the source code for the multimedia content can be generated dynamically.

Some of the extensions, in addition to the server part, have a client part in JavaScript that makes the multimedia interactive in user's browser. That means that the directory containing the JavaScript has to be mounted into web frontend container (or otherwise made servable by it).

Name Software Tag Scripts URL Comment
mathjax MathJax ‎<mathjax display="inline"
nomenu>e = mc ^ 2‎</mathjax>
/js/mathjax Uses the same container as MathJax extension, but lacks many features of it, therefore, not ‎<math>...‎</math>
lilypond Lilypond ‎<score size>(musical score)‎</score> Replaces most of the features of Score
zint zint ‎<barcode type="ISBNX"
background="00000000" foreground="000000"
rotate="0" scale="1.0">
(barcode data)‎</barcode>
graphviz GraphViz ‎<graphviz layout="dot">
(dot notation)‎</graphviz>
Replaces any GraphViz extension, adding features like wikilinks and images. The uploads directory has to be mounted into the container for the latter feature
mscgen mscgen ‎<mscgen>(mscgen notation)‎</mscgen> Shows mscgen diagrams with wikilinks
plantuml PlantUML ‎<plantuml>(PlantUML notation)‎</plantuml> Replaces the PlantUML extension; allows wikilinks
ploticus Ploticus ‎<ploticus scale="1" fontsize="4" title="">
(Ploticus notation)‎</ploticus>
Replaces the Ploticus extension; allows wikilinks
timeline EasyTimeline ‎<timeline>(EasyTimeline notation)‎</timeline> /js/ploticus Replaces the EasyTimeline extension
gnuplot gnuplot ‎<gnuplot width="600" height="400"
size="10" name="gnuplot"
heads="butt">(gnuplot notation)‎</gnuplot>
/js/gnuplot Replaces the Gnuplot extension; allows to scale and move the graph in the browser
vega Vega ‎<graph width="600" height="600"
currency="₽" yaml>(JSON Vega config)‎</graph>
/js/vega Replaces the Graph extension; allows to use YAML
mermaid Mermaid ‎<mermaid width="800" height="600"
scale="1" theme="default" look="classic"
background="white">(MMD notation)‎</mermaid>
/js/mermaid Replaces the Mermaid extension and Flex Diagrams's Mermaid feature
bpmn BPMN ‎<bpmn width="400" height="300"
scale="1" title="BPMN diagram">
(BPMN XML)‎</bpmn>
Replaces the Flex Diagrams's BPMN feature. Uses bpmn2svg program by Pierre Schwang
echarts Apache ECharts ‎<echarts width="400" height="300"
locale="$wgLanguageCode"
theme="macarons" yaml>
(JSON EChart config)‎</echarts>
/js/echarts Replaces the ECharts extension; allows to use YAML