X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FImport.php;h=214bc4e793bc7a4e388ace234b1a2bc7e8bcfb9e;hb=00050cbb4d4d6d0b168a4ee2073e305149ad612d;hp=1e0f8e2f9c617ffcc1cd03944dcb37023bc2a651;hpb=4fa02402289e9ba08369f2c3f9cb78eb0080027a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Import.php b/includes/Import.php index 1e0f8e2f9c..214bc4e793 100644 --- a/includes/Import.php +++ b/includes/Import.php @@ -34,7 +34,7 @@ class WikiImporter { private $reader = null; private $foreignNamespaces = null; private $mLogItemCallback, $mUploadCallback, $mRevisionCallback, $mPageCallback; - private $mSiteInfoCallback, $mTargetNamespace, $mPageOutCallback; + private $mSiteInfoCallback, $mPageOutCallback; private $mNoticeCallback, $mDebug; private $mImportUploads, $mImageBasePath; private $mNoUpdates = false; @@ -240,7 +240,6 @@ class WikiImporter { public function setTargetNamespace( $namespace ) { if ( is_null( $namespace ) ) { // Don't override namespaces - $this->mTargetNamespace = null; $this->setImportTitleFactory( new NaiveImportTitleFactory() ); return true; } elseif ( @@ -248,7 +247,6 @@ class WikiImporter { MWNamespace::exists( intval( $namespace ) ) ) { $namespace = intval( $namespace ); - $this->mTargetNamespace = $namespace; $this->setImportTitleFactory( new NamespaceImportTitleFactory( $namespace ) ); return true; } else { @@ -268,10 +266,7 @@ class WikiImporter { $this->setImportTitleFactory( new NaiveImportTitleFactory() ); } elseif ( $rootpage !== '' ) { $rootpage = rtrim( $rootpage, '/' ); //avoid double slashes - $title = Title::newFromText( $rootpage, !is_null( $this->mTargetNamespace ) - ? $this->mTargetNamespace - : NS_MAIN - ); + $title = Title::newFromText( $rootpage ); if ( !$title || $title->isExternal() ) { $status->fatal( 'import-rootpage-invalid' ); @@ -1575,8 +1570,7 @@ class WikiRevision { } // avoid memory leak...? - $linkCache = LinkCache::singleton(); - $linkCache->clear(); + Title::clearCaches(); $page = WikiPage::factory( $this->title ); $page->loadPageData( 'fromdbmaster' ); @@ -1863,9 +1857,9 @@ class ImportStreamSource implements ImportSource { * @return Status */ static function newFromFile( $filename ) { - wfSuppressWarnings(); + MediaWiki\suppressWarnings(); $file = fopen( $filename, 'rt' ); - wfRestoreWarnings(); + MediaWiki\restoreWarnings(); if ( !$file ) { return Status::newFatal( "importcantopen" ); }