/** * */ function wfSpecialExport($page = '') { global $wgOut, $wgLang, $wgRequest; if ($wgRequest->getVal('action') == 'submit') { $page = $wgRequest->getText('pages'); $curonly = $wgRequest->getCheck('curonly'); } else { # Pre-check the 'current version only' box in the UI $curonly = true; } if ($page != '') { $wgOut->disable(); header("Content-type: application/xml; charset=utf-8"); $pages = explode("\n", $page); $db =& wfGetDB(DB_SLAVE); $history = $curonly ? MW_EXPORT_CURRENT : MW_EXPORT_FULL; $exporter = new WikiExporter($db, $history); $exporter->openStream(); $exporter->pagesByName($pages); $exporter->closeStream(); return; } $wgOut->addWikiText(wfMsg("exporttext")); $titleObj = Title::makeTitle(NS_SPECIAL, "Export"); $action = $titleObj->escapeLocalURL('action=submit'); $wgOut->addHTML("\n<form method='post' action=\"{$action}\">\n<input type='hidden' name='action' value='submit' />\n<textarea name='pages' cols='40' rows='10'></textarea><br />\n<label><input type='checkbox' name='curonly' value='true' checked='checked' />\n" . wfMsg("exportcuronly") . "</label><br />\n<input type='submit' />\n</form>\n"); }
function dump($history) { # This shouldn't happen if on console... ;) header('Content-type: text/html; charset=UTF-8'); # Notice messages will foul up your XML output even if they're # relatively harmless. ini_set('display_errors', false); $this->startTime = wfTime(); $dbr =& wfGetDB(DB_SLAVE); $this->maxCount = $dbr->selectField('page', 'MAX(page_id)', '', 'BackupDumper::dump'); $this->startTime = wfTime(); $db =& $this->backupDb(); $exporter = new WikiExporter($db, $history, MW_EXPORT_STREAM); $exporter->setPageCallback(array(&$this, 'reportPage')); $exporter->setRevisionCallback(array(&$this, 'revCount')); $exporter->openStream(); if (is_null($this->pages)) { $exporter->allPages(); } else { $exporter->pagesByName($this->pages); } $exporter->closeStream(); $this->report(true); }