Merge pull request #243 from creative-commoners/pulls/3.4/phpdocs

Update namespace references in broken PHP docs and simplify condition logic
This commit is contained in:
Guy Marriott 2019-01-28 09:27:24 +13:00 committed by GitHub
commit 46c7477ad5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 19 deletions

View File

@ -9,6 +9,8 @@ use SilverStripe\Core\Manifest\ModuleLoader;
use SilverStripe\FullTextSearch\Search\FullTextSearch;
use SilverStripe\FullTextSearch\Solr\Services\Solr4Service;
use SilverStripe\FullTextSearch\Solr\Services\Solr3Service;
use SilverStripe\FullTextSearch\Solr\Services\SolrService;
use SilverStripe\FullTextSearch\Solr\Services\SolrService_Core;
class Solr
{
@ -112,14 +114,14 @@ class Solr
/** @var SolrService | null - The instance of SolrService for core management */
protected static $service_singleton = null;
/** @var [SolrService_Core] - The instances of SolrService_Core for each core */
/** @var SolrService_Core[] - The instances of SolrService_Core for each core */
protected static $service_core_singletons = array();
/**
* Get a SolrService
*
* @param string $core Optional name of index class
* @return SolrService_Core
* @return SolrService|SolrService_Core
*/
public static function service($core = null)
{
@ -142,9 +144,8 @@ class Solr
}
return self::$service_core_singletons[$core];
} else {
return self::$service_singleton;
}
return self::$service_singleton;
}
public static function get_indexes()

View File

@ -12,6 +12,7 @@ use SilverStripe\FullTextSearch\Search\Queries\SearchQuery;
use SilverStripe\FullTextSearch\Search\Queries\SearchQuery_Range;
use SilverStripe\FullTextSearch\Search\Variants\SearchVariant;
use SilverStripe\FullTextSearch\Search\SearchIntrospection;
use SilverStripe\FullTextSearch\Solr\Stores\SolrConfigStore;
use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\FieldType\DBField;

View File

@ -3,6 +3,7 @@ namespace SilverStripe\FullTextSearch\Solr\Tasks;
use Monolog\Handler\StreamHandler;
use Psr\Log\LoggerInterface;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\BuildTask;
use SilverStripe\FullTextSearch\Utils\Logging\SearchLogFactory;
@ -52,7 +53,7 @@ class Solr_BuildTask extends BuildTask
/**
* Setup task
*
* @param SS_HTTPReqest $request
* @param HTTPRequest $request
*/
public function run($request)
{

View File

@ -4,6 +4,7 @@ namespace SilverStripe\FullTextSearch\Solr\Tasks;
use Exception;
use SilverStripe\Core\ClassInfo;
use SilverStripe\FullTextSearch\Solr\Solr;
use SilverStripe\FullTextSearch\Solr\SolrIndex;
use SilverStripe\FullTextSearch\Solr\Stores\SolrConfigStore_File;
use SilverStripe\FullTextSearch\Solr\Stores\SolrConfigStore_WebDAV;
use SilverStripe\FullTextSearch\Solr\Stores\SolrConfigStore;
@ -50,29 +51,30 @@ class Solr_Configure extends Solr_BuildTask
protected function updateIndex($instance, $store)
{
$index = $instance->getIndexName();
$this->getLogger()->addInfo("Configuring $index.");
$this->getLogger()->info("Configuring $index.");
// Upload the config files for this index
$this->getLogger()->addInfo("Uploading configuration ...");
$this->getLogger()->info("Uploading configuration ...");
$instance->uploadConfig($store);
// Then tell Solr to use those config files
$service = Solr::service();
if ($service->coreIsActive($index)) {
$this->getLogger()->addInfo("Reloading core ...");
$this->getLogger()->info("Reloading core ...");
$service->coreReload($index);
} else {
$this->getLogger()->addInfo("Creating core ...");
$this->getLogger()->info("Creating core ...");
$service->coreCreate($index, $store->instanceDir($index));
}
$this->getLogger()->addInfo("Done");
$this->getLogger()->info("Done");
}
/**
* Get config store
*
* @return SolrConfigStore
* @throws Exception
*/
protected function getSolrConfigStore()
{
@ -85,14 +87,15 @@ class Solr_Configure extends Solr_BuildTask
// Find the IndexStore handler, which will handle uploading config files to Solr
$mode = $indexstore['mode'];
if ($mode == 'file') {
if ($mode === 'file') {
return new SolrConfigStore_File($indexstore);
} elseif ($mode == 'webdav') {
return new SolrConfigStore_WebDAV($indexstore);
} elseif (ClassInfo::exists($mode) && ClassInfo::classImplements($mode, SolrConfigStore::class)) {
return new $mode($indexstore);
} else {
user_error('Unknown Solr index mode ' . $indexstore['mode'], E_USER_ERROR);
}
if ($mode === 'webdav') {
return new SolrConfigStore_WebDAV($indexstore);
}
if (ClassInfo::exists($mode) && ClassInfo::classImplements($mode, SolrConfigStore::class)) {
return new $mode($indexstore);
}
user_error('Unknown Solr index mode ' . $indexstore['mode'], E_USER_ERROR);
}
}

View File

@ -3,6 +3,7 @@
namespace SilverStripe\FullTextSearch\Utils\Logging;
use Psr\Log;
use Symbiote\QueuedJobs\Services\QueuedJob;
interface SearchLogFactory
{
@ -10,7 +11,7 @@ interface SearchLogFactory
* Make a logger for a queuedjob
*
* @param QueuedJob $job
* @return Log
* @return Log\LoggerInterface
*/
public function getQueuedJobLogger($job);
@ -19,7 +20,7 @@ interface SearchLogFactory
*
* @param string $name
* @param bool $verbose
* @return Log
* @return Log\LoggerInterface
*/
public function getOutputLogger($name, $verbose);
}