Updated 40 Days AgoPublic

Command line tools in boz-mw

This is a directory for command line tools that uses the boz-mw framework. Actually there are not too much tools, but powerful.


Copy the config-example.php to config.php and fill it with your bot credentials.

Available scripts

Replace script - replace.php

This is a script to sobstitute text in the wikitext from an API query.

e.g. to transform in *farfallese* the whole Italian Wikipedia:

./replace.php --wiki=itwiki --generator=allpages \
    a afa \
    e efe \
    i ifi \
    o ofo \
    u ufu

e.g. to replace a simple template parameter in top of the page, e.g. from {{Sito web|commerciale = Sì}} to {{Sito web|lucro = Sì}}:

./replace.php \
    --wiki=itwiki \
    --generator=transcludedin \
    --titles=Template:Sito_web \
    --rvsection=0 \
    --regex \
    '/\|commerciale(.*=.*)(Sì|No|sì|no)(.*)/' \

Other options:

./replace.php --help

You can see some [examples](./examples).

Mega export - mega-export.php

This is a script that acts similar to the [[Special:Export]] page, but exporting the full page history.

Note that you have to provide your user credentials in the config.php script in order to download more than 50 revisions at time.

 ./mega-export.php --wiki=WIKI --file=out.xml [OPTIONS] Page_title
Allowed OPTIONS:
 --wiki=VALUE          Available wikis: itwiki, wikidatawiki, commonswiki, metawiki, landscapeforwiki
 --limit=VALUE         Number of revisions for each request
 --file=VALUE          Output filename
 --help|-h             Show this help and quit

E.g. to download the full history of the Software libero page:

./mega-export.php --wiki=itwiki --file=out.xml "Software libero"

Note that actually the official MediaWiki/XML format is actually mistreated at least for the heading section: you will not obtain the namespace list, the wiki name, and other unuseful things. Just revisions. Much revisions.

Last Author
Last Edited
Apr 21 2020, 08:28

Event Timeline