public function getStatus()
    {
        $reports = [];
        $solrConnections = GeneralUtility::makeInstance(ConnectionManager::class)->getAllConnections();

        foreach ($solrConnections as $solrConnection) {
            $coreAdmin = $solrConnection->getAdminService();
            /** @var $solrConnection SolrConnection */
            if (!$coreAdmin->ping()) {
                $url = $coreAdmin->__toString();
                $pingFailedMsg = 'Could not ping solr server, can not check version ' . (string)$url;
                $status = GeneralUtility::makeInstance(
                    Status::class,
                    /** @scrutinizer ignore-type */ 'Apache Solr Version',
                    /** @scrutinizer ignore-type */ 'Not accessible',
                    /** @scrutinizer ignore-type */ $pingFailedMsg,
                    /** @scrutinizer ignore-type */ Status::ERROR
                );
                $reports[] = $status;
                continue;
            }

            $solrVersion = $coreAdmin->getSolrServerVersion();
            $isOutdatedVersion = version_compare($this->getCleanSolrVersion($solrVersion), self::REQUIRED_SOLR_VERSION, '<');

            if (!$isOutdatedVersion) {
                continue;
            }

            $formattedVersion = $this->formatSolrVersion($solrVersion);
            $variables = ['requiredVersion' => self::REQUIRED_SOLR_VERSION, 'currentVersion' => $formattedVersion, 'solr' => $coreAdmin];
            $report = $this->getRenderedReport('SolrVersionStatus.html', $variables);
            $status = GeneralUtility::makeInstance(
                Status::class,
                /** @scrutinizer ignore-type */ 'Apache Solr Version',
                /** @scrutinizer ignore-type */ 'Outdated, Unsupported',
                /** @scrutinizer ignore-type */ $report,
                /** @scrutinizer ignore-type */ Status::ERROR
            );

            $reports[] = $status;
        }

        return $reports;
    }
public function getStatus()
    {
        $reports = [];
        $solrConnections = GeneralUtility::makeInstance(ConnectionManager::class)->getAllConnections();

        foreach ($solrConnections as $solrConnection) {
            $coreAdmin = $solrConnection->getAdminService();
            /** @var $solrConnection SolrConnection */
            if (!$coreAdmin->ping()) {
                $url = $coreAdmin->__toString();
                $pingFailedMsg = 'Could not ping solr server, can not check version ' . (string)$url;
                $status = GeneralUtility::makeInstance(
                    Status::class,
                    /** @scrutinizer ignore-type */ 'Apache Solr Version',
                    /** @scrutinizer ignore-type */ 'Not accessible',
                    /** @scrutinizer ignore-type */ $pingFailedMsg,
                    /** @scrutinizer ignore-type */ Status::ERROR
                );
                $reports[] = $status;
                continue;
            }

            $solrVersion = $coreAdmin->getSolrServerVersion();
            $isOutdatedVersion = version_compare($this->getCleanSolrVersion($solrVersion), self::REQUIRED_SOLR_VERSION, '<');

            if (!$isOutdatedVersion) {
                continue;
            }

            $formattedVersion = $this->formatSolrVersion($solrVersion);
            $variables = ['requiredVersion' => self::REQUIRED_SOLR_VERSION, 'currentVersion' => $formattedVersion, 'solr' => $coreAdmin];
            $report = $this->getRenderedReport('SolrVersionStatus.html', $variables);
            $status = GeneralUtility::makeInstance(
                Status::class,
                /** @scrutinizer ignore-type */ 'Apache Solr Version',
                /** @scrutinizer ignore-type */ 'Outdated, Unsupported',
                /** @scrutinizer ignore-type */ $report,
                /** @scrutinizer ignore-type */ Status::ERROR
            );

            $reports[] = $status;
        }

        return $reports;
    }
public function getStatus ( ) { $ reports = [ ] ; $ solrConnections = GeneralUtility :: makeInstance ( ConnectionManager :: class ) -> getAllConnections ( ) ; foreach ( $ solrConnections as $ solrConnection ) { $ coreAdmin = $ solrConnection -> getAdminService ( ) ; /** @var $solrConnection SolrConnection */ if ( ! $ coreAdmin -> ping ( ) ) { $ url = $ coreAdmin -> __toString ( ) ; $ pingFailedMsg = 'Could not ping solr server, can not check version ' . ( string ) $ url ; $ status = GeneralUtility :: makeInstance ( Status :: class , /** @scrutinizer ignore-type */ 'Apache Solr Version' , /** @scrutinizer ignore-type */ 'Not accessible' , /** @scrutinizer ignore-type */ $ pingFailedMsg , /** @scrutinizer ignore-type */ Status :: ERROR ) ; $ reports [ ] = $ status ; continue ; } $ solrVersion = $ coreAdmin -> getSolrServerVersion ( ) ; $ isOutdatedVersion = version_compare ( $ this -> getCleanSolrVersion ( $ solrVersion ) , self :: REQUIRED_SOLR_VERSION , '<' ) ; if ( ! $ isOutdatedVersion ) { continue ; } $ formattedVersion = $ this -> formatSolrVersion ( $ solrVersion ) ; $ variables = [ 'requiredVersion' => self :: REQUIRED_SOLR_VERSION , 'currentVersion' => $ formattedVersion , 'solr' => $ coreAdmin ] ; $ report = $ this -> getRenderedReport ( 'SolrVersionStatus.html' , $ variables ) ; $ status = GeneralUtility :: makeInstance ( Status :: class , /** @scrutinizer ignore-type */ 'Apache Solr Version' , /** @scrutinizer ignore-type */ 'Outdated, Unsupported' , /** @scrutinizer ignore-type */ $ report , /** @scrutinizer ignore-type */ Status :: ERROR ) ; $ reports [ ] = $ status ; } return $ reports ; }
Compiles a version check against each configured Solr server.
Compiles a version check against each configured Solr server .