Merge "Fixed Style/FileName RuboCop offense"
[lhc/web/wiklou.git] / includes / specials / SpecialImport.php
index 4480ac3..af86964 100644 (file)
@@ -194,7 +194,7 @@ class SpecialImport extends SpecialPage {
                        $reporter->open();
                        try {
                                $importer->doImport();
-                       } catch ( MWException $e ) {
+                       } catch ( Exception $e ) {
                                $exception = $e;
                        }
                        $result = $reporter->close();
@@ -521,13 +521,14 @@ class ImportReporter extends ContextSource {
 
        /**
         * @param Title $title
-        * @param Title $origTitle
+        * @param ForeignTitle $foreignTitle
         * @param int $revisionCount
         * @param int $successCount
         * @param array $pageInfo
         * @return void
         */
-       function reportPage( $title, $origTitle, $revisionCount, $successCount, $pageInfo ) {
+       function reportPage( $title, $foreignTitle, $revisionCount,
+                       $successCount, $pageInfo ) {
                $args = func_get_args();
                call_user_func_array( $this->mOriginalPageOutCallback, $args );
 
@@ -545,7 +546,6 @@ class ImportReporter extends ContextSource {
                                        "</li>\n"
                        );
 
-                       $log = new LogPage( 'import' );
                        if ( $this->mIsUpload ) {
                                $detail = $this->msg( 'import-logentry-upload-detail' )->numParams(
                                        $successCount )->inContentLanguage()->text();
@@ -553,19 +553,26 @@ class ImportReporter extends ContextSource {
                                        $detail .= $this->msg( 'colon-separator' )->inContentLanguage()->text()
                                                . $this->reason;
                                }
-                               $log->addEntry( 'upload', $title, $detail, array(), $this->getUser() );
+                               $action = 'upload';
                        } else {
                                $interwiki = '[[:' . $this->mInterwiki . ':' .
-                                       $origTitle->getPrefixedText() . ']]';
+                                       $foreignTitle->getFullText() . ']]';
                                $detail = $this->msg( 'import-logentry-interwiki-detail' )->numParams(
                                        $successCount )->params( $interwiki )->inContentLanguage()->text();
                                if ( $this->reason ) {
                                        $detail .= $this->msg( 'colon-separator' )->inContentLanguage()->text()
                                                . $this->reason;
                                }
-                               $log->addEntry( 'interwiki', $title, $detail, array(), $this->getUser() );
+                               $action = 'interwiki';
                        }
 
+                       $logEntry = new ManualLogEntry( 'import', $action );
+                       $logEntry->setTarget( $title );
+                       $logEntry->setComment( $detail );
+                       $logEntry->setPerformer( $this->getUser() );
+                       $logid = $logEntry->insert();
+                       $logEntry->publish( $logid );
+
                        $comment = $detail; // quick
                        $dbw = wfGetDB( DB_MASTER );
                        $latest = $title->getLatestRevID();