From: Fomafix Date: Tue, 15 Dec 2015 10:25:33 +0000 (+0000) Subject: Message: Only clear message cache when set language is different X-Git-Tag: 1.34.0-rc.0~5254^2 X-Git-Url: http://git.cyclocoop.org/data/%27%20.%20mediabox_timestamp%28find_in_path%28%27javascript/%7B%24www_url%7Dadmin/compta/operations/%40%20%27info_etape_suivante_2%27%20=%3E%20%27You%20can%20move%20on%20to%20the%20next%20step.%27%2C%20%27info_exceptions_proxy%27%20=%3E%20%27Exceptions%20for%20the%20proxy%27%2C%20%27info_exportation_base%27%20=%3E%20%27export%20database%20to%20%40archive%40%27%2C-%27info_facilite_suivi_activite%27%20=%3E%20%27To%20simplify%20monitoring%20of%20the%20site/%27s%20editorial;-%20%20activities%2C%20SPIP%20can%20send%20rmail%20notifications%2C%20e.g.%20to%20an%20editors/%27.%28%24current%20%3E%202?a=commitdiff_plain;h=174f0d28dfd957ef9b671e7a2191bf4fd8ceb1b6;p=lhc%2Fweb%2Fwiklou.git Message: Only clear message cache when set language is different Change-Id: Ic0d810b9017b2cc693282807540ddf3e4d952b9d --- diff --git a/includes/Message.php b/includes/Message.php index 7d05f41e86..fb6dcc5466 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -726,6 +726,8 @@ class Message implements MessageSpecifier, Serializable { * @throws MWException */ public function inLanguage( $lang ) { + $previousLanguage = $this->language; + if ( $lang instanceof Language ) { $this->language = $lang; } elseif ( is_string( $lang ) ) { @@ -740,7 +742,11 @@ class Message implements MessageSpecifier, Serializable { . "passed a String or Language object; $type given" ); } - $this->message = null; + + if ( $this->language !== $previousLanguage ) { + // The language has changed. Clear the message cache. + $this->message = null; + } $this->interface = false; return $this; }