From d7e71b5e7181433eaf903b3283e5bf3616cfb442 Mon Sep 17 00:00:00 2001 From: Lucas Werkmeister Date: Sat, 8 Jun 2019 18:30:20 +0200 Subject: [PATCH] objectcache: Make BagOStuff::getCurrentTime() public MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If another cache wraps a BagOStuff, it may need to know about the BagOStuff’s notion of the current time, which may be mocked and differ from the real time. Change-Id: I40f4085d4cf549314394d3140cccb1fe4e48690a --- includes/libs/objectcache/BagOStuff.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/libs/objectcache/BagOStuff.php b/includes/libs/objectcache/BagOStuff.php index 0dd7b57c6d..321476bbf2 100644 --- a/includes/libs/objectcache/BagOStuff.php +++ b/includes/libs/objectcache/BagOStuff.php @@ -806,15 +806,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 ) { -- 2.20.1