From MediaWiki.org
Jump to: navigation, search

Other languages:
Deutsch • ‎English • ‎español • ‎français • ‎日本語 • ‎polski • ‎sicilianu • ‎中文
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
Auto Wiki Dump

Release status:Extension status beta

DescriptionTemplate:Extension#description Writes a wiki page to a file when it is updated
Author(s)Template:Extension#username Thomas Lorentsen (matxtalk)
Latest versionTemplate:Extension#version 0.1 (2008-04-18)
MediaWikiTemplate:Extension#mediawiki 1.11
LicenseTemplate:Extension#license GPL
Download Scroll down
Hooks usedTemplate:Extension#hook

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

Check usage and version matrix.

What can this extension do?[edit]

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.


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


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

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


 * 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();