From f7f573c3d010dc870dbcee3ab2c2e854392be739 Mon Sep 17 00:00:00 2001 From: Domas Mituzas Date: Sat, 11 Jul 2009 08:04:31 +0000 Subject: [PATCH] Fix Bug#19637 - self-referencing externals will be by default filtered out --- RELEASE-NOTES | 3 +++ includes/DefaultSettings.php | 6 ++++++ includes/parser/ParserOutput.php | 8 +++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7957a814d0..74aed7cec0 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -52,6 +52,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN functionality is now available via $wgLocalisationCacheConf. * $wgMessageCache->addMessages() is deprecated. Messages added via this interface will not appear in Special:AllMessages. +* $wgRegisterInternalExternals can be used to record external links pointing + to same server === New features in 1.16 === @@ -238,6 +240,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 19468) Enotif preferences are now only displayed when they are turned on * (bug 19442) Show/hide options on watchlist only work once * (bug 19602) PubMed Magic links now use updated NIH url +* (bug 19637) externallinks have links to self == API changes in 1.16 == diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 8e1bbb1f18..e9fcf48e1f 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3752,6 +3752,12 @@ $wgParserConf = array( */ $wgLinkHolderBatchSize = 1000; +/** + * By default MediaWiki does not register links pointing to same server in externallinks dataset, + * use this value to override: + */ +$wgRegisterInternalExternals = false; + /** * Hooks that are used for outputting exceptions. Format is: * $wgExceptionHooks[] = $funcname diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php index 46ae1a7fe8..e0b0f77604 100644 --- a/includes/parser/ParserOutput.php +++ b/includes/parser/ParserOutput.php @@ -74,7 +74,6 @@ class ParserOutput function addCategory( $c, $sort ) { $this->mCategories[$c] = $sort; } function addLanguageLink( $t ) { $this->mLanguageLinks[] = $t; } - function addExternalLink( $url ) { $this->mExternalLinks[$url] = 1; } function addWarning( $s ) { $this->mWarnings[$s] = 1; } function addOutputHook( $hook, $data = false ) { @@ -94,6 +93,13 @@ class ParserOutput return (bool)$this->mNewSection; } + function addExternalLink( $url ) { + # We don't register links pointing to our own server, unless... :-) + global $wgServer, $wgRegisterInternalExternals; + if( $wgRegisterInternalExternals or stripos($url,$wgServer)!==0) + $this->mExternalLinks[$url] = 1; + } + function addLink( $title, $id = null ) { $ns = $title->getNamespace(); $dbk = $title->getDBkey(); -- 2.20.1