Merge "In LinkHolderArray::doVariants(), redlinks need to be checked as well."
authorAaron Schulz <aschulz@wikimedia.org>
Sun, 15 Jul 2012 20:15:49 +0000 (20:15 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 15 Jul 2012 20:15:50 +0000 (20:15 +0000)
1  2 
includes/parser/LinkHolderArray.php

@@@ -209,10 -209,6 +209,10 @@@ class LinkHolderArray 
         * article length checks (for stub links) to be bundled into a single query.
         *
         * @param $nt Title
 +       * @param $text String
 +       * @param $query Array [optional]
 +       * @param $trail String [optional]
 +       * @param $prefix String [optional]
         * @return string
         */
        function makeHolder( $nt, $text = '', $query = array(), $trail = '', $prefix = ''  ) {
                        foreach ( $entries as $index => $entry ) {
                                $pdbk = $entry['pdbk'];
                                // we only deal with new links (in its first query)
-                               if ( !isset( $colours[$pdbk] ) ) {
+                               if ( !isset( $colours[$pdbk] ) || $colours[$pdbk] === 'new' ) {
                                        $title = $entry['title'];
                                        $titleText = $title->getText();
                                        $titlesAttrs[] = array(
                }
  
                // Now do the conversion and explode string to text of titles
-               $titlesAllVariants = $wgContLang->autoConvertToAllVariants( $titlesToBeConverted );
+               $titlesAllVariants = $wgContLang->autoConvertToAllVariants( rtrim( $titlesToBeConverted, "\0" ) );
                $allVariantsName = array_keys( $titlesAllVariants );
                foreach ( $titlesAllVariants as &$titlesVariant ) {
                        $titlesVariant = explode( "\0", $titlesVariant );
                                        $entry =& $this->internals[$ns][$index];
                                        $pdbk = $entry['pdbk'];
  
-                                       if(!isset($colours[$pdbk])){
+                                       if ( !isset( $colours[$pdbk] ) || $colours[$pdbk] === 'new' ) {
                                                // found link in some of the variants, replace the link holder data
                                                $entry['title'] = $variantTitle;
                                                $entry['pdbk'] = $varPdbk;