MediaWiki REL1_31
RedisPubSubFeedEngine.php
Go to the documentation of this file.
1<?php
41
48 public function send( array $feed, $line ) {
49 $parsed = wfParseUrl( $feed['uri'] );
50 $server = $parsed['host'];
51 $options = [ 'serializer' => 'none' ];
52 $channel = 'rc';
53
54 if ( isset( $parsed['port'] ) ) {
55 $server .= ":{$parsed['port']}";
56 }
57 if ( isset( $parsed['query'] ) ) {
58 parse_str( $parsed['query'], $options );
59 }
60 if ( isset( $parsed['pass'] ) ) {
61 $options['password'] = $parsed['pass'];
62 }
63 if ( isset( $parsed['path'] ) ) {
64 $channel = str_replace( '/', '.', ltrim( $parsed['path'], '/' ) );
65 }
67 $conn = $pool->getConnection( $server );
68 if ( $conn !== false ) {
69 $conn->publish( $channel, $line );
70 return true;
71 } else {
72 return false;
73 }
74 }
75}
wfParseUrl( $url)
parse_url() work-alike, but non-broken.
$line
Definition cdb.php:59
Backward-compatibility alias.
static singleton(array $options)
Send recent change notifications via Redis Pub/Sub.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
Definition hooks.txt:2001