https://bugzilla.wikimedia.org/show_bug.cgi?id=28532

Reedy <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #8406|0                           |1
        is obsolete|                            |

--- Comment #4 from Reedy <[email protected]> 2011-04-18 12:44:14 UTC ---
Comment on attachment 8406
  --> https://bugzilla.wikimedia.org/attachment.cgi?id=8406
Patch

>Index: GlobalFunctions.php
>===================================================================
>--- GlobalFunctions.php        (revision 86120)
>+++ GlobalFunctions.php        (working copy)
>@@ -716,10 +716,12 @@
>  * @return string
>  */
> function wfMsgWikiHtml( $key ) {
>-      global $wgOut;
>+      global $wgMessageCache;
>       $args = func_get_args();
>       array_shift( $args );
>-      return wfMsgReplaceArgs( $wgOut->parse( wfMsgGetKey( $key, true ), /* 
>can't be set to false */ true ), $args );
>+      return wfMsgReplaceArgs(
>+              $wgMessageCache->parse( wfMsgGetKey( $key, true ), null, /* 
>can't be set to false */ true ),
>+              $args );
> }
> 
> /**
>@@ -741,7 +743,7 @@
>  * Behavior for conflicting options (e.g., parse+parseinline) is undefined.
>  */
> function wfMsgExt( $key, $options ) {
>-      global $wgOut;
>+      global $wgMessageCache;
> 
>       $args = func_get_args();
>       array_shift( $args );
>@@ -781,9 +783,9 @@
>       }
> 
>       if( in_array( 'parse', $options, true ) ) {
>-              $string = $wgOut->parse( $string, true, !$forContent, 
>$langCodeObj );
>+              $string = $wgMessageCache->parse( $string, null, true, 
>!$forContent, $langCodeObj );
>       } elseif ( in_array( 'parseinline', $options, true ) ) {
>-              $string = $wgOut->parse( $string, true, !$forContent, 
>$langCodeObj );
>+              $string = $wgMessageCache->parse( $string, null, true, 
>!$forContent, $langCodeObj );
>               $m = array();
>               if( preg_match( '/^<p>(.*)\n?<\/p>\n?$/sU', $string, $m ) ) {
>                       $string = $m[1];
>Index: MessageCache.php
>===================================================================
>--- MessageCache.php   (revision 86120)
>+++ MessageCache.php   (working copy)
>@@ -102,6 +102,8 @@
> 
>       /**
>        * ParserOptions is lazy initialised.
>+       *
>+       * @return ParserOptions
>        */
>       function getParserOptions() {
>               if ( !$this->mParserOptions ) {
>@@ -220,6 +222,8 @@
> 
>       /**
>        * Set the cache to $cache, if it is valid. Otherwise set the cache to 
> false.
>+       *
>+       * @return bool
>        */
>       function setCache( $cache, $code ) {
>               if ( isset( $cache['VERSION'] ) && $cache['VERSION'] == 
> MSG_CACHE_VERSION ) {
>@@ -734,6 +738,21 @@
>                       return $message;
>               }
> 
>+              $parser = $this->getParser();
>+              if ( $parser ) {
>+                      $popts = $this->getParserOptions();
>+                      $popts->setInterfaceMessage( $interface );
>+                      $popts->setTargetLanguage( $language );
>+                      $popts->setUserLang( $language );
>+                      $message = $parser->transformMsg( $message, $popts, 
>$title );
>+              }
>+              return $message;
>+      }
>+
>+      /**
>+       * @return Parser
>+       */
>+      function getParser() {
>               global $wgParser, $wgParserConf;
>               if ( !$this->mParser && isset( $wgParser ) ) {
>                       # Do some initialisation so that we don't have to do it 
> twice
>@@ -746,16 +765,28 @@
>                       } else {
>                               $this->mParser = clone $wgParser;
>                       }
>-                      #wfDebug( __METHOD__ . ": following contents triggered 
>transform: $message\n" );
>               }
>-              if ( $this->mParser ) {
>-                      $popts = $this->getParserOptions();
>-                      $popts->setInterfaceMessage( $interface );
>+              return $this->mParser;
>+      }
>+
>+      /**
>+       * @param $text string
>+       * @param $title
>+       * @param $linestart bool
>+       * @return ParserOutput
>+       */
>+      public function parse( $text, $title = null, $linestart = true, 
>$interface = false, $language = null  ) {
>+              $parser = $this->getParser();
>+              $popts = $this->getParserOptions();
>+
>+              if ( $interface ) {
>+                      $popts->setInterfaceMessage( true );
>+              }
>+              if ( $language !== null ) {
>                       $popts->setTargetLanguage( $language );
>-                      $popts->setUserLang( $language );
>-                      $message = $this->mParser->transformMsg( $message, 
>$popts, $title );
>               }
>-              return $message;
>+
>+              return $parser->parse( $text, $title, $popts, $linestart );
>       }
> 
>       function disable() {
>Index: OutputPage.php
>===================================================================
>--- OutputPage.php     (revision 86120)
>+++ OutputPage.php     (working copy)
>@@ -792,7 +792,7 @@
>        * @param $t Title object
>        */
>       public function setTitle( $t ) {
>-              $this->getContext()->setTitle($t);
>+              $this->getContext()->setTitle( $t );
>       }
> 
>       /**

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to