Merge pull request #203 from creative-commoners/pulls/3.0/reindex-mah-windows

FIX permit reindexing on a Windows machine
This commit is contained in:
Robbie Averill 2018-02-26 10:58:38 +13:00 committed by GitHub
commit 8dc27d5bba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,19 +60,21 @@ class SolrReindexImmediateHandler extends SolrReindexBase
$group,
$taskName
) {
// Build state
$indexClass = get_class($indexInstance);
// Build script parameters
$indexClassEscaped = $indexClass;
$statevar = json_encode($state);
if (strpos(PHP_OS, "WIN") !== false) {
$statevar = '"'.str_replace('"', '\\"', $statevar).'"';
} else {
$statevar = "'".$statevar."'";
$class = addslashes($class);
$indexClassEscaped = addslashes($indexClass);
}
// Build script
$indexName = $indexInstance->getIndexName();
$indexClass = get_class($indexInstance);
$indexClassEscaped = addslashes($indexClass);
$class = addslashes($class);
// Build script line
$frameworkPath = ModuleLoader::getModule('silverstripe/framework')->getPath();
$scriptPath = sprintf("%s%scli-script.php", $frameworkPath, DIRECTORY_SEPARATOR);
$scriptTask = "php {$scriptPath} dev/tasks/{$taskName}";