MediaWiki::DumpFile(3pm) | User Contributed Perl Documentation | MediaWiki::DumpFile(3pm) |
MediaWiki::DumpFile - Process various dump files from a MediaWiki instance
use MediaWiki::DumpFile; $mw = MediaWiki::DumpFile->new; $sql = $mw->sql($filename); $sql = $mw->sql(\*FH); $pages = $mw->pages($filename); $pages = $mw->pages(\*FH); $fastpages = $mw->fastpages($filename); $fastpages = $mw->fastpages(\*FH); use MediaWiki::DumpFile::Compat; $pmwd = Parse::MediaWikiDump->new;
This module is used to parse various dump files from a MediaWiki instance. The most likely case is that you will want to be parsing content at http://download.wikimedia.org/backup-index.html provided by WikiMedia which includes the English and all other language Wikipedias.
This module is the successor to Parse::MediaWikiDump acting as a near full replacement in feature set and providing an independent 100% backwards compatible API that is faster than Parse::MediaWikiDump is (see the MediaWiki::DumpFile::Compat and MediaWiki::DumpFile::Benchmarks documentation for details).
This software is maturing into a stable and tested state with known users; the API is stable and will not be changed. The software is actively being maintained and improved; please submit bug reports, feature requests, and other feedback to the author using the bug reporting features described below.
Return an instance of MediaWiki::DumpFile::SQL. This object can be used to parse any arbitrary SQL dump file used to recreate a single table in the MediaWiki instance.
Return an instance of MediaWiki::DumpFile::Pages. This object parses the contents of the page dump file and supports both single and multiple revisions per article as well as associated metadata. The page can be parsed in either normal or fast mode where fast mode is only capable of parsing the article titles and text contents, with restrictions.
Return an instance of MediaWiki::DumpFile::FastPages. This class is a subclass of MediaWiki::DumpFile::Pages that configures it to fast mode by default and uses a tuned iterator interface with slightly less overhead.
MediaWiki::DumpFile now runs in a slower configuration when installed with out the recommended Perl modules; this was done so that the package can be installed with out a C compiler and still have some utility. As well there is a fast mode available when parsing the XML document that can give significant speed boosts while giving up support for anything except for the article titles and text contents. If you want to decrease the processing overhead of this system follow this guide:
The result of my research into XML parsers was to create XML::TreePuller which is the heart XML processing system of MediaWiki::DumpFile::Pages - it's fast but I'm positive there is room for improvement. Increaseing the speed of that module will increase the speed of MediaWiki::DumpFile::Pages as well.
Please consider sharing the results of your hacking with me by opening a ticket in the bug reporting system as documented below.
The following test cases are notable and could be used by anyone who just needs to extract article titles and text:
See MediWiki::DumpFile::Benchmarks for a comprehensive report on dump file processing speeds.
Tyler Riddle, "<triddle at gmail.com>"
In the case of the comprehensive English Wikipedia dump files the file itself is measured in the terabytes and a single entry can be 20 gigabytes or more. It is technically possible for the original Parse::MediaWikiDump::Revisions (not the compatibility version provided in this module) to parse that dump file however Parse::MediaWikiDump runs at a few megabytes per second under the best of conditions.
Please report any bugs or feature requests to "bug-mediawiki-dumpfile at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MediaWiki-DumpFile>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc MediaWiki::DumpFile
You can also look for information at:
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=MediaWiki-DumpFile>
<http://annocpan.org/dist/MediaWiki-DumpFile>
<http://cpanratings.perl.org/d/MediaWiki-DumpFile>
<http://search.cpan.org/dist/MediaWiki-DumpFile/>
All of the people who reported bugs or feature requests for Parse::MediaWikiDump.
Copyright 2009 "Tyler Riddle".
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
2021-01-09 | perl v5.32.0 |