Fix missing AMQPConnection errors in setup

Also fixes them elsewhere, apart from having switched to a vendorized version, I also used one that is already namespaced.

The easy way out here is to use it in the namespaced fashion, it is only used in a few places and I know the library well enough to be certain that nothing much changed apart from the namespacing.
This commit is contained in:
Lucas Bickel 2017-03-02 12:37:39 +01:00
parent 7f3f420763
commit 21a319767f
4 changed files with 11 additions and 6 deletions

View file

@ -16,7 +16,7 @@ class Application_Model_RabbitMq
{
$CC_CONFIG = Config::getConfig();
$conn = new AMQPConnection($CC_CONFIG["rabbitmq"]["host"],
$conn = new \PhpAmqpLib\Connection\AMQPConnection($CC_CONFIG["rabbitmq"]["host"],
$CC_CONFIG["rabbitmq"]["port"],
$CC_CONFIG["rabbitmq"]["user"],
$CC_CONFIG["rabbitmq"]["password"],
@ -34,7 +34,7 @@ class Application_Model_RabbitMq
//the way it is just so I don't accidentally break anything when I add the Analyzer code in. -- Albert, March 13, 2014
$channel->exchange_declare($exchange, $exchangeType, false, true, $autoDeleteExchange);
$msg = new AMQPMessage($data, array('content_type' => 'text/plain'));
$msg = new \PhpAmqpLib\Message\AMQPMessage($data, array('content_type' => 'text/plain'));
$channel->basic_publish($msg, $exchange);
$channel->close();
@ -99,7 +99,7 @@ class Application_Model_RabbitMq
$callbackUrl, $apiKey, $storageBackend, $filePrefix)
{
$config = parse_ini_file(self::getRmqConfigPath(), true);
$conn = new AMQPConnection($config["rabbitmq"]["host"],
$conn = new \PhpAmqpLib\Connection\AMQPConnection($config["rabbitmq"]["host"],
$config["rabbitmq"]["port"],
$config["rabbitmq"]["user"],
$config["rabbitmq"]["password"],
@ -138,7 +138,7 @@ class Application_Model_RabbitMq
//the way it is just so I don't accidentally break anything when I add the Analyzer code in. -- Albert, March 13, 2014
$channel->exchange_declare($exchange, $exchangeType, false, true, $autoDeleteExchange);
$msg = new AMQPMessage($jsonData, array('content_type' => 'text/plain'));
$msg = new \PhpAmqpLib\Message\AMQPMessage($jsonData, array('content_type' => 'text/plain'));
$channel->basic_publish($msg, $exchange);
$channel->close();

View file

@ -109,7 +109,7 @@ function checkRMQConnection() {
$ini = parse_ini_file(BUILD_PATH . "airtime.example.conf", true);
}
$conn = new AMQPConnection($ini[RMQ_INI_SECTION]["host"],
$conn = new \PhpAmqpLib\Connection\AMQPConnection($ini[RMQ_INI_SECTION]["host"],
$ini[RMQ_INI_SECTION]["port"],
$ini[RMQ_INI_SECTION]["user"],
$ini[RMQ_INI_SECTION]["password"],

View file

@ -62,7 +62,7 @@ class RabbitMQSetup extends Setup {
}
function checkRMQConnection() {
$conn = new AMQPConnection(self::$_properties["host"],
$conn = new \PhpAmqpLib\Connection\AMQPConnection(self::$_properties["host"],
self::$_properties["port"],
self::$_properties["user"],
self::$_properties["password"],

View file

@ -3,6 +3,11 @@ define("BUILD_PATH", dirname(dirname(__DIR__)) . "/build/");
define("AIRTIME_CONF_TEMP_PATH", "/tmp/airtime.conf.temp");
define("RMQ_INI_TEMP_PATH", "/tmp/rabbitmq.ini.tmp");
// load autoloader since this files is an entry path see
// the end of the file for the "server" that is being
// executed.
require_once __DIR__ . '/../../../vendor/autoload.php';
/**
* Class Setup
*