summaryrefslogtreecommitdiff
path: root/includes/SquidPurgeClient.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2014-12-27 15:41:37 +0100
committerPierre Schmitz <pierre@archlinux.de>2014-12-31 11:43:28 +0100
commitc1f9b1f7b1b77776192048005dcc66dcf3df2bfb (patch)
tree2b38796e738dd74cb42ecd9bfd151803108386bc /includes/SquidPurgeClient.php
parentb88ab0086858470dd1f644e64cb4e4f62bb2be9b (diff)
Update to MediaWiki 1.24.1
Diffstat (limited to 'includes/SquidPurgeClient.php')
-rw-r--r--includes/SquidPurgeClient.php65
1 files changed, 41 insertions, 24 deletions
diff --git a/includes/SquidPurgeClient.php b/includes/SquidPurgeClient.php
index f5fd1950..824dd06b 100644
--- a/includes/SquidPurgeClient.php
+++ b/includes/SquidPurgeClient.php
@@ -28,12 +28,26 @@
* Could be replaced by curl_multi_exec() or some such.
*/
class SquidPurgeClient {
- var $host, $port, $ip;
+ /** @var string */
+ protected $host;
- var $readState = 'idle';
- var $writeBuffer = '';
- var $requests = array();
- var $currentRequestIndex;
+ /** @var int */
+ protected $port;
+
+ /** @var string|bool */
+ protected $ip;
+
+ /** @var string */
+ protected $readState = 'idle';
+
+ /** @var string */
+ protected $writeBuffer = '';
+
+ /** @var array */
+ protected $requests = array();
+
+ /** @var mixed */
+ protected $currentRequestIndex;
const EINTR = 4;
const EAGAIN = 11;
@@ -41,17 +55,20 @@ class SquidPurgeClient {
const BUFFER_SIZE = 8192;
/**
- * The socket resource, or null for unconnected, or false for disabled due to error
+ * @var resource|null The socket resource, or null for unconnected, or false
+ * for disabled due to error.
*/
- var $socket;
+ protected $socket;
- var $readBuffer;
+ /** @var string */
+ protected $readBuffer;
- var $bodyRemaining;
+ /** @var int */
+ protected $bodyRemaining;
/**
- * @param $server string
- * @param $options array
+ * @param string $server
+ * @param array $options
*/
public function __construct( $server, $options = array() ) {
$parts = explode( ':', $server, 2 );
@@ -126,6 +143,8 @@ class SquidPurgeClient {
/**
* Get the host's IP address.
* Does not support IPv6 at present due to the lack of a convenient interface in PHP.
+ * @throws MWException
+ * @return string
*/
protected function getIP() {
if ( $this->ip === null ) {
@@ -173,7 +192,7 @@ class SquidPurgeClient {
/**
* Queue a purge operation
*
- * @param $url string
+ * @param string $url
*/
public function queuePurge( $url ) {
global $wgSquidPurgeUseHostHeader;
@@ -323,8 +342,7 @@ class SquidPurgeClient {
}
/**
- * @param $line
- * @return
+ * @param string $line
*/
protected function processStatusLine( $line ) {
if ( !preg_match( '!^HTTP/(\d+)\.(\d+) (\d{3}) (.*)$!', $line, $m ) ) {
@@ -343,7 +361,7 @@ class SquidPurgeClient {
}
/**
- * @param $line string
+ * @param string $line
*/
protected function processHeaderLine( $line ) {
if ( preg_match( '/^Content-Length: (\d+)$/i', $line, $m ) ) {
@@ -370,23 +388,22 @@ class SquidPurgeClient {
}
/**
- * @param $msg string
+ * @param string $msg
*/
protected function log( $msg ) {
- wfDebugLog( 'squid', __CLASS__ . " ($this->host): $msg\n" );
+ wfDebugLog( 'squid', __CLASS__ . " ($this->host): $msg" );
}
}
class SquidPurgeClientPool {
+ /** @var array Array of SquidPurgeClient */
+ protected $clients = array();
- /**
- * @var array of SquidPurgeClient
- */
- var $clients = array();
- var $timeout = 5;
+ /** @var int */
+ protected $timeout = 5;
/**
- * @param $options array
+ * @param array $options
*/
function __construct( $options = array() ) {
if ( isset( $options['timeout'] ) ) {
@@ -395,7 +412,7 @@ class SquidPurgeClientPool {
}
/**
- * @param $client SquidPurgeClient
+ * @param SquidPurgeClient $client
* @return void
*/
public function addClient( $client ) {