67 wfDeprecated( __METHOD__ .
' without $context',
'1.42' );
69 $this->mOriginalPageOutCallback =
70 $importer->setPageOutCallback( [ $this,
'reportPage' ] );
71 $this->mOriginalLogCallback =
72 $importer->setLogItemCallback( [ $this,
'reportLogItem' ] );
73 $importer->setNoticeCallback( [ $this,
'reportNotice' ] );
74 $this->mIsUpload = $upload;
75 $this->mInterwiki = $interwiki;
76 $this->reason = is_string( $reason ) ? $reason :
"";
115 $successCount, $pageInfo ) {
116 call_user_func_array( $this->mOriginalPageOutCallback, func_get_args() );
118 if ( $pageIdentity ===
null ) {
119 # Invalid or non-importable title; a notice is already displayed
124 $services = MediaWikiServices::getInstance();
125 $linkRenderer = $services->getLinkRenderer();
126 if ( $successCount > 0 ) {
130 "<li>" . $linkRenderer->makeLink( $pageIdentity ) .
" " .
132 $this->msg(
'import-revision-count' )->numParams( $successCount )->escaped() .
137 $logParams = [
'4:number:count' => $successCount ];
138 if ( $this->mIsUpload ) {
139 $detail = $this->
msg(
'import-logentry-upload-detail' )->numParams(
140 $successCount )->inContentLanguage()->text();
143 $pageTitle = $foreignTitle->getFullText();
144 $fullInterwikiPrefix = $this->mInterwiki;
145 $this->getHookRunner()->onImportLogInterwikiLink(
146 $fullInterwikiPrefix, $pageTitle );
148 $interwikiTitleStr = $fullInterwikiPrefix .
':' . $pageTitle;
149 $interwiki =
'[[:' . $interwikiTitleStr .
']]';
150 $detail = $this->
msg(
'import-logentry-interwiki-detail' )->numParams(
151 $successCount )->params( $interwiki )->inContentLanguage()->text();
152 $action =
'interwiki';
153 $logParams[
'5:title-link:interwiki'] = $interwikiTitleStr;
155 if ( $this->reason ) {
156 $detail .= $this->
msg(
'colon-separator' )->inContentLanguage()->text()
160 $comment = CommentStoreComment::newUnsavedComment( $detail );
161 $dbw = $services->getConnectionProvider()->getPrimaryDatabase();
162 $revStore = $services->getRevisionStore();
163 $nullRevRecord = $revStore->newNullRevision(
172 if ( $nullRevRecord !==
null ) {
173 $inserted = $revStore->insertRevisionOn( $nullRevRecord, $dbw );
174 $nullRevId = $inserted->getId();
175 $parentRevId = $inserted->getParentId();
176 $page = $services->getWikiPageFactory()->newFromTitle( $pageIdentity );
179 $page->updateRevisionOn( $dbw, $inserted );
182 $this->getHookRunner()->onRevisionFromEditComplete(
183 $page, $inserted, $parentRevId, $this->
getUser(), $fakeTags
189 $logEntry->setTarget( $pageIdentity );
190 $logEntry->setComment( $this->reason );
191 $logEntry->setPerformer( $this->
getUser() );
192 $logEntry->setParameters( $logParams );
195 $logEntry->setAssociatedRevId( $nullRevId );
196 if ( count( $this->logTags ) ) {
197 $logEntry->addTags( $this->logTags );
199 $logid = $logEntry->insert();
200 $logEntry->publish( $logid );
202 $this->
getOutput()->addHTML(
"<li>" . $linkRenderer->makeKnownLink( $pageIdentity ) .
" " .
203 $this->msg(
'import-nonewrevisions' )->escaped() .
"</li>\n" );