From 7bacda9a0fabb7ff5f8ed8f9aef67053d5500dd3 Mon Sep 17 00:00:00 2001 From: Matt Peel Date: Tue, 5 Dec 2017 13:38:35 +1300 Subject: [PATCH] FIX: coreIsActive() failed when using a namespaced core --- src/Solr/Services/SolrService.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Solr/Services/SolrService.php b/src/Solr/Services/SolrService.php index ae37a32..5cff62d 100644 --- a/src/Solr/Services/SolrService.php +++ b/src/Solr/Services/SolrService.php @@ -36,8 +36,14 @@ class SolrService extends SolrService_Core */ public function coreIsActive($core) { + // Request the status of the full core name $result = $this->coreCommand('STATUS', $core); - return isset($result->status->$core->uptime); + + // Solr returns the core as the 'short name' of the class (e.g. Mysite\Search\SolrIndex -> SolrIndex) + $reflection = new \ReflectionClass($core); + $shortClass = $reflection->getShortName(); + + return isset($result->status->$shortClass->uptime); } /**