Merge pull request #4 from ssmarco/compat/4marco

Able to run these tasks successfully, includes Brett's changes
This commit is contained in:
Elliot Sawyer 2017-05-04 21:35:31 +12:00 committed by GitHub
commit c7be39480b
6 changed files with 16 additions and 22 deletions

View File

@ -36,7 +36,7 @@ class SearchIntrospection
public static function hierarchy($class, $includeSubclasses = true, $dataOnly = false)
{
$key = "$class!" . ($includeSubclasses ? 'sc' : 'an') . '!' . ($dataOnly ? 'do' : 'al');
if (!isset(self::$hierarchy[$key])) {
$classes = array_values(ClassInfo::ancestry($class));
if ($includeSubclasses) {
@ -48,14 +48,13 @@ class SearchIntrospection
array_splice($classes, 0, $idx+1);
}
//@todo find another way to determine if a dataobject does not have a table
// if ($dataOnly) {
// foreach ($classes as $i => $class) {
// if (!DataObject::has_own_table($class)) {
// unset($classes[$i]);
// }
// }
// }
if ($dataOnly) {
foreach ($classes as $i => $class) {
if (!DataObject::getSchema()->classHasTable($class)) {
unset($classes[$i]);
}
}
}
self::$hierarchy[$key] = $classes;
}

View File

@ -46,6 +46,11 @@ abstract class SolrIndex extends SearchIndex
protected $templatesPath = null;
private static $casting = [
'FieldDefinitions' => 'HTMLText',
'CopyFieldDefinitions' => 'HTMLText'
];
/**
* List of boosted fields
*

View File

@ -59,6 +59,7 @@ class SolrReindexImmediateHandler extends SolrReindexBase
// Build script
$indexName = $indexInstance->getIndexName();
$indexClass = get_class($indexInstance);
$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}";

View File

@ -25,8 +25,6 @@ class Solr_BuildTask extends BuildTask
*/
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);
}
@ -45,8 +43,6 @@ class Solr_BuildTask extends BuildTask
*/
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);
}

View File

@ -80,8 +80,6 @@ class Solr_Configure extends Solr_BuildTask
return new SolrConfigStore_File($indexstore);
} elseif ($mode == 'webdav') {
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)) {
return new $mode($indexstore);
} else {

View File

@ -44,11 +44,6 @@ class Solr_Reindex extends Solr_BuildTask
*/
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);
}
@ -120,8 +115,8 @@ class Solr_Reindex extends Solr_BuildTask
}
// If run at the top level, delegate to appropriate handler
$self = get_class($this);
$handler->triggerReindex($this->getLogger(), $this->config()->recordsPerRequest, $self, $class);
$taskName = $this->config()->segment ?: get_class($this);
$handler->triggerReindex($this->getLogger(), $this->config()->recordsPerRequest, $taskName, $class);
}
/**