summaryrefslogtreecommitdiff
path: root/includes/SquidPurgeClient.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
committerPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
commitca32f08966f1b51fcb19460f0996bb0c4048e6fe (patch)
treeec04cc15b867bc21eedca904cea9af0254531a11 /includes/SquidPurgeClient.php
parenta22fbfc60f36f5f7ee10d5ae6fe347340c2ee67c (diff)
Update to MediaWiki 1.18.0
* also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing
Diffstat (limited to 'includes/SquidPurgeClient.php')
-rw-r--r--includes/SquidPurgeClient.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/includes/SquidPurgeClient.php b/includes/SquidPurgeClient.php
index 1b315e5f..3de68578 100644
--- a/includes/SquidPurgeClient.php
+++ b/includes/SquidPurgeClient.php
@@ -33,6 +33,8 @@ class SquidPurgeClient {
/**
* Open a socket if there isn't one open already, return it.
* Returns false on error.
+ *
+ * @return false|resource
*/
protected function getSocket() {
if ( $this->socket !== null ) {
@@ -64,6 +66,7 @@ class SquidPurgeClient {
/**
* Get read socket array for select()
+ * @return array
*/
public function getReadSocketsForSelect() {
if ( $this->readState == 'idle' ) {
@@ -78,6 +81,7 @@ class SquidPurgeClient {
/**
* Get write socket array for select()
+ * @return array
*/
public function getWriteSocketsForSelect() {
if ( !strlen( $this->writeBuffer ) ) {
@@ -139,6 +143,8 @@ class SquidPurgeClient {
/**
* Queue a purge operation
+ *
+ * @param $url string
*/
public function queuePurge( $url ) {
$url = str_replace( "\n", '', $url );
@@ -151,6 +157,9 @@ class SquidPurgeClient {
}
}
+ /**
+ * @return bool
+ */
public function isIdle() {
return strlen( $this->writeBuffer ) == 0 && $this->readState == 'idle';
}
@@ -220,6 +229,10 @@ class SquidPurgeClient {
while ( $this->socket && $this->processReadBuffer() === 'continue' );
}
+ /**
+ * @throws MWException
+ * @return string
+ */
protected function processReadBuffer() {
switch ( $this->readState ) {
case 'idle':
@@ -259,6 +272,10 @@ class SquidPurgeClient {
}
}
+ /**
+ * @param $line
+ * @return
+ */
protected function processStatusLine( $line ) {
if ( !preg_match( '!^HTTP/(\d+)\.(\d+) (\d{3}) (.*)$!', $line, $m ) ) {
$this->log( 'invalid status line' );
@@ -275,6 +292,9 @@ class SquidPurgeClient {
$this->readState = 'header';
}
+ /**
+ * @param $line string
+ */
protected function processHeaderLine( $line ) {
if ( preg_match( '/^Content-Length: (\d+)$/i', $line, $m ) ) {
$this->bodyRemaining = intval( $m[1] );
@@ -305,6 +325,10 @@ class SquidPurgeClient {
}
class SquidPurgeClientPool {
+
+ /**
+ * @var array of SquidPurgeClient
+ */
var $clients = array();
var $timeout = 5;
@@ -314,6 +338,10 @@ class SquidPurgeClientPool {
}
}
+ /**
+ * @param $client SquidPurgeClient
+ * @return void
+ */
public function addClient( $client ) {
$this->clients[] = $client;
}