mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 12:05:29 +00:00
Merge pull request #230 from Lolly101/phpbin-change
enhancement allow php bin to be configured
This commit is contained in:
commit
7ee362a5c7
@ -4,6 +4,8 @@ namespace SilverStripe\FullTextSearch\Solr\Reindex\Handlers;
|
|||||||
|
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use SilverStripe\Control\Director;
|
use SilverStripe\Control\Director;
|
||||||
|
use SilverStripe\Core\Config\Config;
|
||||||
|
use SilverStripe\Core\Environment;
|
||||||
use SilverStripe\Core\Manifest\ModuleLoader;
|
use SilverStripe\Core\Manifest\ModuleLoader;
|
||||||
use SilverStripe\FullTextSearch\Solr\Solr;
|
use SilverStripe\FullTextSearch\Solr\Solr;
|
||||||
use SilverStripe\FullTextSearch\Solr\SolrIndex;
|
use SilverStripe\FullTextSearch\Solr\SolrIndex;
|
||||||
@ -17,6 +19,14 @@ use Symfony\Component\Process\Process;
|
|||||||
*/
|
*/
|
||||||
class SolrReindexImmediateHandler extends SolrReindexBase
|
class SolrReindexImmediateHandler extends SolrReindexBase
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Path to the php binary
|
||||||
|
* @config
|
||||||
|
* @var null|string
|
||||||
|
*/
|
||||||
|
private static $php_bin = 'php';
|
||||||
|
|
||||||
|
|
||||||
public function triggerReindex(LoggerInterface $logger, $batchSize, $taskName, $classes = null)
|
public function triggerReindex(LoggerInterface $logger, $batchSize, $taskName, $classes = null)
|
||||||
{
|
{
|
||||||
$this->runReindex($logger, $batchSize, $taskName, $classes);
|
$this->runReindex($logger, $batchSize, $taskName, $classes);
|
||||||
@ -74,10 +84,12 @@ class SolrReindexImmediateHandler extends SolrReindexBase
|
|||||||
$indexClassEscaped = addslashes($indexClass);
|
$indexClassEscaped = addslashes($indexClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$php = Environment::getEnv('SS_PHP_BIN') ?: Config::inst()->get(static::class, 'php_bin');
|
||||||
|
|
||||||
// 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}";
|
$scriptTask = "{$php} {$scriptPath} dev/tasks/{$taskName}";
|
||||||
|
|
||||||
$cmd = "{$scriptTask} index={$indexClassEscaped} class={$class} group={$group} groups={$groups} variantstate={$statevar}";
|
$cmd = "{$scriptTask} index={$indexClassEscaped} class={$class} group={$group} groups={$groups} variantstate={$statevar}";
|
||||||
$cmd .= " verbose=1";
|
$cmd .= " verbose=1";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user