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 ff53c08
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
10 changes: 9 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@
"psr/cache": "^2.0||^3.0",
"psr/simple-cache": "^2.0||^3.0",
"ext-mbstring": "*",
"ext-json": "*"
"ext-json": "*",
"doctrine/couchdb": "dev-master",
"phpfastcache/phpssdb": "~1.1",
"predis/predis": "~1.1",
"mongodb/mongodb": "~1.9",
"triagens/arangodb": "~3.8",
"aws/aws-sdk-php": "~3.2",
"google/cloud-firestore": "~1.20",
"solarium/solarium": "~6.1"
},
"require-dev": {
"league/climate": "^3.8",
Expand Down
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 ff53c08

Please sign in to comment.