Make sure that Predis\MultiExecBlock and Predis\PubSubContext are not initialized over a cluster of connections.

This commit is contained in:
Daniele Alessandri
2010-06-29 20:05:02 +02:00
parent ed105ab4fc
commit 3853e62d34
+10
View File
@@ -828,6 +828,11 @@ class MultiExecBlock {
}
private function checkCapabilities(Client $redisClient) {
if (Shared\Utils::isCluster($redisClient->getConnection())) {
throw new \Predis\ClientException(
'Cannot initialize a MULTI/EXEC context over a cluster of connections'
);
}
$profile = $redisClient->getProfile();
if ($profile->supportsCommands(array('multi', 'exec', 'discard')) === false) {
throw new \Predis\ClientException(
@@ -1008,6 +1013,11 @@ class PubSubContext implements \Iterator {
}
private function checkCapabilities(Client $redisClient) {
if (Shared\Utils::isCluster($redisClient->getConnection())) {
throw new \Predis\ClientException(
'Cannot initialize a PUB/SUB context over a cluster of connections'
);
}
$profile = $redisClient->getProfile();
$commands = array('publish', 'subscribe', 'unsubscribe', 'psubscribe', 'punsubscribe');
if ($profile->supportsCommands($commands) === false) {