Working on administration-related php exercise
which apparently does not work *at all* when the user/pass combo is wrong or has characters that explode or whatever.
This commit is contained in:
parent
74bd6aeaf0
commit
52a7c23bb1
1
sylvilagus/php/.gitignore
vendored
Normal file
1
sylvilagus/php/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/php-amqplib/
|
32
sylvilagus/php/rabbitmqctl-examples.php
Normal file
32
sylvilagus/php/rabbitmqctl-examples.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
define('AMQP_DEBUG', true);
|
||||
require_once(__DIR__ . '/php-amqplib/vendor/autoload.php');
|
||||
|
||||
use PhpAmqpLib\Connection\AMQPConnection;
|
||||
use PhpAmqpLib\Message\AMQPMessage;
|
||||
|
||||
$uri = parse_url(getenv('SYLVILAGUS_AMQP_URI'));
|
||||
|
||||
$conn = new AMQPConnection(
|
||||
$uri['host'],
|
||||
$uri['port'],
|
||||
$uri['user'],
|
||||
$uri['pass'],
|
||||
$uri['path']
|
||||
);
|
||||
$channel = $conn->channel();
|
||||
|
||||
$channel->exchange_declare('logs-exchange', 'topic', false, true, false);
|
||||
|
||||
$channel->queue_declare('msg-inbox-errors', false, true, false, false);
|
||||
|
||||
$channel->queue_declare('msg-inbox-logs', false, true, false, false);
|
||||
|
||||
$channel->queue_declare('all-logs', false, true, false, false);
|
||||
|
||||
$channel->queue_bind('msg-inbox-errors', 'logs-exchange', 'error.msg-inbox');
|
||||
|
||||
$channel->queue_bind('msg-inbox-logs', 'logs-exchange', '*.msg-inbox');
|
||||
|
||||
?>
|
19
sylvilagus/php/setup
Executable file
19
sylvilagus/php/setup
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -x
|
||||
|
||||
if [ ! -d php-amqplib/.git ] ; then
|
||||
git clone git://github.com/videlalvaro/php-amqplib.git
|
||||
else
|
||||
pushd php-amqplib
|
||||
git fetch
|
||||
get reset --hard origin/master
|
||||
popd
|
||||
fi
|
||||
|
||||
pushd php-amqplib
|
||||
if [ ! -f composer.phar ] ; then
|
||||
curl -s https://getcomposer.org/installer | php
|
||||
fi
|
||||
php composer.phar install
|
||||
popd
|
Loading…
Reference in New Issue
Block a user