Add missing visibility on methods related to import/export
Change-Id: Iec6646a55a8c5d8e8a56dc7bccf8ef98a998ce1a
This commit is contained in:
parent
06a884c9ee
commit
018f9a3bd4
17 changed files with 90 additions and 104 deletions
|
|
@ -25,12 +25,10 @@
|
|||
<exclude-pattern>includes/cache/</exclude-pattern>
|
||||
<exclude-pattern>includes/deferred/</exclude-pattern>
|
||||
<exclude-pattern>includes/diff/</exclude-pattern>
|
||||
<exclude-pattern>includes/export/</exclude-pattern>
|
||||
<exclude-pattern>includes/filerepo/</exclude-pattern>
|
||||
<exclude-pattern>includes/gallery/</exclude-pattern>
|
||||
<exclude-pattern>includes/historyblob/</exclude-pattern>
|
||||
<exclude-pattern>includes/htmlform/</exclude-pattern>
|
||||
<exclude-pattern>includes/import/</exclude-pattern>
|
||||
<exclude-pattern>includes/installer/</exclude-pattern>
|
||||
<exclude-pattern>includes/language/</exclude-pattern>
|
||||
<exclude-pattern>includes/libs/</exclude-pattern>
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class BaseDump {
|
|||
* @param string $slot Role name of the slot to read
|
||||
* @return string|null
|
||||
*/
|
||||
function prefetch( $page, $rev, $slot = SlotRecord::MAIN ) {
|
||||
public function prefetch( $page, $rev, $slot = SlotRecord::MAIN ) {
|
||||
$page = intval( $page );
|
||||
$rev = intval( $rev );
|
||||
while ( $this->lastPage < $page && !$this->atEnd ) {
|
||||
|
|
@ -110,16 +110,13 @@ class BaseDump {
|
|||
}
|
||||
}
|
||||
|
||||
function debug( $str ) {
|
||||
protected function debug( $str ) {
|
||||
wfDebug( $str . "\n" );
|
||||
// global $dumper;
|
||||
// $dumper->progress( $str );
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
function nextPage() {
|
||||
private function nextPage() {
|
||||
if ( $this->skipTo( 'page', 'mediawiki' ) ) {
|
||||
if ( $this->skipTo( 'id' ) ) {
|
||||
$this->lastPage = intval( $this->nodeContents() );
|
||||
|
|
@ -136,10 +133,7 @@ class BaseDump {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
function nextRev() {
|
||||
private function nextRev() {
|
||||
if ( $this->skipTo( 'revision' ) ) {
|
||||
if ( $this->skipTo( 'id' ) ) {
|
||||
$this->lastRev = intval( $this->nodeContents() );
|
||||
|
|
@ -150,10 +144,9 @@ class BaseDump {
|
|||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @return string
|
||||
*/
|
||||
function nextText() {
|
||||
private function nextText() {
|
||||
if ( !$this->skipTo( 'text', 'revision' ) ) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -162,12 +155,11 @@ class BaseDump {
|
|||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param string $name
|
||||
* @param string $parent
|
||||
* @return bool|null
|
||||
*/
|
||||
function skipTo( $name, $parent = 'page' ) {
|
||||
private function skipTo( $name, $parent = 'page' ) {
|
||||
if ( $this->atEnd ) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -195,9 +187,8 @@ class BaseDump {
|
|||
* no sub-elements or such scary things.
|
||||
*
|
||||
* @return string
|
||||
* @private
|
||||
*/
|
||||
function nodeContents() {
|
||||
private function nodeContents() {
|
||||
if ( $this->atEnd ) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -221,10 +212,9 @@ class BaseDump {
|
|||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @return null
|
||||
*/
|
||||
function close() {
|
||||
public function close() {
|
||||
$this->reader->close();
|
||||
$this->atEnd = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class Dump7ZipOutput extends DumpPipeOutput {
|
|||
* @param string $file
|
||||
* @return string
|
||||
*/
|
||||
function setup7zCommand( $file ) {
|
||||
private function setup7zCommand( $file ) {
|
||||
$command = "7za a -bd -si -mx=";
|
||||
$command .= Shell::escape( $this->compressionLevel ) . ' ';
|
||||
$command .= Shell::escape( $file );
|
||||
|
|
@ -62,7 +62,7 @@ class Dump7ZipOutput extends DumpPipeOutput {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
function closeAndRename( $newname, $open = false ) {
|
||||
public function closeAndRename( $newname, $open = false ) {
|
||||
$newname = $this->checkRenameArgCount( $newname );
|
||||
if ( $newname ) {
|
||||
fclose( $this->handle );
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class DumpFileOutput extends DumpOutput {
|
|||
/**
|
||||
* @param string $string
|
||||
*/
|
||||
function writeCloseStream( $string ) {
|
||||
public function writeCloseStream( $string ) {
|
||||
parent::writeCloseStream( $string );
|
||||
if ( $this->handle ) {
|
||||
fclose( $this->handle );
|
||||
|
|
@ -54,14 +54,14 @@ class DumpFileOutput extends DumpOutput {
|
|||
/**
|
||||
* @param string $string
|
||||
*/
|
||||
function write( $string ) {
|
||||
public function write( $string ) {
|
||||
fputs( $this->handle, $string );
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
function closeRenameAndReopen( $newname ) {
|
||||
public function closeRenameAndReopen( $newname ) {
|
||||
$this->closeAndRename( $newname, true );
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ class DumpFileOutput extends DumpOutput {
|
|||
* @param string $newname
|
||||
* @throws MWException
|
||||
*/
|
||||
function renameOrException( $newname ) {
|
||||
protected function renameOrException( $newname ) {
|
||||
if ( !rename( $this->filename, $newname ) ) {
|
||||
throw new MWException( __METHOD__ . ": rename of file {$this->filename} to $newname failed\n" );
|
||||
}
|
||||
|
|
@ -80,7 +80,7 @@ class DumpFileOutput extends DumpOutput {
|
|||
* @return string
|
||||
* @throws MWException
|
||||
*/
|
||||
function checkRenameArgCount( $newname ) {
|
||||
protected function checkRenameArgCount( $newname ) {
|
||||
if ( is_array( $newname ) ) {
|
||||
if ( count( $newname ) > 1 ) {
|
||||
throw new MWException( __METHOD__ . ": passed multiple arguments for rename of single file\n" );
|
||||
|
|
@ -94,7 +94,7 @@ class DumpFileOutput extends DumpOutput {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
function closeAndRename( $newname, $open = false ) {
|
||||
public function closeAndRename( $newname, $open = false ) {
|
||||
$newname = $this->checkRenameArgCount( $newname );
|
||||
if ( $newname ) {
|
||||
if ( $this->handle ) {
|
||||
|
|
@ -111,7 +111,7 @@ class DumpFileOutput extends DumpOutput {
|
|||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
function getFilenames() {
|
||||
public function getFilenames() {
|
||||
return $this->filename;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,14 +51,14 @@ class DumpFilter {
|
|||
/**
|
||||
* @param string $string
|
||||
*/
|
||||
function writeOpenStream( $string ) {
|
||||
public function writeOpenStream( $string ) {
|
||||
$this->sink->writeOpenStream( $string );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
*/
|
||||
function writeCloseStream( $string ) {
|
||||
public function writeCloseStream( $string ) {
|
||||
$this->sink->writeCloseStream( $string );
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ class DumpFilter {
|
|||
* @param object $page
|
||||
* @param string $string
|
||||
*/
|
||||
function writeOpenPage( $page, $string ) {
|
||||
public function writeOpenPage( $page, $string ) {
|
||||
$this->sendingThisPage = $this->pass( $page );
|
||||
if ( $this->sendingThisPage ) {
|
||||
$this->sink->writeOpenPage( $page, $string );
|
||||
|
|
@ -76,7 +76,7 @@ class DumpFilter {
|
|||
/**
|
||||
* @param string $string
|
||||
*/
|
||||
function writeClosePage( $string ) {
|
||||
public function writeClosePage( $string ) {
|
||||
if ( $this->sendingThisPage ) {
|
||||
$this->sink->writeClosePage( $string );
|
||||
$this->sendingThisPage = false;
|
||||
|
|
@ -87,7 +87,7 @@ class DumpFilter {
|
|||
* @param object $rev
|
||||
* @param string $string
|
||||
*/
|
||||
function writeRevision( $rev, $string ) {
|
||||
public function writeRevision( $rev, $string ) {
|
||||
if ( $this->sendingThisPage ) {
|
||||
$this->sink->writeRevision( $rev, $string );
|
||||
}
|
||||
|
|
@ -97,7 +97,7 @@ class DumpFilter {
|
|||
* @param object $rev
|
||||
* @param string $string
|
||||
*/
|
||||
function writeLogItem( $rev, $string ) {
|
||||
public function writeLogItem( $rev, $string ) {
|
||||
$this->sink->writeRevision( $rev, $string );
|
||||
}
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ class DumpFilter {
|
|||
* @see DumpOutput::closeRenameAndReopen()
|
||||
* @param string|string[] $newname
|
||||
*/
|
||||
function closeRenameAndReopen( $newname ) {
|
||||
public function closeRenameAndReopen( $newname ) {
|
||||
$this->sink->closeRenameAndReopen( $newname );
|
||||
}
|
||||
|
||||
|
|
@ -114,14 +114,14 @@ class DumpFilter {
|
|||
* @param string|string[] $newname
|
||||
* @param bool $open
|
||||
*/
|
||||
function closeAndRename( $newname, $open = false ) {
|
||||
public function closeAndRename( $newname, $open = false ) {
|
||||
$this->sink->closeAndRename( $newname, $open );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
function getFilenames() {
|
||||
public function getFilenames() {
|
||||
return $this->sink->getFilenames();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class DumpLatestFilter extends DumpFilter {
|
|||
* @param object $page
|
||||
* @param string $string
|
||||
*/
|
||||
function writeOpenPage( $page, $string ) {
|
||||
public function writeOpenPage( $page, $string ) {
|
||||
$this->page = $page;
|
||||
$this->pageString = $string;
|
||||
}
|
||||
|
|
@ -47,7 +47,7 @@ class DumpLatestFilter extends DumpFilter {
|
|||
/**
|
||||
* @param string $string
|
||||
*/
|
||||
function writeClosePage( $string ) {
|
||||
public function writeClosePage( $string ) {
|
||||
if ( $this->rev ) {
|
||||
$this->sink->writeOpenPage( $this->page, $this->pageString );
|
||||
$this->sink->writeRevision( $this->rev, $this->revString );
|
||||
|
|
@ -63,7 +63,7 @@ class DumpLatestFilter extends DumpFilter {
|
|||
* @param object $rev
|
||||
* @param string $string
|
||||
*/
|
||||
function writeRevision( $rev, $string ) {
|
||||
public function writeRevision( $rev, $string ) {
|
||||
if ( $rev->rev_id == $this->page->page_latest ) {
|
||||
$this->rev = $rev;
|
||||
$this->revString = $string;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class DumpMultiWriter {
|
|||
/**
|
||||
* @param string $string
|
||||
*/
|
||||
function writeOpenStream( $string ) {
|
||||
public function writeOpenStream( $string ) {
|
||||
for ( $i = 0; $i < $this->count; $i++ ) {
|
||||
$this->sinks[$i]->writeOpenStream( $string );
|
||||
}
|
||||
|
|
@ -52,7 +52,7 @@ class DumpMultiWriter {
|
|||
/**
|
||||
* @param string $string
|
||||
*/
|
||||
function writeCloseStream( $string ) {
|
||||
public function writeCloseStream( $string ) {
|
||||
for ( $i = 0; $i < $this->count; $i++ ) {
|
||||
$this->sinks[$i]->writeCloseStream( $string );
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ class DumpMultiWriter {
|
|||
* @param object $page
|
||||
* @param string $string
|
||||
*/
|
||||
function writeOpenPage( $page, $string ) {
|
||||
public function writeOpenPage( $page, $string ) {
|
||||
for ( $i = 0; $i < $this->count; $i++ ) {
|
||||
$this->sinks[$i]->writeOpenPage( $page, $string );
|
||||
}
|
||||
|
|
@ -71,7 +71,7 @@ class DumpMultiWriter {
|
|||
/**
|
||||
* @param string $string
|
||||
*/
|
||||
function writeClosePage( $string ) {
|
||||
public function writeClosePage( $string ) {
|
||||
for ( $i = 0; $i < $this->count; $i++ ) {
|
||||
$this->sinks[$i]->writeClosePage( $string );
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ class DumpMultiWriter {
|
|||
* @param object $rev
|
||||
* @param string $string
|
||||
*/
|
||||
function writeRevision( $rev, $string ) {
|
||||
public function writeRevision( $rev, $string ) {
|
||||
for ( $i = 0; $i < $this->count; $i++ ) {
|
||||
$this->sinks[$i]->writeRevision( $rev, $string );
|
||||
}
|
||||
|
|
@ -90,7 +90,7 @@ class DumpMultiWriter {
|
|||
/**
|
||||
* @param array $newnames
|
||||
*/
|
||||
function closeRenameAndReopen( $newnames ) {
|
||||
public function closeRenameAndReopen( $newnames ) {
|
||||
$this->closeAndRename( $newnames, true );
|
||||
}
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ class DumpMultiWriter {
|
|||
* @param array $newnames
|
||||
* @param bool $open
|
||||
*/
|
||||
function closeAndRename( $newnames, $open = false ) {
|
||||
public function closeAndRename( $newnames, $open = false ) {
|
||||
for ( $i = 0; $i < $this->count; $i++ ) {
|
||||
$this->sinks[$i]->closeAndRename( $newnames[$i], $open );
|
||||
}
|
||||
|
|
@ -107,7 +107,7 @@ class DumpMultiWriter {
|
|||
/**
|
||||
* @return array
|
||||
*/
|
||||
function getFilenames() {
|
||||
public function getFilenames() {
|
||||
$filenames = [];
|
||||
for ( $i = 0; $i < $this->count; $i++ ) {
|
||||
$filenames[] = $this->sinks[$i]->getFilenames();
|
||||
|
|
|
|||
|
|
@ -31,14 +31,14 @@ class DumpOutput {
|
|||
/**
|
||||
* @param string $string
|
||||
*/
|
||||
function writeOpenStream( $string ) {
|
||||
public function writeOpenStream( $string ) {
|
||||
$this->write( $string );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
*/
|
||||
function writeCloseStream( $string ) {
|
||||
public function writeCloseStream( $string ) {
|
||||
$this->write( $string );
|
||||
}
|
||||
|
||||
|
|
@ -46,14 +46,14 @@ class DumpOutput {
|
|||
* @param object $page
|
||||
* @param string $string
|
||||
*/
|
||||
function writeOpenPage( $page, $string ) {
|
||||
public function writeOpenPage( $page, $string ) {
|
||||
$this->write( $string );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
*/
|
||||
function writeClosePage( $string ) {
|
||||
public function writeClosePage( $string ) {
|
||||
$this->write( $string );
|
||||
}
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ class DumpOutput {
|
|||
* @param object $rev
|
||||
* @param string $string
|
||||
*/
|
||||
function writeRevision( $rev, $string ) {
|
||||
public function writeRevision( $rev, $string ) {
|
||||
$this->write( $string );
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ class DumpOutput {
|
|||
* @param object $rev
|
||||
* @param string $string
|
||||
*/
|
||||
function writeLogItem( $rev, $string ) {
|
||||
public function writeLogItem( $rev, $string ) {
|
||||
$this->write( $string );
|
||||
}
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ class DumpOutput {
|
|||
* Override to write to a different stream type.
|
||||
* @param string $string
|
||||
*/
|
||||
function write( $string ) {
|
||||
public function write( $string ) {
|
||||
print $string;
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ class DumpOutput {
|
|||
* at specified checkpoints (e.g. every n hours).
|
||||
* @param string|string[] $newname File name. May be a string or an array with one element
|
||||
*/
|
||||
function closeRenameAndReopen( $newname ) {
|
||||
public function closeRenameAndReopen( $newname ) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -99,7 +99,7 @@ class DumpOutput {
|
|||
* @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 ) {
|
||||
public function closeAndRename( $newname, $open = false ) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -107,7 +107,7 @@ class DumpOutput {
|
|||
* being written to, if there are any.
|
||||
* @return null
|
||||
*/
|
||||
function getFilenames() {
|
||||
public function getFilenames() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class DumpPipeOutput extends DumpFileOutput {
|
|||
/**
|
||||
* @param string $string
|
||||
*/
|
||||
function writeCloseStream( $string ) {
|
||||
public function writeCloseStream( $string ) {
|
||||
parent::writeCloseStream( $string );
|
||||
if ( $this->procOpenResource ) {
|
||||
proc_close( $this->procOpenResource );
|
||||
|
|
@ -63,7 +63,7 @@ class DumpPipeOutput extends DumpFileOutput {
|
|||
/**
|
||||
* @param string $command
|
||||
*/
|
||||
function startCommand( $command ) {
|
||||
public function startCommand( $command ) {
|
||||
$spec = [
|
||||
0 => [ "pipe", "r" ],
|
||||
];
|
||||
|
|
@ -75,14 +75,14 @@ class DumpPipeOutput extends DumpFileOutput {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
function closeRenameAndReopen( $newname ) {
|
||||
public function closeRenameAndReopen( $newname ) {
|
||||
$this->closeAndRename( $newname, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
function closeAndRename( $newname, $open = false ) {
|
||||
public function closeAndRename( $newname, $open = false ) {
|
||||
$newname = $this->checkRenameArgCount( $newname );
|
||||
if ( $newname ) {
|
||||
if ( $this->handle ) {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class DumpStringOutput extends DumpOutput {
|
|||
/**
|
||||
* @param string $string
|
||||
*/
|
||||
function write( $string ) {
|
||||
public function write( $string ) {
|
||||
$this->output .= $string;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,12 +39,12 @@ class ExportProgressFilter extends DumpFilter {
|
|||
$this->progress = $progress;
|
||||
}
|
||||
|
||||
function writeClosePage( $string ) {
|
||||
public function writeClosePage( $string ) {
|
||||
parent::writeClosePage( $string );
|
||||
$this->progress->reportPage();
|
||||
}
|
||||
|
||||
function writeRevision( $rev, $string ) {
|
||||
public function writeRevision( $rev, $string ) {
|
||||
parent::writeRevision( $rev, $string );
|
||||
$this->progress->revCount();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ class XmlDumpWriter {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
function openStream() {
|
||||
public function openStream() {
|
||||
$ver = $this->schemaVersion;
|
||||
return Xml::element( 'mediawiki', [
|
||||
'xmlns' => "http://www.mediawiki.org/xml/export-$ver/",
|
||||
|
|
@ -140,7 +140,7 @@ class XmlDumpWriter {
|
|||
/**
|
||||
* @return string
|
||||
*/
|
||||
function siteInfo() {
|
||||
private function siteInfo() {
|
||||
$info = [
|
||||
$this->sitename(),
|
||||
$this->dbname(),
|
||||
|
|
@ -156,7 +156,7 @@ class XmlDumpWriter {
|
|||
/**
|
||||
* @return string
|
||||
*/
|
||||
function sitename() {
|
||||
private function sitename() {
|
||||
global $wgSitename;
|
||||
return Xml::element( 'sitename', [], $wgSitename );
|
||||
}
|
||||
|
|
@ -164,7 +164,7 @@ class XmlDumpWriter {
|
|||
/**
|
||||
* @return string
|
||||
*/
|
||||
function dbname() {
|
||||
private function dbname() {
|
||||
global $wgDBname;
|
||||
return Xml::element( 'dbname', [], $wgDBname );
|
||||
}
|
||||
|
|
@ -172,21 +172,21 @@ class XmlDumpWriter {
|
|||
/**
|
||||
* @return string
|
||||
*/
|
||||
function generator() {
|
||||
private function generator() {
|
||||
return Xml::element( 'generator', [], 'MediaWiki ' . MW_VERSION );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function homelink() {
|
||||
private function homelink() {
|
||||
return Xml::element( 'base', [], Title::newMainPage()->getCanonicalURL() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function caseSetting() {
|
||||
private function caseSetting() {
|
||||
global $wgCapitalLinks;
|
||||
// "case-insensitive" option is reserved for future
|
||||
$sensitivity = $wgCapitalLinks ? 'first-letter' : 'case-sensitive';
|
||||
|
|
@ -196,7 +196,7 @@ class XmlDumpWriter {
|
|||
/**
|
||||
* @return string
|
||||
*/
|
||||
function namespaces() {
|
||||
private function namespaces() {
|
||||
$spaces = "<namespaces>\n";
|
||||
$nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo();
|
||||
foreach (
|
||||
|
|
@ -221,7 +221,7 @@ class XmlDumpWriter {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
function closeStream() {
|
||||
public function closeStream() {
|
||||
return "</mediawiki>\n";
|
||||
}
|
||||
|
||||
|
|
@ -265,7 +265,7 @@ class XmlDumpWriter {
|
|||
* @private
|
||||
* @return string
|
||||
*/
|
||||
function closePage() {
|
||||
public function closePage() {
|
||||
if ( $this->currentTitle !== null ) {
|
||||
$linkCache = MediaWikiServices::getInstance()->getLinkCache();
|
||||
// In rare cases, link cache has the same key for some pages which
|
||||
|
|
@ -328,9 +328,8 @@ class XmlDumpWriter {
|
|||
* @return string
|
||||
* @throws FatalError
|
||||
* @throws MWException
|
||||
* @private
|
||||
*/
|
||||
function writeRevision( $row, $slotRows = null ) {
|
||||
public function writeRevision( $row, $slotRows = null ) {
|
||||
$rev = $this->getRevisionStore()->newRevisionFromRowAndSlots(
|
||||
$row,
|
||||
$slotRows,
|
||||
|
|
@ -567,9 +566,8 @@ class XmlDumpWriter {
|
|||
*
|
||||
* @param object $row
|
||||
* @return string
|
||||
* @private
|
||||
*/
|
||||
function writeLogItem( $row ) {
|
||||
public function writeLogItem( $row ) {
|
||||
$out = " <logitem>\n";
|
||||
$out .= " " . Xml::element( 'id', null, strval( $row->log_id ) ) . "\n";
|
||||
|
||||
|
|
@ -613,7 +611,7 @@ class XmlDumpWriter {
|
|||
* @param string $indent Default to six spaces
|
||||
* @return string
|
||||
*/
|
||||
function writeTimestamp( $timestamp, $indent = " " ) {
|
||||
public function writeTimestamp( $timestamp, $indent = " " ) {
|
||||
$ts = wfTimestamp( TS_ISO_8601, $timestamp );
|
||||
return $indent . Xml::element( 'timestamp', null, $ts ) . "\n";
|
||||
}
|
||||
|
|
@ -624,7 +622,7 @@ class XmlDumpWriter {
|
|||
* @param string $indent Default to six spaces
|
||||
* @return string
|
||||
*/
|
||||
function writeContributor( $id, $text, $indent = " " ) {
|
||||
public function writeContributor( $id, $text, $indent = " " ) {
|
||||
$out = $indent . "<contributor>\n";
|
||||
if ( $id || !IPUtils::isValid( $text ) ) {
|
||||
$out .= $indent . " " . Xml::elementClean( 'username', null, strval( $text ) ) . "\n";
|
||||
|
|
@ -642,7 +640,7 @@ class XmlDumpWriter {
|
|||
* @param bool $dumpContents
|
||||
* @return string
|
||||
*/
|
||||
function writeUploads( $row, $dumpContents = false ) {
|
||||
public function writeUploads( $row, $dumpContents = false ) {
|
||||
if ( $row->page_namespace == NS_FILE ) {
|
||||
$img = MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo()
|
||||
->newFile( $row->page_title );
|
||||
|
|
@ -663,7 +661,7 @@ class XmlDumpWriter {
|
|||
* @param bool $dumpContents
|
||||
* @return string
|
||||
*/
|
||||
function writeUpload( $file, $dumpContents = false ) {
|
||||
private function writeUpload( $file, $dumpContents = false ) {
|
||||
if ( $file->isOld() ) {
|
||||
/** @var OldLocalFile $file */
|
||||
'@phan-var OldLocalFile $file';
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ interface ImportSource {
|
|||
*
|
||||
* @return bool true if there is no more input, false otherwise.
|
||||
*/
|
||||
function atEnd();
|
||||
public function atEnd();
|
||||
|
||||
/**
|
||||
* Return a chunk of the input, as a (possibly empty) string.
|
||||
|
|
@ -47,5 +47,5 @@ interface ImportSource {
|
|||
*
|
||||
* @return bool|string
|
||||
*/
|
||||
function readChunk();
|
||||
public function readChunk();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,14 +43,14 @@ class ImportStreamSource implements ImportSource {
|
|||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function atEnd() {
|
||||
public function atEnd() {
|
||||
return feof( $this->mHandle );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function readChunk() {
|
||||
public function readChunk() {
|
||||
return fread( $this->mHandle, 32768 );
|
||||
}
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ class ImportStreamSource implements ImportSource {
|
|||
* @param string $filename
|
||||
* @return Status
|
||||
*/
|
||||
static function newFromFile( $filename ) {
|
||||
public static function newFromFile( $filename ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
$file = fopen( $filename, 'rt' );
|
||||
Wikimedia\restoreWarnings();
|
||||
|
|
@ -72,7 +72,7 @@ class ImportStreamSource implements ImportSource {
|
|||
* @param string $fieldname
|
||||
* @return Status
|
||||
*/
|
||||
static function newFromUpload( $fieldname = "xmlimport" ) {
|
||||
public static function newFromUpload( $fieldname = "xmlimport" ) {
|
||||
$upload =& $_FILES[$fieldname];
|
||||
|
||||
if ( $upload === null || !$upload['name'] ) {
|
||||
|
|
@ -111,7 +111,7 @@ class ImportStreamSource implements ImportSource {
|
|||
* @param string $method
|
||||
* @return Status
|
||||
*/
|
||||
static function newFromURL( $url, $method = 'GET' ) {
|
||||
public static function newFromURL( $url, $method = 'GET' ) {
|
||||
global $wgHTTPImportTimeout;
|
||||
wfDebug( __METHOD__ . ": opening $url\n" );
|
||||
# Use the standard HTTP fetch function; it times out
|
||||
|
|
|
|||
|
|
@ -49,14 +49,14 @@ class ImportStringSource implements ImportSource {
|
|||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function atEnd() {
|
||||
public function atEnd() {
|
||||
return $this->mRead;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|string
|
||||
*/
|
||||
function readChunk() {
|
||||
public function readChunk() {
|
||||
if ( $this->atEnd() ) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class UploadSourceAdapter {
|
|||
* @param ImportSource $source
|
||||
* @return string
|
||||
*/
|
||||
static function registerSource( ImportSource $source ) {
|
||||
public static function registerSource( ImportSource $source ) {
|
||||
$id = wfRandomString();
|
||||
|
||||
self::$sourceRegistrations[$id] = $source;
|
||||
|
|
@ -60,7 +60,7 @@ class UploadSourceAdapter {
|
|||
* @param string &$opened_path
|
||||
* @return bool
|
||||
*/
|
||||
function stream_open( $path, $mode, $options, &$opened_path ) {
|
||||
public function stream_open( $path, $mode, $options, &$opened_path ) {
|
||||
$url = parse_url( $path );
|
||||
$id = $url['host'];
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ class UploadSourceAdapter {
|
|||
* @param int $count
|
||||
* @return string
|
||||
*/
|
||||
function stream_read( $count ) {
|
||||
public function stream_read( $count ) {
|
||||
$return = '';
|
||||
$leave = false;
|
||||
|
||||
|
|
@ -106,28 +106,28 @@ class UploadSourceAdapter {
|
|||
* @param string $data
|
||||
* @return false
|
||||
*/
|
||||
function stream_write( $data ) {
|
||||
public function stream_write( $data ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
function stream_tell() {
|
||||
public function stream_tell() {
|
||||
return $this->mPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function stream_eof() {
|
||||
public function stream_eof() {
|
||||
return $this->mSource->atEnd();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int[]
|
||||
*/
|
||||
function url_stat() {
|
||||
public function url_stat() {
|
||||
$result = [];
|
||||
|
||||
$result['dev'] = $result[0] = 0;
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ class WikiImporter {
|
|||
* Set debug mode...
|
||||
* @param bool $debug
|
||||
*/
|
||||
function setDebug( $debug ) {
|
||||
public function setDebug( $debug ) {
|
||||
$this->mDebug = $debug;
|
||||
}
|
||||
|
||||
|
|
@ -143,7 +143,7 @@ class WikiImporter {
|
|||
* Set 'no updates' mode. In this mode, the link tables will not be updated by the importer
|
||||
* @param bool $noupdates
|
||||
*/
|
||||
function setNoUpdates( $noupdates ) {
|
||||
public function setNoUpdates( $noupdates ) {
|
||||
$this->mNoUpdates = $noupdates;
|
||||
}
|
||||
|
||||
|
|
@ -153,7 +153,7 @@ class WikiImporter {
|
|||
* @param int $nthPage
|
||||
* @since 1.29
|
||||
*/
|
||||
function setPageOffset( $nthPage ) {
|
||||
public function setPageOffset( $nthPage ) {
|
||||
$this->pageOffset = $nthPage;
|
||||
}
|
||||
|
||||
|
|
@ -470,7 +470,7 @@ class WikiImporter {
|
|||
* Notify the callback function when a new "<page>" is reached.
|
||||
* @param array $title
|
||||
*/
|
||||
function pageCallback( $title ) {
|
||||
public function pageCallback( $title ) {
|
||||
if ( isset( $this->mPageCallback ) ) {
|
||||
call_user_func( $this->mPageCallback, $title );
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue