* @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" );
}
/**
+ * @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 ) {