Skip to content

Commit c82647a

Browse files
committed
Fixed missing Solr constant in getStats()
1 parent 8614c56 commit c82647a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/Phpfastcache/Drivers/Solr/Driver.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,18 @@ public function getStats(): DriverStatistic
270270
}
271271
}
272272

273+
$version = 'Unknown version';
274+
if (method_exists($this->instance, 'getVersion')) {
275+
$version = $this->instance::getVersion();
276+
} elseif (defined($this->instance::class . '::VERSION')) {
277+
$version = constant($this->instance::class . '::VERSION');
278+
}
279+
273280
return (new DriverStatistic())
274281
->setData(implode(', ', array_keys($this->itemInstances)))
275282
->setInfo(sprintf(
276283
'Solarium %s and Solr %s for %s %s. %d document(s) stored in the "%s" core',
277-
$this->instance::VERSION,
284+
$version,
278285
$serverSystemInfo['lucene']['solr-spec-version'] ?? '[unknown SOLR version]',
279286
$serverSystemInfo['system']['name'] ?? '[unknown OS]',
280287
$serverSystemInfo['system']['version'] ?? '[unknown OS version]',

0 commit comments

Comments
 (0)