From: umherirrender Date: Sun, 10 Jul 2016 20:17:27 +0000 (+0200) Subject: Parse sidebar message for main page when cache is enabled X-Git-Tag: 1.31.0-rc.0~6413^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=f70dc2c88d38ec9dfd742022b07f290c34b6fb56;p=lhc%2Fweb%2Fwiklou.git Parse sidebar message for main page when cache is enabled When the sidebar cache is enabled, parse the messages for the links and link text of the sidebar with the main page as title, because variable like FULLPAGENAME would vary on page, but cache does not. Change-Id: I0bbb05f1abe4be1a61f520d647c8ca696d184ccf --- diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php index 729f56451b..64d2f8bd45 100644 --- a/includes/skins/Skin.php +++ b/includes/skins/Skin.php @@ -1241,6 +1241,8 @@ abstract class Skin extends ContextSource { $lines = explode( "\n", $text ); $heading = ''; + $messageTitle = $this->getConfig()->get( 'EnableSidebarCache' ) + ? Title::newMainPage() : $this->getTitle(); foreach ( $lines as $line ) { if ( strpos( $line, '*' ) !== 0 ) { @@ -1257,7 +1259,7 @@ abstract class Skin extends ContextSource { $line = trim( $line, '* ' ); if ( strpos( $line, '|' ) !== false ) { // sanity check - $line = MessageCache::singleton()->transform( $line, false, null, $this->getTitle() ); + $line = MessageCache::singleton()->transform( $line, false, null, $messageTitle ); $line = array_map( 'trim', explode( '|', $line, 2 ) ); if ( count( $line ) !== 2 ) { // Second sanity check, could be hit by people doing @@ -1267,7 +1269,7 @@ abstract class Skin extends ContextSource { $extraAttribs = []; - $msgLink = $this->msg( $line[0] )->inContentLanguage(); + $msgLink = $this->msg( $line[0] )->title( $messageTitle )->inContentLanguage(); if ( $msgLink->exists() ) { $link = $msgLink->text(); if ( $link == '-' ) { @@ -1276,7 +1278,7 @@ abstract class Skin extends ContextSource { } else { $link = $line[0]; } - $msgText = $this->msg( $line[1] ); + $msgText = $this->msg( $line[1] )->title( $messageTitle ); if ( $msgText->exists() ) { $text = $msgText->text(); } else {