feat(legacy): improve rabbitmq check (#1839)
This commit is contained in:
parent
87ab49c8b9
commit
6a65a7f3f1
|
@ -1,7 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('RMQ_INI_SECTION', 'rabbitmq');
|
|
||||||
|
|
||||||
function booleanReduce($a, $b)
|
function booleanReduce($a, $b)
|
||||||
{
|
{
|
||||||
return $a && $b;
|
return $a && $b;
|
||||||
|
@ -102,19 +100,14 @@ function configureDatabase()
|
||||||
*/
|
*/
|
||||||
function checkRMQConnection()
|
function checkRMQConnection()
|
||||||
{
|
{
|
||||||
// Check for installed config file first, then check in the build directory,
|
$config = Config::getConfig();
|
||||||
if (file_exists(LIBRETIME_CONFIG_FILEPATH)) {
|
|
||||||
$ini = parse_ini_file(LIBRETIME_CONFIG_FILEPATH, true);
|
|
||||||
} else {
|
|
||||||
$ini = parse_ini_file(SAMPLE_CONFIG_FILEPATH, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$conn = new \PhpAmqpLib\Connection\AMQPStreamConnection(
|
$conn = new \PhpAmqpLib\Connection\AMQPStreamConnection(
|
||||||
$ini[RMQ_INI_SECTION]['host'],
|
$config['rabbitmq']['host'],
|
||||||
$ini[RMQ_INI_SECTION]['port'],
|
$config['rabbitmq']['port'],
|
||||||
$ini[RMQ_INI_SECTION]['user'],
|
$config['rabbitmq']['user'],
|
||||||
$ini[RMQ_INI_SECTION]['password'],
|
$config['rabbitmq']['password'],
|
||||||
$ini[RMQ_INI_SECTION]['vhost']
|
$config['rabbitmq']['vhost']
|
||||||
);
|
);
|
||||||
|
|
||||||
return isset($conn);
|
return isset($conn);
|
||||||
|
|
Loading…
Reference in New Issue