X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Flibs%2Fobjectcache%2FBagOStuff.php;h=7759947ee0e212471b6a29a64dd4f718f99e320d;hb=370bb99a9bb9836286af54856392ecabf09969f7;hp=e6f3e558a37ff80f9a2b12313f6025884b4b741a;hpb=b09b3980f991bb02a64cce0e462b97bada3b4776;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/objectcache/BagOStuff.php b/includes/libs/objectcache/BagOStuff.php index e6f3e558a3..7759947ee0 100644 --- a/includes/libs/objectcache/BagOStuff.php +++ b/includes/libs/objectcache/BagOStuff.php @@ -590,7 +590,11 @@ abstract class BagOStuff implements IExpiringStore, LoggerAwareInterface { * @return bool Success */ public function unlock( $key ) { - if ( isset( $this->locks[$key] ) && --$this->locks[$key]['depth'] <= 0 ) { + if ( !isset( $this->locks[$key] ) ) { + return false; + } + + if ( --$this->locks[$key]['depth'] <= 0 ) { unset( $this->locks[$key] ); $ok = $this->doDelete( "{$key}:lock" ); @@ -1025,15 +1029,17 @@ abstract class BagOStuff implements IExpiringStore, LoggerAwareInterface { } /** + * @internal For testing only * @return float UNIX timestamp * @codeCoverageIgnore */ - protected function getCurrentTime() { + public function getCurrentTime() { return $this->wallClockOverride ?: microtime( true ); } /** - * @param float|null &$time Mock UNIX timestamp for testing + * @internal For testing only + * @param float|null &$time Mock UNIX timestamp * @codeCoverageIgnore */ public function setMockTime( &$time ) {