From 7507bceff0d6062cc4d3c9e01c14b8e25fb47e4f Mon Sep 17 00:00:00 2001 From: Georges Date: Wed, 30 Aug 2023 19:09:41 +0200 Subject: [PATCH] Revert "Fixed missing Solr constant in getStats()" --- lib/Phpfastcache/Drivers/Solr/Driver.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Phpfastcache/Drivers/Solr/Driver.php b/lib/Phpfastcache/Drivers/Solr/Driver.php index c2d8ca2f..73c6f863 100644 --- a/lib/Phpfastcache/Drivers/Solr/Driver.php +++ b/lib/Phpfastcache/Drivers/Solr/Driver.php @@ -270,11 +270,18 @@ public function getStats(): DriverStatistic } } + $version = 'Unknown version'; + if (method_exists($this->instance, 'getVersion')) { + $version = $this->instance::getVersion(); + } elseif (defined($this->instance::class . '::VERSION')) { + $version = constant($this->instance::class . '::VERSION'); + } + return (new DriverStatistic()) ->setData(implode(', ', array_keys($this->itemInstances))) ->setInfo(sprintf( 'Solarium %s and Solr %s for %s %s. %d document(s) stored in the "%s" core', - $this->instance::VERSION, + $version, $serverSystemInfo['lucene']['solr-spec-version'] ?? '[unknown SOLR version]', $serverSystemInfo['system']['name'] ?? '[unknown OS]', $serverSystemInfo['system']['version'] ?? '[unknown OS version]',