41 $this->mOriginalPageOutCallback =
42 $importer->setPageOutCallback( [ $this,
'reportPage' ] );
43 $this->mOriginalLogCallback =
44 $importer->setLogItemCallback( [ $this,
'reportLogItem' ] );
45 $importer->setNoticeCallback( [ $this,
'reportNotice' ] );
46 $this->mPageCount = 0;
47 $this->mIsUpload = $upload;
48 $this->mInterwiki = $interwiki;
87 public function reportPage( $title, $foreignTitle, $revisionCount,
88 $successCount, $pageInfo ) {
89 $args = func_get_args();
90 call_user_func_array( $this->mOriginalPageOutCallback,
$args );
93 # Invalid or non-importable title; a notice is already displayed
98 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
99 if ( $successCount > 0 ) {
105 $this->msg(
'import-revision-count' )->numParams( $successCount )->escaped() .
110 $logParams = [
'4:number:count' => $successCount ];
111 if ( $this->mIsUpload ) {
112 $detail = $this->
msg(
'import-logentry-upload-detail' )->numParams(
113 $successCount )->inContentLanguage()->text();
116 $pageTitle = $foreignTitle->getFullText();
117 $fullInterwikiPrefix = $this->mInterwiki;
118 Hooks::run(
'ImportLogInterwikiLink', [ &$fullInterwikiPrefix, &$pageTitle ] );
120 $interwikiTitleStr = $fullInterwikiPrefix .
':' . $pageTitle;
121 $interwiki =
'[[:' . $interwikiTitleStr .
']]';
122 $detail = $this->
msg(
'import-logentry-interwiki-detail' )->numParams(
123 $successCount )->params( $interwiki )->inContentLanguage()->text();
124 $action =
'interwiki';
125 $logParams[
'5:title-link:interwiki'] = $interwikiTitleStr;
127 if ( $this->reason ) {
128 $detail .= $this->
msg(
'colon-separator' )->inContentLanguage()->text()
134 $latest =
$title->getLatestRevID();
144 if ( !is_null( $nullRevision ) ) {
145 $nullRevId = $nullRevision->insertOn( $dbw );
146 $page = WikiPage::factory(
$title );
148 $page->updateRevisionOn( $dbw, $nullRevision );
150 'NewRevisionFromEditComplete',
151 [ $page, $nullRevision, $latest, $this->
getUser() ]
157 $logEntry->setTarget(
$title );
158 $logEntry->setComment( $this->reason );
159 $logEntry->setPerformer( $this->
getUser() );
160 $logEntry->setParameters( $logParams );
162 $logEntry->setAssociatedRevId( $nullRevId );
163 if ( count( $this->logTags ) ) {
164 $logEntry->setTags( $this->logTags );
166 $logid = $logEntry->insert();
167 $logEntry->publish( $logid );
170 $this->msg(
'import-nonewrevisions' )->escaped() .
"</li>\n" );