Index: trunk/extensions/InteractiveBlockMessage/InteractiveBlockMessage.php |
— | — | @@ -25,9 +25,6 @@ |
26 | 26 | |
27 | 27 | $dir = dirname( __FILE__ ); |
28 | 28 | |
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 | | - |
32 | 29 | $wgAutoloadClasses['InteractiveBlockMessage'] = "$dir/InteractiveBlockMessage.php"; |
33 | 30 | $wgAutoloadClasses['InteractiveBlockMessageHooks'] = "$dir/InteractiveBlockMessageHooks.php"; |
34 | 31 | |
Index: trunk/extensions/InteractiveBlockMessage/InteractiveBlockMessageHooks.php |
— | — | @@ -51,8 +51,13 @@ |
52 | 52 | // if user is blocked it's pretty much possible they will be unblocked one day :) |
53 | 53 | // so we enable cache for shorter time only so that we can recheck later |
54 | 54 | // 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 | + } |
57 | 62 | } |
58 | 63 | $ret = 'true'; |
59 | 64 | return true; |