r103241 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103240‎ | r103241 | r103242 >
Date:22:09, 15 November 2011
Author:foxtrott
Status:deferred
Tags:
Comment:
followup r103234: bug fix (incompatible with MW 1.16)
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormUtils.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormUtils.php
@@ -892,16 +892,21 @@
893893 // parse wiki-text
894894 $output = $tmpParser->parse( $form_def, $title, $tmpParser->getOptions() );
895895 $form_def = $output->getText();
896 - $expiry = $output->getCacheExpiry();
897896
898897 // store in cache if allowed
899898 if ( $sfgCacheFormDefinitions && $form_id !== null ) {
900899
901 - if ( $expiry == 0 ) {
 900+ if ( $output->getCacheTime() == -1 ) {
902901 self::purgeCache( $form_article );
903902 wfDebug( "Caching disabled for form definition $cachekey\n" );
904903 } else {
905 - self::getFormCache()->set( $cachekey, $form_def, $expiry );
 904+
 905+ if ( method_exists( $output, 'getCacheExpiry' ) ) { // MW 1.17+
 906+ self::getFormCache()->set( $cachekey, $form_def, $output->getCacheExpiry() );
 907+ } else { // MW 1.16
 908+ self::getFormCache()->set( $cachekey, $form_def );
 909+ }
 910+
906911 wfDebug( "Cached form definition $cachekey\n" );
907912 }
908913
@@ -968,10 +973,11 @@
969974 } else if ( is_null( $parser ) ) {
970975 return wfMemcKey( 'ext.SemanticForms.formdefinition', $formId );
971976 } else {
972 - if ( method_exists( 'ParserOptions', 'optionsHash' ) ) {
 977+
 978+ if ( method_exists( 'ParserOptions', 'optionsHash' ) ) { // MW 1.17+
973979 $optionsHash = $parser->getOptions()->optionsHash( ParserOptions::legacyOptions() );
974 - } else {
975 - $optionsHash = $parser->getOptions()->getUser()->getPageRenderingHash();
 980+ } else { // MW 1.16
 981+ $optionsHash = $parser->getOptions()->mUser->getPageRenderingHash();
976982 }
977983
978984 return wfMemcKey(

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r103234followup rr102726: Use optionsHash to create cache keyfoxtrott21:55, 15 November 2011