fixes to allow namespacing in index class

This commit is contained in:
elliot sawyer 2017-05-19 11:23:12 +12:00
parent 3fe285aaf1
commit d7805f46ab
3 changed files with 6 additions and 2 deletions

View File

@ -59,10 +59,12 @@ class SolrReindexImmediateHandler extends SolrReindexBase
// Build script
$indexName = $indexInstance->getIndexName();
$indexClass = get_class($indexInstance);
$indexClassEscaped = addslashes($indexClass);
$class = addslashes($class);
$scriptPath = sprintf("%s%sframework%scli-script.php", BASE_PATH, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR);
$scriptTask = "php {$scriptPath} dev/tasks/{$taskName}";
$cmd = "{$scriptTask} index={$indexClass} class={$class} group={$group} groups={$groups} variantstate={$statevar}";
$cmd = "{$scriptTask} index={$indexClassEscaped} class={$class} group={$group} groups={$groups} variantstate={$statevar}";
$cmd .= " verbose=1 2>&1";
$logger->info("Running '$cmd'");

View File

@ -84,6 +84,7 @@ class SolrService extends SolrService_Core
public function serviceForCore($core)
{
$klass = Config::inst()->get(get_called_class(), 'core_class');
return new $klass($this->_host, $this->_port, $this->_path.$core, $this->_httpTransport);
$coreName = ClassInfo::shortName($core);
return new $klass($this->_host, $this->_port, $this->_path . $coreName, $this->_httpTransport);
}
}

View File

@ -3,6 +3,7 @@ namespace SilverStripe\FullTextSearch\Solr\Tasks;
use ReflectionClass;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\Debug;
use SilverStripe\FullTextSearch\Search\Variants\SearchVariant;
use SilverStripe\ORM\DataList;
use SilverStripe\FullTextSearch\Solr\Reindex\Handlers\SolrReindexHandler;