From f6d65e533c62f6deb21342d4901ece24497b433e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 4 Jun 2015 07:31:04 +0200 Subject: Update to MediaWiki 1.25.1 --- .../src/Liuggio/StatsdClient/Sender/EchoSender.php | 35 +++++++++ .../StatsdClient/Sender/SenderInterface.php | 32 ++++++++ .../Liuggio/StatsdClient/Sender/SocketSender.php | 88 ++++++++++++++++++++++ .../Liuggio/StatsdClient/Sender/SysLogSender.php | 42 +++++++++++ 4 files changed, 197 insertions(+) create mode 100644 vendor/liuggio/statsd-php-client/src/Liuggio/StatsdClient/Sender/EchoSender.php create mode 100644 vendor/liuggio/statsd-php-client/src/Liuggio/StatsdClient/Sender/SenderInterface.php create mode 100644 vendor/liuggio/statsd-php-client/src/Liuggio/StatsdClient/Sender/SocketSender.php create mode 100644 vendor/liuggio/statsd-php-client/src/Liuggio/StatsdClient/Sender/SysLogSender.php (limited to 'vendor/liuggio/statsd-php-client/src/Liuggio/StatsdClient/Sender') diff --git a/vendor/liuggio/statsd-php-client/src/Liuggio/StatsdClient/Sender/EchoSender.php b/vendor/liuggio/statsd-php-client/src/Liuggio/StatsdClient/Sender/EchoSender.php new file mode 100644 index 00000000..1015ca94 --- /dev/null +++ b/vendor/liuggio/statsd-php-client/src/Liuggio/StatsdClient/Sender/EchoSender.php @@ -0,0 +1,35 @@ +host = $hostname; + $this->port = $port; + + switch ($protocol) { + case 'udp': + $this->protocol = SOL_UDP; + break; + case 'tcp': + $this->protocol = SOL_TCP; + break; + default: + throw new InvalidArgumentException(sprintf('Use udp or tcp as protocol given %s', $protocol)); + break; + } + + } + + /** + * {@inheritDoc} + */ + public function open() + { + $fp = socket_create(AF_INET, SOCK_DGRAM, $this->getProtocol()); + + return $fp; + } + + /** + * {@inheritDoc} + */ + public function write($handle, $message, $length = null) + { + return socket_sendto($handle, $message, strlen($message), 0, $this->getHost(), $this->getPort()); + } + + /** + * {@inheritDoc} + */ + public function close($handle) + { + socket_close($handle); + } + + + protected function setHost($host) + { + $this->host = $host; + } + + protected function getHost() + { + return $this->host; + } + + protected function setPort($port) + { + $this->port = $port; + } + + protected function getPort() + { + return $this->port; + } + + protected function setProtocol($protocol) + { + $this->protocol = $protocol; + } + + protected function getProtocol() + { + return $this->protocol; + } +} diff --git a/vendor/liuggio/statsd-php-client/src/Liuggio/StatsdClient/Sender/SysLogSender.php b/vendor/liuggio/statsd-php-client/src/Liuggio/StatsdClient/Sender/SysLogSender.php new file mode 100644 index 00000000..537ead39 --- /dev/null +++ b/vendor/liuggio/statsd-php-client/src/Liuggio/StatsdClient/Sender/SysLogSender.php @@ -0,0 +1,42 @@ +priority = $priority; + } + + /** + * {@inheritDoc} + */ + public function open() + { + syslog($this->priority, "statsd-client-open"); + + return true; + } + + /** + * {@inheritDoc} + */ + function write($handle, $message, $length = null) + { + syslog($this->priority, sprintf("statsd-client-write \"%s\" %d Bytes", $message, strlen($message))); + + return strlen($message); + } + + /** + * {@inheritDoc} + */ + function close($handle) + { + syslog($this->priority, "statsd-client-close"); + } +} -- cgit v1.2.3-54-g00ecf