summaryrefslogtreecommitdiff
path: root/includes/Export.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2014-12-27 15:41:37 +0100
committerPierre Schmitz <pierre@archlinux.de>2014-12-31 11:43:28 +0100
commitc1f9b1f7b1b77776192048005dcc66dcf3df2bfb (patch)
tree2b38796e738dd74cb42ecd9bfd151803108386bc /includes/Export.php
parentb88ab0086858470dd1f644e64cb4e4f62bb2be9b (diff)
Update to MediaWiki 1.24.1
Diffstat (limited to 'includes/Export.php')
-rw-r--r--includes/Export.php373
1 files changed, 191 insertions, 182 deletions
diff --git a/includes/Export.php b/includes/Export.php
index 98de4c00..84f5c60c 100644
--- a/includes/Export.php
+++ b/includes/Export.php
@@ -3,7 +3,7 @@
* Base classes for dumps and export
*
* Copyright © 2003, 2005, 2006 Brion Vibber <brion@pobox.com>
- * http://www.mediawiki.org/
+ * https://www.mediawiki.org/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,11 +31,17 @@
* @ingroup SpecialPage Dump
*/
class WikiExporter {
- var $list_authors = false; # Return distinct author list (when not returning full history)
- var $author_list = "";
+ /** @var bool Return distinct author list (when not returning full history) */
+ public $list_authors = false;
- var $dumpUploads = false;
- var $dumpUploadFileContents = false;
+ /** @var bool */
+ public $dumpUploads = false;
+
+ /** @var bool */
+ public $dumpUploadFileContents = false;
+
+ /** @var string */
+ public $author_list = "";
const FULL = 1;
const CURRENT = 2;
@@ -49,21 +55,21 @@ class WikiExporter {
const TEXT = 0;
const STUB = 1;
- var $buffer;
+ /** @var int */
+ public $buffer;
- var $text;
+ /** @var int */
+ public $text;
- /**
- * @var DumpOutput
- */
- var $sink;
+ /** @var DumpOutput */
+ public $sink;
/**
* Returns the export schema version.
* @return string
*/
public static function schemaVersion() {
- return "0.8";
+ return "0.9";
}
/**
@@ -73,15 +79,14 @@ class WikiExporter {
* make additional queries to pull source data while the
* main query is still running.
*
- * @param $db DatabaseBase
- * @param $history Mixed: one of WikiExporter::FULL, WikiExporter::CURRENT,
- * WikiExporter::RANGE or WikiExporter::STABLE,
- * or an associative array:
- * offset: non-inclusive offset at which to start the query
- * limit: maximum number of rows to return
- * dir: "asc" or "desc" timestamp order
- * @param int $buffer one of WikiExporter::BUFFER or WikiExporter::STREAM
- * @param int $text one of WikiExporter::TEXT or WikiExporter::STUB
+ * @param DatabaseBase $db
+ * @param int|array $history One of WikiExporter::FULL, WikiExporter::CURRENT,
+ * WikiExporter::RANGE or WikiExporter::STABLE, or an associative array:
+ * - offset: non-inclusive offset at which to start the query
+ * - limit: maximum number of rows to return
+ * - dir: "asc" or "desc" timestamp order
+ * @param int $buffer One of WikiExporter::BUFFER or WikiExporter::STREAM
+ * @param int $text One of WikiExporter::TEXT or WikiExporter::STUB
*/
function __construct( $db, $history = WikiExporter::CURRENT,
$buffer = WikiExporter::BUFFER, $text = WikiExporter::TEXT ) {
@@ -98,7 +103,7 @@ class WikiExporter {
* various row objects and XML output for filtering. Filters
* can be chained or used as callbacks.
*
- * @param $sink mixed
+ * @param DumpOutput $sink
*/
public function setOutputSink( &$sink ) {
$this->sink =& $sink;
@@ -126,9 +131,9 @@ class WikiExporter {
/**
* Dumps a series of page and revision records for those pages
* in the database falling within the page_id range given.
- * @param int $start inclusive lower limit (this id is included)
- * @param $end Int: Exclusive upper limit (this id is not included)
- * If 0, no upper limit.
+ * @param int $start Inclusive lower limit (this id is included)
+ * @param int $end Exclusive upper limit (this id is not included)
+ * If 0, no upper limit.
*/
public function pagesByRange( $start, $end ) {
$condition = 'page_id >= ' . intval( $start );
@@ -141,9 +146,9 @@ class WikiExporter {
/**
* Dumps a series of page and revision records for those pages
* in the database with revisions falling within the rev_id range given.
- * @param int $start inclusive lower limit (this id is included)
- * @param $end Int: Exclusive upper limit (this id is not included)
- * If 0, no upper limit.
+ * @param int $start Inclusive lower limit (this id is included)
+ * @param int $end Exclusive upper limit (this id is not included)
+ * If 0, no upper limit.
*/
public function revsByRange( $start, $end ) {
$condition = 'rev_id >= ' . intval( $start );
@@ -154,7 +159,7 @@ class WikiExporter {
}
/**
- * @param $title Title
+ * @param Title $title
*/
public function pageByTitle( $title ) {
$this->dumpFrom(
@@ -163,7 +168,7 @@ class WikiExporter {
}
/**
- * @param $name string
+ * @param string $name
* @throws MWException
*/
public function pageByName( $name ) {
@@ -176,7 +181,7 @@ class WikiExporter {
}
/**
- * @param $names array
+ * @param array $names
*/
public function pagesByName( $names ) {
foreach ( $names as $name ) {
@@ -189,8 +194,8 @@ class WikiExporter {
}
/**
- * @param $start int
- * @param $end int
+ * @param int $start
+ * @param int $end
*/
public function logsByRange( $start, $end ) {
$condition = 'log_id >= ' . intval( $start );
@@ -205,7 +210,7 @@ class WikiExporter {
* Not called by default (depends on $this->list_authors)
* Can be set by Special:Export when not exporting whole history
*
- * @param $cond
+ * @param array $cond
*/
protected function do_list_authors( $cond ) {
wfProfileIn( __METHOD__ );
@@ -238,7 +243,7 @@ class WikiExporter {
}
/**
- * @param $cond string
+ * @param string $cond
* @throws MWException
* @throws Exception
*/
@@ -262,7 +267,7 @@ class WikiExporter {
if ( $this->buffer == WikiExporter::STREAM ) {
$prev = $this->db->bufferResults( false );
}
- $wrapper = null; // Assuring $wrapper is not undefined, if exception occurs early
+ $result = null; // Assuring $result is not undefined, if exception occurs early
try {
$result = $this->db->select( array( 'logging', 'user' ),
array( "{$logging}.*", 'user_name' ), // grab the user name
@@ -270,8 +275,7 @@ class WikiExporter {
__METHOD__,
array( 'ORDER BY' => 'log_id', 'USE INDEX' => array( 'logging' => 'PRIMARY' ) )
);
- $wrapper = $this->db->resultObject( $result );
- $this->outputLogStream( $wrapper );
+ $this->outputLogStream( $result );
if ( $this->buffer == WikiExporter::STREAM ) {
$this->db->bufferResults( $prev );
}
@@ -281,8 +285,8 @@ class WikiExporter {
// Freeing result
try {
- if ( $wrapper ) {
- $wrapper->free();
+ if ( $result ) {
+ $result->free();
}
} catch ( Exception $e2 ) {
// Already in panic mode -> ignoring $e2 as $e has
@@ -372,16 +376,15 @@ class WikiExporter {
$prev = $this->db->bufferResults( false );
}
- $wrapper = null; // Assuring $wrapper is not undefined, if exception occurs early
+ $result = null; // Assuring $result is not undefined, if exception occurs early
try {
wfRunHooks( 'ModifyExportQuery',
array( $this->db, &$tables, &$cond, &$opts, &$join ) );
# Do the query!
$result = $this->db->select( $tables, '*', $cond, __METHOD__, $opts, $join );
- $wrapper = $this->db->resultObject( $result );
# Output dump results
- $this->outputPageStream( $wrapper );
+ $this->outputPageStream( $result );
if ( $this->buffer == WikiExporter::STREAM ) {
$this->db->bufferResults( $prev );
@@ -392,8 +395,8 @@ class WikiExporter {
// Freeing result
try {
- if ( $wrapper ) {
- $wrapper->free();
+ if ( $result ) {
+ $result->free();
}
} catch ( Exception $e2 ) {
// Already in panic mode -> ignoring $e2 as $e has
@@ -427,7 +430,7 @@ class WikiExporter {
* separate database connection not managed by LoadBalancer; some
* blob storage types will make queries to pull source data.
*
- * @param $resultset ResultWrapper
+ * @param ResultWrapper $resultset
*/
protected function outputPageStream( $resultset ) {
$last = null;
@@ -462,7 +465,7 @@ class WikiExporter {
}
/**
- * @param $resultset array
+ * @param ResultWrapper $resultset
*/
protected function outputLogStream( $resultset ) {
foreach ( $resultset as $row ) {
@@ -478,7 +481,7 @@ class WikiExporter {
class XmlDumpWriter {
/**
* Returns the export schema version.
- * @deprecated in 1.20; use WikiExporter::schemaVersion() instead
+ * @deprecated since 1.20; use WikiExporter::schemaVersion() instead
* @return string
*/
function schemaVersion() {
@@ -502,8 +505,18 @@ class XmlDumpWriter {
return Xml::element( 'mediawiki', array(
'xmlns' => "http://www.mediawiki.org/xml/export-$ver/",
'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance",
+ /*
+ * When a new version of the schema is created, it needs staging on mediawiki.org.
+ * This requires a change in the operations/mediawiki-config git repo.
+ *
+ * Create a changeset like https://gerrit.wikimedia.org/r/#/c/149643/ in which
+ * you copy in the new xsd file.
+ *
+ * After it is reviewed, merged and deployed (sync-docroot), the index.html needs purging.
+ * echo "http://www.mediawiki.org/xml/index.html" | mwscript purgeList.php --wiki=aawiki
+ */
'xsi:schemaLocation' => "http://www.mediawiki.org/xml/export-$ver/ " .
- "http://www.mediawiki.org/xml/export-$ver.xsd", #TODO: how do we get a new version up there?
+ "http://www.mediawiki.org/xml/export-$ver.xsd",
'version' => $ver,
'xml:lang' => $wgLanguageCode ),
null ) .
@@ -517,6 +530,7 @@ class XmlDumpWriter {
function siteInfo() {
$info = array(
$this->sitename(),
+ $this->dbname(),
$this->homelink(),
$this->generator(),
$this->caseSetting(),
@@ -537,6 +551,14 @@ class XmlDumpWriter {
/**
* @return string
*/
+ function dbname() {
+ global $wgDBname;
+ return Xml::element( 'dbname', array(), $wgDBname );
+ }
+
+ /**
+ * @return string
+ */
function generator() {
global $wgVersion;
return Xml::element( 'generator', array(), "MediaWiki $wgVersion" );
@@ -591,11 +613,10 @@ class XmlDumpWriter {
* Opens a "<page>" section on the output stream, with data
* from the given database row.
*
- * @param $row object
+ * @param object $row
* @return string
- * @access private
*/
- function openPage( $row ) {
+ public function openPage( $row ) {
$out = " <page>\n";
$title = Title::makeTitle( $row->page_namespace, $row->page_title );
$out .= ' ' . Xml::elementClean( 'title', array(), self::canonicalTitle( $title ) ) . "\n";
@@ -604,8 +625,10 @@ class XmlDumpWriter {
if ( $row->page_is_redirect ) {
$page = WikiPage::factory( $title );
$redirect = $page->getRedirectTarget();
- if ( $redirect instanceOf Title && $redirect->isValidRedirectTarget() ) {
- $out .= ' ' . Xml::element( 'redirect', array( 'title' => self::canonicalTitle( $redirect ) ) ) . "\n";
+ if ( $redirect instanceof Title && $redirect->isValidRedirectTarget() ) {
+ $out .= ' ';
+ $out .= Xml::element( 'redirect', array( 'title' => self::canonicalTitle( $redirect ) ) );
+ $out .= "\n";
}
}
@@ -633,7 +656,7 @@ class XmlDumpWriter {
* Dumps a "<revision>" section on the output stream, with
* data filled in from the given database row.
*
- * @param $row object
+ * @param object $row
* @return string
* @access private
*/
@@ -663,12 +686,30 @@ class XmlDumpWriter {
$out .= " " . Xml::elementClean( 'comment', array(), strval( $row->rev_comment ) ) . "\n";
}
+ if ( isset( $row->rev_content_model ) && !is_null( $row->rev_content_model ) ) {
+ $content_model = strval( $row->rev_content_model );
+ } else {
+ // probably using $wgContentHandlerUseDB = false;
+ $title = Title::makeTitle( $row->page_namespace, $row->page_title );
+ $content_model = ContentHandler::getDefaultModelFor( $title );
+ }
+
+ $content_handler = ContentHandler::getForModelID( $content_model );
+
+ if ( isset( $row->rev_content_format ) && !is_null( $row->rev_content_format ) ) {
+ $content_format = strval( $row->rev_content_format );
+ } else {
+ // probably using $wgContentHandlerUseDB = false;
+ $content_format = $content_handler->getDefaultFormat();
+ }
+
$text = '';
if ( isset( $row->rev_deleted ) && ( $row->rev_deleted & Revision::DELETED_TEXT ) ) {
$out .= " " . Xml::element( 'text', array( 'deleted' => 'deleted' ) ) . "\n";
} elseif ( isset( $row->old_text ) ) {
// Raw text from the database may have invalid chars
$text = strval( Revision::getRevisionText( $row ) );
+ $text = $content_handler->exportTransform( $text, $content_format );
$out .= " " . Xml::elementClean( 'text',
array( 'xml:space' => 'preserve', 'bytes' => intval( $row->rev_len ) ),
strval( $text ) ) . "\n";
@@ -679,32 +720,16 @@ class XmlDumpWriter {
"" ) . "\n";
}
- if ( isset( $row->rev_sha1 ) && $row->rev_sha1 && !( $row->rev_deleted & Revision::DELETED_TEXT ) ) {
+ if ( isset( $row->rev_sha1 )
+ && $row->rev_sha1
+ && !( $row->rev_deleted & Revision::DELETED_TEXT )
+ ) {
$out .= " " . Xml::element( 'sha1', null, strval( $row->rev_sha1 ) ) . "\n";
} else {
$out .= " <sha1/>\n";
}
- if ( isset( $row->rev_content_model ) && !is_null( $row->rev_content_model ) ) {
- $content_model = strval( $row->rev_content_model );
- } else {
- // probably using $wgContentHandlerUseDB = false;
- // @todo test!
- $title = Title::makeTitle( $row->page_namespace, $row->page_title );
- $content_model = ContentHandler::getDefaultModelFor( $title );
- }
-
$out .= " " . Xml::element( 'model', null, strval( $content_model ) ) . "\n";
-
- if ( isset( $row->rev_content_format ) && !is_null( $row->rev_content_format ) ) {
- $content_format = strval( $row->rev_content_format );
- } else {
- // probably using $wgContentHandlerUseDB = false;
- // @todo test!
- $content_handler = ContentHandler::getForModelID( $content_model );
- $content_format = $content_handler->getDefaultFormat();
- }
-
$out .= " " . Xml::element( 'format', null, strval( $content_format ) ) . "\n";
wfRunHooks( 'XmlDumpWriterWriteRevision', array( &$this, &$out, $row, $text ) );
@@ -719,7 +744,7 @@ class XmlDumpWriter {
* Dumps a "<logitem>" section on the output stream, with
* data filled in from the given database row.
*
- * @param $row object
+ * @param object $row
* @return string
* @access private
*/
@@ -763,7 +788,7 @@ class XmlDumpWriter {
}
/**
- * @param $timestamp string
+ * @param string $timestamp
* @param string $indent Default to six spaces
* @return string
*/
@@ -773,8 +798,8 @@ class XmlDumpWriter {
}
/**
- * @param $id
- * @param $text string
+ * @param int $id
+ * @param string $text
* @param string $indent Default to six spaces
* @return string
*/
@@ -792,8 +817,8 @@ class XmlDumpWriter {
/**
* Warning! This data is potentially inconsistent. :(
- * @param $row
- * @param $dumpContents bool
+ * @param object $row
+ * @param bool $dumpContents
* @return string
*/
function writeUploads( $row, $dumpContents = false ) {
@@ -812,8 +837,8 @@ class XmlDumpWriter {
}
/**
- * @param $file File
- * @param $dumpContents bool
+ * @param File $file
+ * @param bool $dumpContents
* @return string
*/
function writeUpload( $file, $dumpContents = false ) {
@@ -827,7 +852,7 @@ class XmlDumpWriter {
$be = $file->getRepo()->getBackend();
# Dump file as base64
# Uses only XML-safe characters, so does not need escaping
- # @TODO: too bad this loads the contents into memory (script might swap)
+ # @todo Too bad this loads the contents into memory (script might swap)
$contents = ' <contents encoding="base64">' .
chunk_split( base64_encode(
$be->getFileContents( array( 'src' => $file->getPath() ) ) ) ) .
@@ -865,7 +890,7 @@ class XmlDumpWriter {
* @since 1.18
*/
public static function canonicalTitle( Title $title ) {
- if ( $title->getInterwiki() ) {
+ if ( $title->isExternal() ) {
return $title->getPrefixedText();
}
@@ -887,45 +912,45 @@ class XmlDumpWriter {
class DumpOutput {
/**
- * @param $string string
+ * @param string $string
*/
function writeOpenStream( $string ) {
$this->write( $string );
}
/**
- * @param $string string
+ * @param string $string
*/
function writeCloseStream( $string ) {
$this->write( $string );
}
/**
- * @param $page
- * @param $string string
+ * @param object $page
+ * @param string $string
*/
function writeOpenPage( $page, $string ) {
$this->write( $string );
}
/**
- * @param $string string
+ * @param string $string
*/
function writeClosePage( $string ) {
$this->write( $string );
}
/**
- * @param $rev
- * @param $string string
+ * @param object $rev
+ * @param string $string
*/
function writeRevision( $rev, $string ) {
$this->write( $string );
}
/**
- * @param $rev
- * @param $string string
+ * @param object $rev
+ * @param string $string
*/
function writeLogItem( $rev, $string ) {
$this->write( $string );
@@ -933,7 +958,7 @@ class DumpOutput {
/**
* Override to write to a different stream type.
- * @param $string string
+ * @param string $string
* @return bool
*/
function write( $string ) {
@@ -945,7 +970,7 @@ class DumpOutput {
* and reopen new file with the old name. Use this
* for writing out a file in multiple pieces
* at specified checkpoints (e.g. every n hours).
- * @param $newname mixed File name. May be a string or an array with one element
+ * @param string|array $newname File name. May be a string or an array with one element
*/
function closeRenameAndReopen( $newname ) {
}
@@ -954,8 +979,9 @@ class DumpOutput {
* Close the old file, and move it to a specified name.
* Use this for the last piece of a file written out
* at specified checkpoints (e.g. every n hours).
- * @param $newname mixed File name. May be a string or an array with one element
- * @param bool $open If true, a new file with the old filename will be opened again for writing (default: false)
+ * @param string|array $newname File name. May be a string or an array with one element
+ * @param bool $open If true, a new file with the old filename will be opened
+ * again for writing (default: false)
*/
function closeAndRename( $newname, $open = false ) {
}
@@ -978,7 +1004,7 @@ class DumpFileOutput extends DumpOutput {
protected $handle = false, $filename;
/**
- * @param $file
+ * @param string $file
*/
function __construct( $file ) {
$this->handle = fopen( $file, "wt" );
@@ -986,7 +1012,7 @@ class DumpFileOutput extends DumpOutput {
}
/**
- * @param $string string
+ * @param string $string
*/
function writeCloseStream( $string ) {
parent::writeCloseStream( $string );
@@ -997,21 +1023,21 @@ class DumpFileOutput extends DumpOutput {
}
/**
- * @param $string string
+ * @param string $string
*/
function write( $string ) {
fputs( $this->handle, $string );
}
/**
- * @param $newname
+ * @param string $newname
*/
function closeRenameAndReopen( $newname ) {
$this->closeAndRename( $newname, true );
}
/**
- * @param $newname
+ * @param string $newname
* @throws MWException
*/
function renameOrException( $newname ) {
@@ -1021,8 +1047,8 @@ class DumpFileOutput extends DumpOutput {
}
/**
- * @param $newname array
- * @return mixed
+ * @param array $newname
+ * @return string
* @throws MWException
*/
function checkRenameArgCount( $newname ) {
@@ -1037,8 +1063,8 @@ class DumpFileOutput extends DumpOutput {
}
/**
- * @param $newname mixed
- * @param $open bool
+ * @param string $newname
+ * @param bool $open
*/
function closeAndRename( $newname, $open = false ) {
$newname = $this->checkRenameArgCount( $newname );
@@ -1073,8 +1099,8 @@ class DumpPipeOutput extends DumpFileOutput {
protected $procOpenResource = false;
/**
- * @param $command
- * @param $file null
+ * @param string $command
+ * @param string $file
*/
function __construct( $command, $file = null ) {
if ( !is_null( $file ) ) {
@@ -1087,7 +1113,7 @@ class DumpPipeOutput extends DumpFileOutput {
}
/**
- * @param $string string
+ * @param string $string
*/
function writeCloseStream( $string ) {
parent::writeCloseStream( $string );
@@ -1098,7 +1124,7 @@ class DumpPipeOutput extends DumpFileOutput {
}
/**
- * @param $command
+ * @param string $command
*/
function startCommand( $command ) {
$spec = array(
@@ -1110,15 +1136,15 @@ class DumpPipeOutput extends DumpFileOutput {
}
/**
- * @param mixed $newname
+ * @param string $newname
*/
function closeRenameAndReopen( $newname ) {
$this->closeAndRename( $newname, true );
}
/**
- * @param $newname mixed
- * @param $open bool
+ * @param string $newname
+ * @param bool $open
*/
function closeAndRename( $newname, $open = false ) {
$newname = $this->checkRenameArgCount( $newname );
@@ -1139,7 +1165,6 @@ class DumpPipeOutput extends DumpFileOutput {
}
}
}
-
}
/**
@@ -1147,9 +1172,8 @@ class DumpPipeOutput extends DumpFileOutput {
* @ingroup Dump
*/
class DumpGZipOutput extends DumpPipeOutput {
-
/**
- * @param $file string
+ * @param string $file
*/
function __construct( $file ) {
parent::__construct( "gzip", $file );
@@ -1161,9 +1185,8 @@ class DumpGZipOutput extends DumpPipeOutput {
* @ingroup Dump
*/
class DumpBZip2Output extends DumpPipeOutput {
-
/**
- * @param $file string
+ * @param string $file
*/
function __construct( $file ) {
parent::__construct( "bzip2", $file );
@@ -1175,9 +1198,8 @@ class DumpBZip2Output extends DumpPipeOutput {
* @ingroup Dump
*/
class Dump7ZipOutput extends DumpPipeOutput {
-
/**
- * @param $file string
+ * @param string $file
*/
function __construct( $file ) {
$command = $this->setup7zCommand( $file );
@@ -1186,7 +1208,7 @@ class Dump7ZipOutput extends DumpPipeOutput {
}
/**
- * @param $file string
+ * @param string $file
* @return string
*/
function setup7zCommand( $file ) {
@@ -1198,8 +1220,8 @@ class Dump7ZipOutput extends DumpPipeOutput {
}
/**
- * @param $newname string
- * @param $open bool
+ * @param string $newname
+ * @param bool $open
*/
function closeAndRename( $newname, $open = false ) {
$newname = $this->checkRenameArgCount( $newname );
@@ -1222,7 +1244,6 @@ class Dump7ZipOutput extends DumpPipeOutput {
* @ingroup Dump
*/
class DumpFilter {
-
/**
* @var DumpOutput
* FIXME will need to be made protected whenever legacy code
@@ -1236,29 +1257,29 @@ class DumpFilter {
protected $sendingThisPage;
/**
- * @param $sink DumpOutput
+ * @param DumpOutput $sink
*/
function __construct( &$sink ) {
$this->sink =& $sink;
}
/**
- * @param $string string
+ * @param string $string
*/
function writeOpenStream( $string ) {
$this->sink->writeOpenStream( $string );
}
/**
- * @param $string string
+ * @param string $string
*/
function writeCloseStream( $string ) {
$this->sink->writeCloseStream( $string );
}
/**
- * @param $page
- * @param $string string
+ * @param object $page
+ * @param string $string
*/
function writeOpenPage( $page, $string ) {
$this->sendingThisPage = $this->pass( $page, $string );
@@ -1268,7 +1289,7 @@ class DumpFilter {
}
/**
- * @param $string string
+ * @param string $string
*/
function writeClosePage( $string ) {
if ( $this->sendingThisPage ) {
@@ -1278,8 +1299,8 @@ class DumpFilter {
}
/**
- * @param $rev
- * @param $string string
+ * @param object $rev
+ * @param string $string
*/
function writeRevision( $rev, $string ) {
if ( $this->sendingThisPage ) {
@@ -1288,23 +1309,23 @@ class DumpFilter {
}
/**
- * @param $rev
- * @param $string string
+ * @param object $rev
+ * @param string $string
*/
function writeLogItem( $rev, $string ) {
$this->sink->writeRevision( $rev, $string );
}
/**
- * @param $newname string
+ * @param string $newname
*/
function closeRenameAndReopen( $newname ) {
$this->sink->closeRenameAndReopen( $newname );
}
/**
- * @param $newname string
- * @param $open bool
+ * @param string $newname
+ * @param bool $open
*/
function closeAndRename( $newname, $open = false ) {
$this->sink->closeAndRename( $newname, $open );
@@ -1319,7 +1340,7 @@ class DumpFilter {
/**
* Override for page-based filter types.
- * @param $page
+ * @param object $page
* @return bool
*/
function pass( $page ) {
@@ -1332,9 +1353,8 @@ class DumpFilter {
* @ingroup Dump
*/
class DumpNotalkFilter extends DumpFilter {
-
/**
- * @param $page
+ * @param object $page
* @return bool
*/
function pass( $page ) {
@@ -1347,12 +1367,15 @@ class DumpNotalkFilter extends DumpFilter {
* @ingroup Dump
*/
class DumpNamespaceFilter extends DumpFilter {
- var $invert = false;
- var $namespaces = array();
+ /** @var bool */
+ public $invert = false;
+
+ /** @var array */
+ public $namespaces = array();
/**
- * @param $sink DumpOutput
- * @param $param
+ * @param DumpOutput $sink
+ * @param array $param
* @throws MWException
*/
function __construct( &$sink, $param ) {
@@ -1398,7 +1421,7 @@ class DumpNamespaceFilter extends DumpFilter {
}
/**
- * @param $page
+ * @param object $page
* @return bool
*/
function pass( $page ) {
@@ -1412,11 +1435,17 @@ class DumpNamespaceFilter extends DumpFilter {
* @ingroup Dump
*/
class DumpLatestFilter extends DumpFilter {
- var $page, $pageString, $rev, $revString;
+ public $page;
+
+ public $pageString;
+
+ public $rev;
+
+ public $revString;
/**
- * @param $page
- * @param $string string
+ * @param object $page
+ * @param string $string
*/
function writeOpenPage( $page, $string ) {
$this->page = $page;
@@ -1424,7 +1453,7 @@ class DumpLatestFilter extends DumpFilter {
}
/**
- * @param $string string
+ * @param string $string
*/
function writeClosePage( $string ) {
if ( $this->rev ) {
@@ -1439,8 +1468,8 @@ class DumpLatestFilter extends DumpFilter {
}
/**
- * @param $rev
- * @param $string string
+ * @param object $rev
+ * @param string $string
*/
function writeRevision( $rev, $string ) {
if ( $rev->rev_id == $this->page->page_latest ) {
@@ -1457,7 +1486,7 @@ class DumpLatestFilter extends DumpFilter {
class DumpMultiWriter {
/**
- * @param $sinks
+ * @param array $sinks
*/
function __construct( $sinks ) {
$this->sinks = $sinks;
@@ -1465,7 +1494,7 @@ class DumpMultiWriter {
}
/**
- * @param $string string
+ * @param string $string
*/
function writeOpenStream( $string ) {
for ( $i = 0; $i < $this->count; $i++ ) {
@@ -1474,7 +1503,7 @@ class DumpMultiWriter {
}
/**
- * @param $string string
+ * @param string $string
*/
function writeCloseStream( $string ) {
for ( $i = 0; $i < $this->count; $i++ ) {
@@ -1483,8 +1512,8 @@ class DumpMultiWriter {
}
/**
- * @param $page
- * @param $string string
+ * @param object $page
+ * @param string $string
*/
function writeOpenPage( $page, $string ) {
for ( $i = 0; $i < $this->count; $i++ ) {
@@ -1493,7 +1522,7 @@ class DumpMultiWriter {
}
/**
- * @param $string
+ * @param string $string
*/
function writeClosePage( $string ) {
for ( $i = 0; $i < $this->count; $i++ ) {
@@ -1502,8 +1531,8 @@ class DumpMultiWriter {
}
/**
- * @param $rev
- * @param $string
+ * @param object $rev
+ * @param string $string
*/
function writeRevision( $rev, $string ) {
for ( $i = 0; $i < $this->count; $i++ ) {
@@ -1512,14 +1541,14 @@ class DumpMultiWriter {
}
/**
- * @param $newnames
+ * @param array $newnames
*/
function closeRenameAndReopen( $newnames ) {
$this->closeAndRename( $newnames, true );
}
/**
- * @param $newnames array
+ * @param array $newnames
* @param bool $open
*/
function closeAndRename( $newnames, $open = false ) {
@@ -1538,24 +1567,4 @@ class DumpMultiWriter {
}
return $filenames;
}
-
-}
-
-/**
- * @param $string string
- * @return string
- */
-function xmlsafe( $string ) {
- wfProfileIn( __FUNCTION__ );
-
- /**
- * The page may contain old data which has not been properly normalized.
- * Invalid UTF-8 sequences or forbidden control characters will make our
- * XML output invalid, so be sure to strip them out.
- */
- $string = UtfNormal::cleanUp( $string );
-
- $string = htmlspecialchars( $string );
- wfProfileOut( __FUNCTION__ );
- return $string;
}