Revert r107773 - increases parsercache fragmentation without clear benefit
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 3 Jan 2012 21:20:35 +0000 (21:20 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 3 Jan 2012 21:20:35 +0000 (21:20 +0000)
RELEASE-NOTES-1.19
includes/Linker.php
includes/parser/LinkHolderArray.php

index b2c6d82..11297ca 100644 (file)
@@ -211,8 +211,6 @@ production.
   {{NAMESPACE}} relative to correct title.
 * (bug 30485 and bug 33434) Style rules for wikitable are now more specific and
   prevent inheritance to nested tables which caused various issues
-* (bug 32686) Tooltip on links to non-existing pages are now always in user's
-  language
 * (bug 33454) ISO-8601 week-based year number (format character 'o') is now
   calculated correctly with respect to timezone
 * (bug 32219) InstantCommons now fetches content from Wikimedia Commons using
index d96052f..e789113 100644 (file)
@@ -154,20 +154,15 @@ class Linker {
         * @param $query         array  The query string to append to the URL
         *   you're linking to, in key => value array form.  Query keys and values
         *   will be URL-encoded.
-        * @param $options string|array  String or array:
-        *   - Either with numerical index and following values:
-        *     - 'known': Page is known to exist, so don't check if it does.
-        *     - 'broken': Page is known not to exist, so don't check if it does.
-        *     - 'noclasses': Don't add any classes automatically (includes "new",
+        * @param $options string|array  String or array of strings:
+        *     'known': Page is known to exist, so don't check if it does.
+        *     'broken': Page is known not to exist, so don't check if it does.
+        *     'noclasses': Don't add any classes automatically (includes "new",
         *       "stub", "mw-redirect", "extiw").  Only use the class attribute
         *       provided, if any, so you get a simple blue link with no funny i-
         *       cons.
-        *     'forcearticlepath': Use the article path always, even with a querystring.
+        *     'forcearticlepath': Use the article path always, even with a querystring.
         *       Has compatibility issues on some setups, so avoid wherever possible.
-        *   - Or with following indexes:
-        *     - 'language': the value of that index is the language to use; currently
-        *       only used for the tooltip when linking to a page that doesn't exist
-        *       (since 1.19)
         * @return string HTML <a> attribute
         */
        public static function link(
@@ -194,7 +189,7 @@ class Linker {
 
                # If we don't know whether the page exists, let's find out.
                wfProfileIn( __METHOD__ . '-checkPageExistence' );
-               if ( !in_array( 'known', $options, true ) && !in_array( 'broken', $options, true ) ) {
+               if ( !in_array( 'known', $options ) and !in_array( 'broken', $options ) ) {
                        if ( $target->isKnown() ) {
                                $options[] = 'known';
                        } else {
@@ -204,14 +199,14 @@ class Linker {
                wfProfileOut( __METHOD__ . '-checkPageExistence' );
 
                $oldquery = array();
-               if ( in_array( 'forcearticlepath', $options, true ) && $query ) {
+               if ( in_array( "forcearticlepath", $options ) && $query ) {
                        $oldquery = $query;
                        $query = array();
                }
 
                # Note: we want the href attribute first, for prettiness.
                $attribs = array( 'href' => self::linkUrl( $target, $query, $options ) );
-               if ( in_array( 'forcearticlepath', $options, true ) && $oldquery ) {
+               if ( in_array( 'forcearticlepath', $options ) && $oldquery ) {
                        $attribs['href'] = wfAppendQuery( $attribs['href'], wfArrayToCgi( $oldquery ) );
                }
 
@@ -251,7 +246,7 @@ class Linker {
                wfProfileIn( __METHOD__ );
                # We don't want to include fragments for broken links, because they
                # generally make no sense.
-               if ( in_array( 'broken', $options, true ) && $target->mFragment !== '' ) {
+               if ( in_array( 'broken', $options ) && $target->mFragment !== '' ) {
                        $target = clone $target;
                        $target->mFragment = '';
                }
@@ -259,7 +254,7 @@ class Linker {
                # If it's a broken link, add the appropriate query pieces, unless
                # there's already an action specified, or unless 'edit' makes no sense
                # (i.e., for a nonexistent special page).
-               if ( in_array( 'broken', $options, true ) && empty( $query['action'] )
+               if ( in_array( 'broken', $options ) && empty( $query['action'] )
                        && !$target->isSpecialPage() ) {
                        $query['action'] = 'edit';
                        $query['redlink'] = '1';
@@ -279,22 +274,24 @@ class Linker {
         * @return array
         */
        private static function linkAttribs( $target, $attribs, $options ) {
-               global $wgUser;
-
                wfProfileIn( __METHOD__ );
-
+               global $wgUser;
                $defaults = array();
 
-               if ( !in_array( 'noclasses', $options, true ) ) {
+               if ( !in_array( 'noclasses', $options ) ) {
                        wfProfileIn( __METHOD__ . '-getClasses' );
                        # Now build the classes.
                        $classes = array();
 
+                       if ( in_array( 'broken', $options ) ) {
+                               $classes[] = 'new';
+                       }
+
                        if ( $target->isExternal() ) {
                                $classes[] = 'extiw';
-                       } elseif ( in_array( 'broken', $options, true ) ) {
-                               $classes[] = 'new';
-                       } else { # Avoid useless calls to LinkCache (see r50387)
+                       }
+
+                       if ( !in_array( 'broken', $options ) ) { # Avoid useless calls to LinkCache (see r50387)
                                $colour = self::getLinkColour( $target, $wgUser->getStubThreshold() );
                                if ( $colour !== '' ) {
                                        $classes[] = $colour; # mw-redirect or stub
@@ -310,14 +307,10 @@ class Linker {
                if ( $target->getPrefixedText() == '' ) {
                        # A link like [[#Foo]].  This used to mean an empty title
                        # attribute, but that's silly.  Just don't output a title.
-               } elseif ( in_array( 'known', $options, true ) ) {
+               } elseif ( in_array( 'known', $options ) ) {
                        $defaults['title'] = $target->getPrefixedText();
                } else {
-                       $msg = wfMessage( 'red-link-title', $target->getPrefixedText() );
-                       if ( isset( $options['language'] ) ) {
-                               $msg->inLanguage( $options['language'] );
-                       }
-                       $defaults['title'] = $msg->text();
+                       $defaults['title'] = wfMsg( 'red-link-title', $target->getPrefixedText() );
                }
 
                # Finally, merge the custom attribs with the default ones, and iterate
index f679e4a..fb01304 100644 (file)
@@ -363,8 +363,7 @@ class LinkHolderArray {
                                if ( $colours[$pdbk] == 'new' ) {
                                        $linkCache->addBadLinkObj( $title );
                                        $output->addLink( $title, 0 );
-                                       $type = array( 'broken',
-                                               'language' => $this->parent->getOptions()->getUserLangObj() );
+                                       $type = array( 'broken' );
                                } else {
                                        if ( $colours[$pdbk] != '' ) {
                                                $attribs['class'] = $colours[$pdbk];