mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
find php executable
This commit is contained in:
@@ -157,6 +157,11 @@ class Application
|
||||
$interval = $this->getConfig()->get('daemonInterval');
|
||||
$timeout = $this->getConfig()->get('daemonProcessTimeout');
|
||||
|
||||
$phpExecutablePath = $this->getConfig()->get('phpExecutablePath');
|
||||
if (!$phpExecutablePath) {
|
||||
$phpExecutablePath = (new \Symfony\Component\Process\PhpExecutableFinder)->find();
|
||||
}
|
||||
|
||||
if (!$maxProcessNumber || !$interval) {
|
||||
$GLOBALS['log']->error("Daemon config params are not set.");
|
||||
return;
|
||||
@@ -178,7 +183,7 @@ class Application
|
||||
$toSkip = true;
|
||||
}
|
||||
if (!$toSkip) {
|
||||
$process = new \Symfony\Component\Process\Process(['php', 'cron.php']);
|
||||
$process = new \Symfony\Component\Process\Process([$phpExecutablePath, 'cron.php']);
|
||||
$process->setTimeout($timeout);
|
||||
$process->run();
|
||||
}
|
||||
|
||||
@@ -46,9 +46,12 @@ class Pusher implements WampServerInterface
|
||||
|
||||
protected $connections = [];
|
||||
|
||||
public function __construct(array $categoryList = [], $isDebugMode = false)
|
||||
private $phpExecutablePath;
|
||||
|
||||
public function __construct(array $categoryList = [], $phpExecutablePath = null, $isDebugMode = false)
|
||||
{
|
||||
$this->categoryList = $categoryList;
|
||||
$this->phpExecutablePath = $phpExecutablePath ?: (new \Symfony\Component\Process\PhpExecutableFinder)->find();
|
||||
$this->isDebugMode = $isDebugMode;
|
||||
}
|
||||
|
||||
@@ -157,7 +160,8 @@ class Pusher implements WampServerInterface
|
||||
$authToken = preg_replace('/[^a-zA-Z0-9]+/', '', $params['authToken']);
|
||||
$userId = $params['userId'];
|
||||
|
||||
$result = shell_exec("php auth_token_check.php " . $authToken);
|
||||
$result = $this->getUserIdByAuthToken($authToken);
|
||||
|
||||
if (empty($result)) {
|
||||
$this->closeConnection($connection);
|
||||
return;
|
||||
@@ -171,6 +175,11 @@ class Pusher implements WampServerInterface
|
||||
$this->subscribeUser($connection, $userId);
|
||||
}
|
||||
|
||||
private function getUserIdByAuthToken($authToken)
|
||||
{
|
||||
return shell_exec($this->phpExecutablePath . " auth_token_check.php " . $authToken);
|
||||
}
|
||||
|
||||
protected function closeConnection(ConnectionInterface $connection)
|
||||
{
|
||||
$userId = $this->getUserIdByConnection($connection);
|
||||
|
||||
@@ -115,6 +115,7 @@ return [
|
||||
'recommendedPhpParams',
|
||||
'requiredMariadbVersion',
|
||||
'recommendedMariadbParams',
|
||||
'phpExecutablePath',
|
||||
],
|
||||
'adminItems' => [
|
||||
'devMode',
|
||||
|
||||
@@ -32,10 +32,12 @@ if (substr(php_sapi_name(), 0, 3) != 'cli') die('Cron can be run only via CLI');
|
||||
include "bootstrap.php";
|
||||
|
||||
$app = new \Espo\Core\Application();
|
||||
|
||||
$categoryList = array_keys($app->getContainer()->get('metadata')->get(['app', 'webSocket', 'categories'], []));
|
||||
$phpExecutablePath = $app->getContainer()->get('config')->get('phpExecutablePath');
|
||||
|
||||
$loop = \React\EventLoop\Factory::create();
|
||||
$pusher = new \Espo\Core\WebSocket\Pusher($categoryList);
|
||||
$pusher = new \Espo\Core\WebSocket\Pusher($categoryList, $phpExecutablePath);
|
||||
|
||||
$context = new \React\ZMQ\Context($loop);
|
||||
$pull = $context->getSocket(\ZMQ::SOCKET_PULL);
|
||||
|
||||
Reference in New Issue
Block a user