mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 12:05:29 +00:00
[Backport] Let symfony/process escape each command part separately (#315)
This commit is contained in:
parent
c8e997ae89
commit
0788dc4e81
@ -75,17 +75,12 @@ class SolrReindexImmediateHandler extends SolrReindexBase
|
|||||||
$taskName
|
$taskName
|
||||||
) {
|
) {
|
||||||
$indexClass = get_class($indexInstance);
|
$indexClass = get_class($indexInstance);
|
||||||
|
|
||||||
// Build script parameters
|
|
||||||
$indexClassEscaped = $indexClass;
|
|
||||||
$statevar = json_encode($state);
|
$statevar = json_encode($state);
|
||||||
|
|
||||||
if (strpos(PHP_OS, "WIN") !== false) {
|
if (strpos(PHP_OS, "WIN") !== false) {
|
||||||
$statevar = '"' . str_replace('"', '\\"', $statevar) . '"';
|
$statevar = '"' . str_replace('"', '\\"', $statevar) . '"';
|
||||||
} else {
|
} else {
|
||||||
$statevar = "'" . $statevar . "'";
|
$statevar = "'" . $statevar . "'";
|
||||||
$class = addslashes($class);
|
|
||||||
$indexClassEscaped = addslashes($indexClass);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$php = Environment::getEnv('SS_PHP_BIN') ?: Config::inst()->get(static::class, 'php_bin');
|
$php = Environment::getEnv('SS_PHP_BIN') ?: Config::inst()->get(static::class, 'php_bin');
|
||||||
@ -93,11 +88,12 @@ class SolrReindexImmediateHandler extends SolrReindexBase
|
|||||||
// Build script line
|
// Build script line
|
||||||
$frameworkPath = ModuleLoader::getModule('silverstripe/framework')->getPath();
|
$frameworkPath = ModuleLoader::getModule('silverstripe/framework')->getPath();
|
||||||
$scriptPath = sprintf("%s%scli-script.php", $frameworkPath, DIRECTORY_SEPARATOR);
|
$scriptPath = sprintf("%s%scli-script.php", $frameworkPath, DIRECTORY_SEPARATOR);
|
||||||
$scriptTask = "{$php} {$scriptPath} dev/tasks/{$taskName}";
|
|
||||||
|
|
||||||
$cmd = [
|
$cmd = [
|
||||||
$scriptTask,
|
$php,
|
||||||
"index={$indexClassEscaped}",
|
$scriptPath,
|
||||||
|
"dev/tasks/{$taskName}",
|
||||||
|
"index={$indexClass}",
|
||||||
"class={$class}",
|
"class={$class}",
|
||||||
"group={$group}",
|
"group={$group}",
|
||||||
"groups={$groups}",
|
"groups={$groups}",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user