Extension:Data Transfer

Description
Data Transfer is an extension to MediaWiki that provides a special page to let users view (and thus save) the pages in any combination of the wiki's categories and namespaces in XML form. The fields and values in the XML are taken from the fields and values in any template calls contained in the page; any non-template text is put into one or more "free text" tags. In addition, an "ID" field is also displayed for every page, using MediaWiki's internal "article ID" for that page; this is done so that outside systems can track a page with a more fixed identifier than its name (which can change often). The XML contains only the current state of any page: information on authors and dates modified, and information on previous versions of each page, are not recorded.

Two formats for export are supported: the first, or standard one, contains tags of the form  and. The second, or "simplified" one, contains tags of simply the form  and.

The extension makes light use of the Semantic MediaWiki extension, but it does not require the presence of SMW. Still, in spirit the extension could be considered a member of the Semantic MediaWiki "family", since it has the same data-centric approach to wiki content used by SMW and spinoff extensions like Semantic Forms.

A planned enhancement for the Data Transfer extension is to also support importing of pages into the wiki, using the same XML format. This will allow for the introduction of data from outside systems and databases, provided their data can be produced in the correct format. This would not be an ideal solution, however, for backing up one's wiki, or transferring data from one MediaWiki site to another; for that, the much better solution is to use MediaWiki's built-in "Special:Export" and "Special:Import" pages.

Code and download
You can download the Data Transfer code in either one of these two compressed files:


 * data_transfer_0.1.5.tar.gz
 * data_transfer_0.1.5.zip

You can also download the code directly via SVN from the MediaWiki source code repository, at http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/DataTransfer/. From a command line, you can call the following:

To view the code online, including version history for each file, you can go here.

Installation
After you've obtained a 'DataTransfer' directory (either by extracting a compressed file or downloading via SVN), place this directory within the main MediaWiki 'extensions' directory. Then, in the file 'LocalSettings.php' in the main MediaWiki directory, add the following line:

Languages supported
Data Transfer has full support for English, and partial support for Arabic, Bulgarian, Catalan, Taiwanese Chinese, Czech, Danish, Dutch, Esperanto, French, Galician, German, Greek, Hindi, Hungarian, Khmer, Luxembourgish, Marathi, Norwegian Bokmål, Norwegian Nynorsk, Pashto, Polish, Portuguese, Russian, Serbian Cyrillic, Silesian, Slovak, Swedish, Tajik, Tamil, Telugu, Tetum, Upper Sorbian and Vietnamese.

Authors
Data Transfer was written by Yaron Koren, reachable at yaron57 -at- gmail.com.

Version
Data Transfer is currently at version 0.1.5.

The version history is:
 * 0.1 - February 19, 2008 - Initial version
 * 0.1.1 - February 21, 2008 - Several small improvements; language support added for Arabic, Dutch, French, Galician, German, Luxembourgish, Norwegian Bokmål, Portuguese, Slovak, Swedish, Upper Sorbian and Vietnamese
 * 0.1.2 - February 27, 2008 - ID field added for every page; improved conversion of spaces to underscores; language support added for Bulgarian, Taiwanese Chinese, Khmer, Russian and Telugu
 * 0.1.3 - March 7, 2008 - Language support added for Japanese and Seeltersk, and improved for other languages
 * 0.1.4 - April 3, 2008 - Language support added for Catalan, Czech, Danish, Esperanto, Greek, Hungarian, Marathi, Norwegian Nynorsk, Pashto, Polish, Serbian Cyrillic, Tajik and Tetum
 * 0.1.5 - April 14, 2008 - Fixed language-value handling for MediaWiki versions before 1.11; language supported for Hindi, Silesian and Tamil

Code structure
The following are the directories and files in the Data Transfer extension:

/includes


 * DT_GlobalFunctions.php - functions and constants used by the rest of the Data Transfer code
 * DT_Settings.php - various settings for Data Transfer

/languages


 * DT_Language.php - parent class for all language files
 * DT_LanguageEn.php - English-language text
 * DT_Messages.php - Display messages for all languages

/specials


 * DT_ViewXML.php - defines the 'ViewXML' special page

Customizing the XML
You can specify that any specific page not be included in the XML produced, by adding the category tag " " to that page. You can also add this tag to a template, to exclude any page that uses that template from the XML.

If you have the Semantic MediaWiki extension installed, you can also specify that the XML for any specific page should also contain the XML for all its "children" pages; i.e., all the pages that have a specific property pointing to it. You can do this by adding the SMW property tag " Has XML grouping::property-name " to any page; in any XML displayed for that page, the XML of any page that has that property pointing to that page will be displayed within that page's XML tag. This semantic markup can also be added to templates, guaranteeing the same handling for all pages that use that template. "Has XML grouping" can also be used cumulatively. In a wiki holding information about continents, countries and cities, for example, a tag like Has XML grouping::Has continent could be added to the "Continent" template, and a tag like Has XML grouping::Has country could be added to the "Country" template. Assuming every country has a "Has continent" tag, and every city had a "Has country" tag, the XML for a single continent would contain the XML for each country within continent, and in turn would contain the XML for each city within each country in that continent.

Sites that use Data Transfer
Here are some sites that use Data Transfer:


 * Discourse DB
 * Verwaltungskooperation - Cooperation in Public Administration

Bugs and feature requests
Send any bug reports and requests to Yaron Koren, at yaron57 -at- gmail.com.

Contributing patches to the project
If you found some bug and fixed it, or if you wrote code for a new feature, please create a patch by going to the main "DataTransfer" directory, and typing:

svn diff > descriptivename.patch

Then send this patch, with a description, to Yaron Koren.

Translating
Translation of Data Transfer is done through Betawiki. The translation for this extension can be found here. To add language values or change existing ones, you should create an account on Betawiki, then request permission from the administrators to translate a certain language or languages on this page (this is a very simple process). Once you have permission for a given language, you can log in and add or edit whatever messages you want to in that language.