Index: trunk/extensions/InteractiveBlockMessage/InteractiveBlockMessageHooks.php |
— | — | @@ -39,31 +39,31 @@ |
40 | 40 | return true; |
41 | 41 | } |
42 | 42 | |
43 | | - if ( $parser->getTitle()->getNamespace() != NS_USER && $parser->getTitle()->getNamespace() != NS_USER_TALK ) { |
| 43 | + $title = $parser->getTitle(); |
| 44 | + if ( $title->getNamespace() != NS_USER && $title->getNamespace() != NS_USER_TALK ) { |
44 | 45 | $ret = 'unknown'; |
45 | 46 | return true; |
46 | 47 | } |
47 | 48 | |
48 | | - $user = User::newFromName( $parser->getTitle()->getBaseText() ); |
| 49 | + $user = User::newFromName( $title->getBaseText() ); |
49 | 50 | if ( $user instanceof User ) { |
50 | | - if ( $user->isBlocked() ) { |
51 | | - // if user is blocked it's pretty much possible they will be unblocked one day :) |
52 | | - // so we enable cache for shorter time only so that we can recheck later |
53 | | - // if they weren't already unblocked - if there is a better way to do that, fix me |
54 | | - $expiry = $user->getBlock()->mExpiry; |
55 | | - if ( is_numeric ($expiry) ) { // sometimes this is 'infinityinfinity'. in that case, use the default cache expiry time. |
56 | | - $expiry = wfTimestamp( TS_UNIX, $expiry ) - wfTimestamp( TS_UNIX ); |
57 | | - if ( $expiry > 0 ) { |
58 | | - // just to make sure |
59 | | - $parser->getOutput()->updateCacheExpiry( $expiry ); |
60 | | - } |
61 | | - } |
62 | | - $ret = 'true'; |
63 | | - return true; |
64 | | - } else { |
| 51 | + if ( !$user->isBlocked() ) { |
65 | 52 | $ret = 'false'; |
66 | 53 | return true; |
67 | 54 | } |
| 55 | + // if user is blocked it's pretty much possible they will be unblocked one day :) |
| 56 | + // so we enable cache for shorter time only so that we can recheck later |
| 57 | + // if they weren't already unblocked - if there is a better way to do that, fix me |
| 58 | + $expiry = $user->getBlock()->mExpiry; |
| 59 | + if ( is_numeric ( $expiry ) ) { // sometimes this is 'infinityinfinity'. in that case, use the default cache expiry time. |
| 60 | + $expiry = wfTimestamp( TS_UNIX, $expiry ) - wfTimestamp( TS_UNIX ); |
| 61 | + if ( $expiry > 0 ) { |
| 62 | + // just to make sure |
| 63 | + $parser->getOutput()->updateCacheExpiry( $expiry ); |
| 64 | + } |
| 65 | + } |
| 66 | + $ret = 'true'; |
| 67 | + return true; |
68 | 68 | } |
69 | 69 | $ret = 'unknown'; |
70 | 70 | return true; |