Skip to content

Commit

Permalink
Fixed missing Solr constant in getStats()
Browse files Browse the repository at this point in the history
  • Loading branch information
Geolim4 committed Aug 30, 2023
1 parent 8614c56 commit c82647a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/Phpfastcache/Drivers/Solr/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]',
Expand Down

0 comments on commit c82647a

Please sign in to comment.