Hooks: Added ImportLogInterwikiLink hook
[lhc/web/wiklou.git] / includes / specials / SpecialImport.php
index e2bc629..0574dbc 100644 (file)
@@ -51,6 +51,10 @@ class SpecialImport extends SpecialPage {
                parent::__construct( 'Import', 'import' );
        }
 
+       public function doesWrites() {
+               return true;
+       }
+
        /**
         * Execute
         * @param string|null $par
@@ -596,30 +600,33 @@ class ImportReporter extends ContextSource {
                                        "</li>\n"
                        );
 
+                       $logParams = array( '4:number:count' => $successCount );
                        if ( $this->mIsUpload ) {
                                $detail = $this->msg( 'import-logentry-upload-detail' )->numParams(
                                        $successCount )->inContentLanguage()->text();
-                               if ( $this->reason ) {
-                                       $detail .= $this->msg( 'colon-separator' )->inContentLanguage()->text()
-                                               . $this->reason;
-                               }
                                $action = 'upload';
                        } else {
-                               $interwiki = '[[:' . $this->mInterwiki . ':' .
-                                       $foreignTitle->getFullText() . ']]';
+                               $pageTitle = $foreignTitle->getFullText();
+                               $fullInterwikiPrefix = $this->mInterwiki;
+                               Hooks::run( 'ImportLogInterwikiLink', array( &$fullInterwikiPrefix, &$pageTitle ) );
+
+                               $interwikiTitleStr = $fullInterwikiPrefix . ':' . $pageTitle;
+                               $interwiki = '[[:' . $interwikiTitleStr . ']]';
                                $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;
-                               }
                                $action = 'interwiki';
+                               $logParams['5:title-link:interwiki'] = $interwikiTitleStr;
+                       }
+                       if ( $this->reason ) {
+                               $detail .= $this->msg( 'colon-separator' )->inContentLanguage()->text()
+                                       . $this->reason;
                        }
 
                        $logEntry = new ManualLogEntry( 'import', $action );
                        $logEntry->setTarget( $title );
-                       $logEntry->setComment( $detail );
+                       $logEntry->setComment( $this->reason );
                        $logEntry->setPerformer( $this->getUser() );
+                       $logEntry->setParameters( $logParams );
                        $logid = $logEntry->insert();
                        $logEntry->publish( $logid );