Tools
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.
Configuration
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)(.*)/' \ '|lucro$1$2$3'
Other options:
./replace.php --help
You can see some [examples](./examples).
Mega export XML - mega-export-xml.php
This is a script that acts similar to the [[Special:Export]] page, but exporting the full page history, without any server-side time or dimension limitation.
Note that you have to provide your user credentials in the config.php script in order to download more than 50 revisions at time.
Usage: ./mega-export-xml.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-xml.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.
Mega export CSV - mega-export-csv.php
This is a script that acts similar to the [[Special:Export]] page, but exporting the full page history in CSV format and not in XML. This is executed without any server-side time or dimension limitation.
Note that you have to provide your user credentials in the config.php script in order to download more than 50 revisions at time.
Usage: ./mega-export-csv.php --wiki=WIKI --file=export.xml [OPTIONS] Page_title Allowed OPTIONS: --wiki=VALUE Available wikis: commonswiki, dewiki, enwiki, eswiki, frwiki, itwiki, landscapeforwiki, metawiki, wikidatawiki, wmch --limit=VALUE Number of revisions for each request (default VALUE: 100) --file=VALUE Output filename (default VALUE: export.xml) --help|-h Show this help and quit
E.g. to download the full history of the Software libero page:
./mega-export-csv.php --wiki=itwiki --file=out.csv "Software libero"
The output file will be something like this:
Date,Time,Dimension,"User ID","User name",Comment 2023-01-28,18:11:50,123,"Pippo",321,"/* Confronto con software proprietario */ Fix"
- Last Author
- valerio.bozzolan
- Last Edited
- Mar 6 2023, 21:48