diff options
author | xue <> | 2006-10-18 01:38:47 +0000 |
---|---|---|
committer | xue <> | 2006-10-18 01:38:47 +0000 |
commit | af832a5a9018c7dcc2f24111d82049902269fc53 (patch) | |
tree | b66193de9e7b75c916a92d6c951a22a90d85fed6 /buildscripts/wikibuilder/dumpHTML.php | |
parent | 459bb9c618a8f2897da22129167e634589435e38 (diff) |
merge from 3.0 branch till 1463.
Diffstat (limited to 'buildscripts/wikibuilder/dumpHTML.php')
-rw-r--r-- | buildscripts/wikibuilder/dumpHTML.php | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/buildscripts/wikibuilder/dumpHTML.php b/buildscripts/wikibuilder/dumpHTML.php new file mode 100644 index 00000000..d34e53ed --- /dev/null +++ b/buildscripts/wikibuilder/dumpHTML.php @@ -0,0 +1,102 @@ +<?php +/** + * @todo document + * @package MediaWiki + * @subpackage Maintenance + */ + +/** + * Usage: + * php dumpHTML.php [options...] + * + * -d <dest> destination directory + * -s <start> start ID + * -e <end> end ID + * --images only do image description pages + * --categories only do category pages + * --special only do miscellaneous stuff + * --force-copy copy commons instead of symlink, needed for Wikimedia + * --interlang allow interlanguage links + */ + + +$optionsWithArgs = array( 's', 'd', 'e' ); + +require_once($wiki_dir. "/maintenance/commandLine.inc" ); +require_once(dirname(__FILE__)."/dumpHTML.inc" ); + +class DummyUser extends User +{ + function getSkin() + { + require_once(dirname(__FILE__).'/DumpSkin.php' ); + $this->mSkin =& new DumpSkin; + return $this->mSkin; + } +} + +class DumpTitle extends Title +{ + function getHashedDirectory() + { + return strtr(parent::getHashedDirectory(), '~:', '__'); + } +} + +error_reporting( E_ALL & (~E_NOTICE) ); +define( 'CHUNK_SIZE', 50 ); + +if ( !empty( $options['s'] ) ) { + $start = $options['s']; +} else { + $start = 1280; +} + +if ( !empty( $options['e'] ) ) { + $end = $options['e']; +} else { + $dbr =& wfGetDB( DB_SLAVE ); + $end = $dbr->selectField( 'page', 'max(page_id)', false ); +} + +if ( !empty( $options['d'] ) ) { + $dest = $options['d']; +} else { + $dest = $output_dir; +} + +class DumpHTMLSkined extends DumpHTML +{ + function setupGlobals( $depth = NULL ) + { + parent::setupGlobals($depth); + global $wgUser,$wgServer,$wiki_url; + $wgUser = new DummyUser; + $wgServer = $wiki_url; + } +} + +$d = new DumpHTMLSkined( array( + 'dest' => $dest, + 'forceCopy' => $options['force-copy'], + 'alternateScriptPath' => $options['interlang'], + 'interwiki' => $options['interlang'], +)); + + +if ( $options['special'] ) { + $d->doSpecials(); +} elseif ( $options['images'] ) { + $d->doImageDescriptions(); +} elseif ( $options['categories'] ) { + $d->doCategories(); +} else { + print("Creating static HTML dump in directory $dest. \n". + "Starting from page_id $start of $end.\n"); + $d->doArticles( $start, $end ); + $d->doImageDescriptions(); + $d->doCategories(); + $d->doMainPage(); +} + +?>
\ No newline at end of file |