Giter Site home page Giter Site logo

Comments (4)

michalkleiner avatar michalkleiner commented on July 18, 2024 1

Thanks for looking into it further, @GuySartorelli. I'm under the impression you did what you could and I would say that's more than enough here. You're doing great work lately, keep it up!

from silverstripe-fulltextsearch.

GuySartorelli avatar GuySartorelli commented on July 18, 2024

In SolrReindexImmediateHandler.php line 116, if I replace $process->run(); with $process->mustRun(); exposes the following error:

The command "'php /home/webspace/ss4-scratch/site/vendor/silverstripe/framework/cli-script.php dev/tasks/Solr_Reindex' 'index=App\\Search\\SolrIndex' 'class=SilverStripe\\CMS\\Model\\SiteTree' 'group=0' 'groups=7' 'variantstate='''{"SilverStripe\\FullTextSearch\\Search\\Variants\\SearchVariantVersioned":"Live"}'''' 'verbose=1'" failed. Exit Code: 127(Command not found) Working directory: /home/webspace/ss4-scratch/site/public Output: ================ Error Output: ================ sh: 1: exec: php /home/webspace/ss4-scratch/site/vendor/silverstripe/framework/cli-script.php dev/tasks/Solr_Reindex: not found

I think this is caused by retaining this line:

$scriptTask = "{$php} {$scriptPath} dev/tasks/{$taskName}";

as a single string instead of including each component as a distinct value in the $cmd array
$cmd = [
$scriptTask,
"index={$indexClassEscaped}",
"class={$class}",
"group={$group}",
"groups={$groups}",
"variantstate={$statevar}",
"verbose=1"
];

Making that change results in this error:

Class App\\Search\\SolrIndex does not exist in /home/webspace/ss4-scratch/site/vendor/silverstripe/framework/src/Core/Injector/InjectionCreator.php:17

And after not escaping the backslashes in the index class name we get:

SilverStripe\\CMS\\Model\\SiteTree is not a subclass of DataObject

Finally, when we don't escape the backslashes in that class name either, we get the reindex working correctly.

I'll raise a PR for this momentarily, but putting this sequence here in case anyone wonders why the PR removes the backslash escaping.

from silverstripe-fulltextsearch.

michalkleiner avatar michalkleiner commented on July 18, 2024

Thanks for troubleshooting this!

Do you know/have you found what changed that this stopped working?

from silverstripe-fulltextsearch.

GuySartorelli avatar GuySartorelli commented on July 18, 2024

@michalkleiner In 3.9.0 a change was made to allow symfony/process ^4, and part of the change included changing the command from being passed as a string to being passed as an array (see #301). Passing the string worked fine (with process 3.x) but it seems (and this is just based on the error output I was seeing) like there is some step if the command is passed as an array to confirm that the first item in the array is a valid executable.

Edit: Okay so there's nothing done to it prior to being executed... I can't really make heads of exactly why it ends up failing the way it does (the full array is ultimately imploded and the resultant string, with some alterations, is passed to proc_open)...

So I can't say why it's failing the way it is, just that it is and it didn't used to when it was passed as a string - and that splitting out that first array element into three distinct elements resolves it.

The escaping does make sense though, as both process 3 and 4 use implode(' ', array_map([$this, 'escapeArgument'], $commandline)); when imploding the command array, so we had been unintentionally double escaping the class names.

from silverstripe-fulltextsearch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.