From 018f9a3bd4fd2284fd19dc9accdd173a63311110 Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Sat, 9 May 2020 13:35:40 +0200 Subject: [PATCH] Add missing visibility on methods related to import/export Change-Id: Iec6646a55a8c5d8e8a56dc7bccf8ef98a998ce1a --- .phpcs.xml | 2 -- includes/export/BaseDump.php | 26 ++++++------------ includes/export/Dump7ZipOutput.php | 4 +-- includes/export/DumpFileOutput.php | 14 +++++----- includes/export/DumpFilter.php | 18 ++++++------- includes/export/DumpLatestFilter.php | 6 ++--- includes/export/DumpMultiWriter.php | 16 +++++------ includes/export/DumpOutput.php | 20 +++++++------- includes/export/DumpPipeOutput.php | 8 +++--- includes/export/DumpStringOutput.php | 2 +- includes/export/ExportProgressFilter.php | 4 +-- includes/export/XmlDumpWriter.php | 34 +++++++++++------------- includes/import/ImportSource.php | 4 +-- includes/import/ImportStreamSource.php | 10 +++---- includes/import/ImportStringSource.php | 4 +-- includes/import/UploadSourceAdapter.php | 14 +++++----- includes/import/WikiImporter.php | 8 +++--- 17 files changed, 90 insertions(+), 104 deletions(-) diff --git a/.phpcs.xml b/.phpcs.xml index ea75b74c4af..45642fce642 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -25,12 +25,10 @@ includes/cache/ includes/deferred/ includes/diff/ - includes/export/ includes/filerepo/ includes/gallery/ includes/historyblob/ includes/htmlform/ - includes/import/ includes/installer/ includes/language/ includes/libs/ diff --git a/includes/export/BaseDump.php b/includes/export/BaseDump.php index 89bced976dd..b536dff6662 100644 --- a/includes/export/BaseDump.php +++ b/includes/export/BaseDump.php @@ -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; diff --git a/includes/export/Dump7ZipOutput.php b/includes/export/Dump7ZipOutput.php index edaefb03e63..afaf52a1c9b 100644 --- a/includes/export/Dump7ZipOutput.php +++ b/includes/export/Dump7ZipOutput.php @@ -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 ); diff --git a/includes/export/DumpFileOutput.php b/includes/export/DumpFileOutput.php index e2b7378c65f..e92b68c2c5e 100644 --- a/includes/export/DumpFileOutput.php +++ b/includes/export/DumpFileOutput.php @@ -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; } } diff --git a/includes/export/DumpFilter.php b/includes/export/DumpFilter.php index 0aa7b5cf48d..296a8d130ac 100644 --- a/includes/export/DumpFilter.php +++ b/includes/export/DumpFilter.php @@ -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(); } diff --git a/includes/export/DumpLatestFilter.php b/includes/export/DumpLatestFilter.php index d3742b7382f..9d252e0a32a 100644 --- a/includes/export/DumpLatestFilter.php +++ b/includes/export/DumpLatestFilter.php @@ -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; diff --git a/includes/export/DumpMultiWriter.php b/includes/export/DumpMultiWriter.php index 98b4a0e3d02..9bbc1b3c9c5 100644 --- a/includes/export/DumpMultiWriter.php +++ b/includes/export/DumpMultiWriter.php @@ -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(); diff --git a/includes/export/DumpOutput.php b/includes/export/DumpOutput.php index 5c15c5f9c02..7f1a2367f83 100644 --- a/includes/export/DumpOutput.php +++ b/includes/export/DumpOutput.php @@ -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; } } diff --git a/includes/export/DumpPipeOutput.php b/includes/export/DumpPipeOutput.php index 89fcbe51d3a..331a24c05ba 100644 --- a/includes/export/DumpPipeOutput.php +++ b/includes/export/DumpPipeOutput.php @@ -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 ) { diff --git a/includes/export/DumpStringOutput.php b/includes/export/DumpStringOutput.php index 837a62d6284..9fdcd74db22 100644 --- a/includes/export/DumpStringOutput.php +++ b/includes/export/DumpStringOutput.php @@ -30,7 +30,7 @@ class DumpStringOutput extends DumpOutput { /** * @param string $string */ - function write( $string ) { + public function write( $string ) { $this->output .= $string; } diff --git a/includes/export/ExportProgressFilter.php b/includes/export/ExportProgressFilter.php index 7fe20ecfef3..2b73ad4c7a9 100644 --- a/includes/export/ExportProgressFilter.php +++ b/includes/export/ExportProgressFilter.php @@ -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(); } diff --git a/includes/export/XmlDumpWriter.php b/includes/export/XmlDumpWriter.php index a0f4f4eefc9..b76c6775f34 100644 --- a/includes/export/XmlDumpWriter.php +++ b/includes/export/XmlDumpWriter.php @@ -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 = "\n"; $nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo(); foreach ( @@ -221,7 +221,7 @@ class XmlDumpWriter { * * @return string */ - function closeStream() { + public function closeStream() { return "\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 = " \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 . "\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'; diff --git a/includes/import/ImportSource.php b/includes/import/ImportSource.php index 75d20b4eaa9..26f9b4cae8e 100644 --- a/includes/import/ImportSource.php +++ b/includes/import/ImportSource.php @@ -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(); } diff --git a/includes/import/ImportStreamSource.php b/includes/import/ImportStreamSource.php index 7a7fc81b19e..33406df2e61 100644 --- a/includes/import/ImportStreamSource.php +++ b/includes/import/ImportStreamSource.php @@ -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 diff --git a/includes/import/ImportStringSource.php b/includes/import/ImportStringSource.php index 30b031997f5..c1ab7690634 100644 --- a/includes/import/ImportStringSource.php +++ b/includes/import/ImportStringSource.php @@ -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; } diff --git a/includes/import/UploadSourceAdapter.php b/includes/import/UploadSourceAdapter.php index 8768f0740f3..d1ba65008eb 100644 --- a/includes/import/UploadSourceAdapter.php +++ b/includes/import/UploadSourceAdapter.php @@ -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; diff --git a/includes/import/WikiImporter.php b/includes/import/WikiImporter.php index c0e2f4ec6fb..c9d8fd71736 100644 --- a/includes/import/WikiImporter.php +++ b/includes/import/WikiImporter.php @@ -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 "" is reached. * @param array $title */ - function pageCallback( $title ) { + public function pageCallback( $title ) { if ( isset( $this->mPageCallback ) ) { call_user_func( $this->mPageCallback, $title ); }