Hooks: Added ImportLogInterwikiLink hook
authorgeorggi <bmp2558@gmail.com>
Sat, 16 Jan 2016 10:32:12 +0000 (12:32 +0200)
committergeorggi <bmp2558@gmail.com>
Sat, 16 Jan 2016 11:05:17 +0000 (13:05 +0200)
ImportLogInterwikiLink. Hook to change the interwiki link used in log entries and edit summaries for transwiki imports.

Change-Id: I03e054de16d8820c0f3d2c165288e229960d6bb1

docs/hooks.txt
includes/specials/SpecialImport.php

index 5e50cec..2b5e1e0 100644 (file)
@@ -1646,6 +1646,11 @@ Return false to stop further processing of the tag
 $reader: XMLReader object
 $revisionInfo: Array of information
 
+'ImportLogInterwikiLink': Hook to change the interwiki link used in log entries
+and edit summaries for transwiki imports.
+&$fullInterwikiPrefix: Interwiki prefix, may contain colons.
+&$pageTitle: String that contains page title.
+
 'ImportSources': Called when reading from the $wgImportSources configuration
 variable. Can be used to lazy-load the import sources list.
 &$importSources: The value of $wgImportSources. Modify as necessary. See the
index 97e093b..0574dbc 100644 (file)
@@ -606,7 +606,11 @@ class ImportReporter extends ContextSource {
                                        $successCount )->inContentLanguage()->text();
                                $action = 'upload';
                        } else {
-                               $interwikiTitleStr = $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();