Merge pull request #3 from ssmarco/compat/4marco
Able to run configure and reindex
This commit is contained in:
commit
eb0740f522
|
@ -36,7 +36,7 @@ class SearchIntrospection
|
||||||
public static function hierarchy($class, $includeSubclasses = true, $dataOnly = false)
|
public static function hierarchy($class, $includeSubclasses = true, $dataOnly = false)
|
||||||
{
|
{
|
||||||
$key = "$class!" . ($includeSubclasses ? 'sc' : 'an') . '!' . ($dataOnly ? 'do' : 'al');
|
$key = "$class!" . ($includeSubclasses ? 'sc' : 'an') . '!' . ($dataOnly ? 'do' : 'al');
|
||||||
|
|
||||||
if (!isset(self::$hierarchy[$key])) {
|
if (!isset(self::$hierarchy[$key])) {
|
||||||
$classes = array_values(ClassInfo::ancestry($class));
|
$classes = array_values(ClassInfo::ancestry($class));
|
||||||
if ($includeSubclasses) {
|
if ($includeSubclasses) {
|
||||||
|
@ -48,14 +48,13 @@ class SearchIntrospection
|
||||||
array_splice($classes, 0, $idx+1);
|
array_splice($classes, 0, $idx+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//@todo find another way to determine if a dataobject does not have a table
|
if ($dataOnly) {
|
||||||
// if ($dataOnly) {
|
foreach ($classes as $i => $class) {
|
||||||
// foreach ($classes as $i => $class) {
|
if (!DataObject::getSchema()->classHasTable($class)) {
|
||||||
// if (!DataObject::has_own_table($class)) {
|
unset($classes[$i]);
|
||||||
// unset($classes[$i]);
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
self::$hierarchy[$key] = $classes;
|
self::$hierarchy[$key] = $classes;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,11 @@ abstract class SolrIndex extends SearchIndex
|
||||||
|
|
||||||
protected $templatesPath = null;
|
protected $templatesPath = null;
|
||||||
|
|
||||||
|
private static $casting = [
|
||||||
|
'FieldDefinitions' => 'HTMLText',
|
||||||
|
'CopyFieldDefinitions' => 'HTMLText'
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of boosted fields
|
* List of boosted fields
|
||||||
*
|
*
|
||||||
|
|
|
@ -59,6 +59,7 @@ class SolrReindexImmediateHandler extends SolrReindexBase
|
||||||
// Build script
|
// Build script
|
||||||
$indexName = $indexInstance->getIndexName();
|
$indexName = $indexInstance->getIndexName();
|
||||||
$indexClass = get_class($indexInstance);
|
$indexClass = get_class($indexInstance);
|
||||||
|
$class = addslashes($class);
|
||||||
$scriptPath = sprintf("%s%sframework%scli-script.php", BASE_PATH, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR);
|
$scriptPath = sprintf("%s%sframework%scli-script.php", BASE_PATH, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR);
|
||||||
$scriptTask = "php {$scriptPath} dev/tasks/{$taskName}";
|
$scriptTask = "php {$scriptPath} dev/tasks/{$taskName}";
|
||||||
$cmd = "{$scriptTask} index={$indexClass} class={$class} group={$group} groups={$groups} variantstate={$statevar}";
|
$cmd = "{$scriptTask} index={$indexClass} class={$class} group={$group} groups={$groups} variantstate={$statevar}";
|
||||||
|
|
|
@ -25,8 +25,6 @@ class Solr_BuildTask extends BuildTask
|
||||||
*/
|
*/
|
||||||
public function getLogger()
|
public function getLogger()
|
||||||
{
|
{
|
||||||
//@todo left commented after a confusing merge conflict. Revisit if further testing is required
|
|
||||||
//return Injector::inst()->get('Logger');
|
|
||||||
return Injector::inst()->get(LoggerInterface::class);
|
return Injector::inst()->get(LoggerInterface::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,8 +43,6 @@ class Solr_BuildTask extends BuildTask
|
||||||
*/
|
*/
|
||||||
protected function getLoggerFactory()
|
protected function getLoggerFactory()
|
||||||
{
|
{
|
||||||
//@todo left commented after a confusing merge conflict. Revisit if further testing is required
|
|
||||||
//return Injector::inst()->get('SearchLogFactory');
|
|
||||||
return Injector::inst()->get(SearchLogFactory::class);
|
return Injector::inst()->get(SearchLogFactory::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,8 +80,6 @@ class Solr_Configure extends Solr_BuildTask
|
||||||
return new SolrConfigStore_File($indexstore);
|
return new SolrConfigStore_File($indexstore);
|
||||||
} elseif ($mode == 'webdav') {
|
} elseif ($mode == 'webdav') {
|
||||||
return new SolrConfigStore_WebDAV($indexstore);
|
return new SolrConfigStore_WebDAV($indexstore);
|
||||||
//@todo left commented after confusing merge conflict. Revisit if further testing is required
|
|
||||||
//} elseif (ClassInfo::exists($mode) && ClassInfo::classImplements($mode, 'SolrConfigStore')) {
|
|
||||||
} elseif (ClassInfo::exists($mode) && ClassInfo::classImplements($mode, SolrConfigStore::class)) {
|
} elseif (ClassInfo::exists($mode) && ClassInfo::classImplements($mode, SolrConfigStore::class)) {
|
||||||
return new $mode($indexstore);
|
return new $mode($indexstore);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -44,11 +44,6 @@ class Solr_Reindex extends Solr_BuildTask
|
||||||
*/
|
*/
|
||||||
protected function getHandler()
|
protected function getHandler()
|
||||||
{
|
{
|
||||||
|
|
||||||
//@todo: this needs to determine the best class from a Factory implementation
|
|
||||||
//@todo: it was 'SolrReindexHandler' but that doesn't work on 4.0
|
|
||||||
//@todo left commented after a confusing merge conflict. Revisit if further investigation /testing is needed
|
|
||||||
//return Injector::inst()->get('SolrReindexImmediateHandler');
|
|
||||||
return Injector::inst()->get(SolrReindexHandler::class);
|
return Injector::inst()->get(SolrReindexHandler::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,8 +115,8 @@ class Solr_Reindex extends Solr_BuildTask
|
||||||
}
|
}
|
||||||
|
|
||||||
// If run at the top level, delegate to appropriate handler
|
// If run at the top level, delegate to appropriate handler
|
||||||
$self = get_class($this);
|
$taskName = $this->config()->segment ?: get_class($this);
|
||||||
$handler->triggerReindex($this->getLogger(), $this->config()->recordsPerRequest, $self, $class);
|
$handler->triggerReindex($this->getLogger(), $this->config()->recordsPerRequest, $taskName, $class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue