X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Frcfeed%2FRedisPubSubFeedEngine.php;h=b9023b6b8422ad97415f7f1d953bffda186e76c1;hb=5fdf0e48ffc530c6650cd4dd8abadc4d70566e78;hp=4bcc13375b54b41815a1da450208bc96f3581683;hpb=51f2a693af7523bc055e31e4c1b3ddd766a3e9de;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/rcfeed/RedisPubSubFeedEngine.php b/includes/rcfeed/RedisPubSubFeedEngine.php index 4bcc13375b..b9023b6b84 100644 --- a/includes/rcfeed/RedisPubSubFeedEngine.php +++ b/includes/rcfeed/RedisPubSubFeedEngine.php @@ -1,23 +1,48 @@ 'JSONRCFeedFormatter', + * 'uri' => "redis://127.0.0.1:6379/rc.$wgDBname", + * ); + * + * @since 1.22 + */ class RedisPubSubFeedEngine implements RCFeedEngine { + /** - * Emit a recent change notification via Redis Pub/Sub - * - * If the feed URI contains a path component, it will be used to generate a - * channel name by stripping the leading slash and replacing any remaining - * slashes with '.'. If no path component is present, the channel is set to - * 'rc'. If the URI contains a query string, its parameters will be parsed - * as RedisConnectionPool options. - * - * @example $wgRCFeeds['redis'] = array( - * 'formatter' => 'JSONRCFeedFormatter', - * 'uri' => "redis://127.0.0.1:6379/rc.$wgDBname", - * ); - * - * @since 1.22 + * @see RCFeedEngine::send */ public function send( array $feed, $line ) { - $parsed = parse_url( $feed['uri'] ); + $parsed = wfParseUrl( $feed['uri'] ); $server = $parsed['host']; $options = array( 'serializer' => 'none' ); $channel = 'rc'; @@ -36,6 +61,11 @@ class RedisPubSubFeedEngine implements RCFeedEngine { } $pool = RedisConnectionPool::singleton( $options ); $conn = $pool->getConnection( $server ); - $conn->publish( $channel, $line ); + if ( $conn !== false ) { + $conn->publish( $channel, $line ); + return true; + } else { + return false; + } } }