From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual
Crystal Clear action run.png
Auto Wiki Dump

Release status: beta

Description Writes a wiki page to a file when it is updated
Author(s) Thomas Lorentsen (matxtalk)
Latest version 0.1 (2008-04-18)
MediaWiki 1.11
License GPL
Download Scroll down
Hooks used

Translate the AutoWikiDump extension if it is available at translatewiki.net

Check usage and version matrix; code metrics

What can this extension do?[edit | edit source]

When a page is updated, this extension can write the wiki text to a file. This allows access to the wiki text without logging into mediawiki.

Usage[edit | edit source]

Below lets you configure which pages you want saved to a file.

$awd_config = array();
$awd_config["Testwikidump"]["filename"] = 'testfile.txt';
$awd_config["Testwikidump"]["on"] = true;

Make sure the file has write permission set.

chmod a+rw testfile.txt

Installation[edit | edit source]

To install this extension, add the following to LocalSettings.php:

$awd_config = array();
$awd_config["Wikipagename"]["filename"] = 'testfile.txt';
$awd_config["Wikipagename"]["on"] = true;

Code[edit | edit source]

 * Usage
 * Create file wiki write rights.
 *  chmod a+rw testfile.txt
 * $awd_config = array();
 * $awd_config["Testwikidump"]["filename"] = 'testFile.txt';
 * $awd_config["Testwikidump"]["on"] = true;
 * @author Thomas Lorentsen
if( !defined( 'MEDIAWIKI' ) ) {
  echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" );
$wgHooks['ArticleSaveComplete'][] = 'fnAutoWikiDump';
function fnAutoWikiDump(&$article, &$user, &$text, &$summary, &$minoredit, 
			&$watchthis, &$sectionanchor, &$flags, &$revision){
  global $awd_config;
  $awd_title = $article->getTitle();
  if ($awd_config["$awd_title"]["on"]) {
       and $awd_config["$awd_title"]["on"] == true) {
      $myFile = $awd_config["$awd_title"]["filename"];
      $fh = fopen($myFile, 'w');
      $stringData = $text;
      fwrite($fh, $stringData);
  return true;
 * Gets the requested wiki page
 *  $page the wiki page
 * returns the requested wiki page
function awd_getContent($page) {
  global $wgOut, $wgTitle, $wgParser;
  $titleFromText = $wgTitle->newFromText($page);
  $article = new Article($titleFromText);
  return $article->getContent();