r103826 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103825‎ | r103826 | r103827 >
Date:18:18, 21 November 2011
Author:petrb
Status:ok
Tags:
Comment:
now update cache as long as block is going to last
Modified paths:
  • /trunk/extensions/InteractiveBlockMessage/InteractiveBlockMessage.php (modified) (history)
  • /trunk/extensions/InteractiveBlockMessage/InteractiveBlockMessageHooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/InteractiveBlockMessage/InteractiveBlockMessage.php
@@ -25,9 +25,6 @@
2626
2727 $dir = dirname( __FILE__ );
2828
29 -//this value tells the parser for how long the page where magic word is used should be cached
30 -$wgInteractiveBlockMessageCacheTimeout = 3600; // 1 hour as default
31 -
3229 $wgAutoloadClasses['InteractiveBlockMessage'] = "$dir/InteractiveBlockMessage.php";
3330 $wgAutoloadClasses['InteractiveBlockMessageHooks'] = "$dir/InteractiveBlockMessageHooks.php";
3431
Index: trunk/extensions/InteractiveBlockMessage/InteractiveBlockMessageHooks.php
@@ -51,8 +51,13 @@
5252 // if user is blocked it's pretty much possible they will be unblocked one day :)
5353 // so we enable cache for shorter time only so that we can recheck later
5454 // if they weren't already unblocked - if there is a better way to do that, fix me
55 - if ( $user->getBlock()->mExpiry != 'infinityinfinity' ) { // this definitely needs fix :P
56 - $parser->getOutput()->updateCacheExpiry($wgInteractiveBlockMessageCacheTimeout);
 55+ $expiry = $user->getBlock()->mExpiry;
 56+ if ( $expiry != 'infinityinfinity' ) { // this definitely needs fix :P
 57+ $expiry = wfTimestamp( TS_UNIX, $expiry ) - wfTimestamp( TS_UNIX );
 58+ if ( $expiry > 0 ) {
 59+ // just to make sure
 60+ $parser->getOutput()->updateCacheExpiry($expiry);
 61+ }
5762 }
5863 $ret = 'true';
5964 return true;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r103809Introduced cache time and yes that comparison of infinity time really suck ho...petrb14:11, 21 November 2011

Status & tagging log