Fix Bug#19637 - self-referencing externals will be by default filtered out
authorDomas Mituzas <midom@users.mediawiki.org>
Sat, 11 Jul 2009 08:04:31 +0000 (08:04 +0000)
committerDomas Mituzas <midom@users.mediawiki.org>
Sat, 11 Jul 2009 08:04:31 +0000 (08:04 +0000)
RELEASE-NOTES
includes/DefaultSettings.php
includes/parser/ParserOutput.php

index 7957a81..74aed7c 100644 (file)
@@ -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 ==
 
index 8e1bbb1..e9fcf48 100644 (file)
@@ -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
index 46ae1a7..e0b0f77 100644 (file)
@@ -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();