From: Ricordisamoa Date: Wed, 10 Feb 2016 17:26:25 +0000 (+0100) Subject: Stop doing $that = $this in includes/libs X-Git-Tag: 1.31.0-rc.0~8021^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=60be0296c3788ab6a234f3c3ff8e7bd45f4c9143;p=lhc%2Fweb%2Fwiklou.git Stop doing $that = $this in includes/libs Closures support $this as of PHP 5.4 Change-Id: I1b5a5d7e619029684cb8d2a8d150fcc13051c2e0 --- diff --git a/includes/libs/objectcache/BagOStuff.php b/includes/libs/objectcache/BagOStuff.php index 3736103351..a7e8a4780b 100644 --- a/includes/libs/objectcache/BagOStuff.php +++ b/includes/libs/objectcache/BagOStuff.php @@ -397,18 +397,15 @@ abstract class BagOStuff implements IExpiringStore, LoggerAwareInterface { } $lSince = microtime( true ); // lock timestamp - // PHP 5.3: Can't use $this in a closure - $that = $this; - $logger = $this->logger; - return new ScopedCallback( function() use ( $that, $logger, $key, $lSince, $expiry ) { + return new ScopedCallback( function() use ( $key, $lSince, $expiry ) { $latency = .050; // latency skew (err towards keeping lock present) $age = ( microtime( true ) - $lSince + $latency ); if ( ( $age + $latency ) >= $expiry ) { - $logger->warning( "Lock for $key held too long ($age sec)." ); + $this->logger->warning( "Lock for $key held too long ($age sec)." ); return; // expired; it's not "safe" to delete the key } - $that->unlock( $key ); + $this->unlock( $key ); } ); }