X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FAjaxResponse.php;h=a3808a549672c825191199ec95fc20def530ea2d;hb=1f9ca54b6f3eca77bdf1b4af686f42c5035275ca;hp=334cee37728c074eeb8e0ccbbe934aa1490389b5;hpb=b64bc4e9693ec3e676dadc766f75030d8b11a43b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/AjaxResponse.php b/includes/AjaxResponse.php index 334cee3772..a3808a5496 100644 --- a/includes/AjaxResponse.php +++ b/includes/AjaxResponse.php @@ -28,7 +28,6 @@ * @ingroup Ajax */ class AjaxResponse { - /** * Number of seconds to get the response cached by a proxy * @var int $mCacheDuration @@ -49,7 +48,7 @@ class AjaxResponse { /** * Date for the HTTP header Last-modified - * @var string|false $mLastModified + * @var string|bool $mLastModified */ private $mLastModified; @@ -72,7 +71,7 @@ class AjaxResponse { private $mText; /** - * @param $text string|null + * @param string|null $text */ function __construct( $text = null ) { $this->mCacheDuration = null; @@ -91,7 +90,7 @@ class AjaxResponse { /** * Set the number of seconds to get the response cached by a proxy - * @param $duration int + * @param int $duration */ function setCacheDuration( $duration ) { $this->mCacheDuration = $duration; @@ -99,7 +98,7 @@ class AjaxResponse { /** * Set the HTTP Vary header - * @param $vary string + * @param string $vary */ function setVary( $vary ) { $this->mVary = $vary; @@ -107,7 +106,7 @@ class AjaxResponse { /** * Set the HTTP response code - * @param $code string + * @param string $code */ function setResponseCode( $code ) { $this->mResponseCode = $code; @@ -115,7 +114,7 @@ class AjaxResponse { /** * Set the HTTP header Content-Type - * @param $type string + * @param string $type */ function setContentType( $type ) { $this->mContentType = $type; @@ -130,7 +129,7 @@ class AjaxResponse { /** * Add content to the response - * @param $text string + * @param string $text */ function addText( $text ) { if ( ! $this->mDisabled && $text ) { @@ -184,10 +183,10 @@ class AjaxResponse { } } else { - # Let the client do the caching. Cache is not purged. header ( "Expires: " . gmdate( "D, d M Y H:i:s", time() + $this->mCacheDuration ) . " GMT" ); - header ( "Cache-Control: s-maxage={$this->mCacheDuration},public,max-age={$this->mCacheDuration}" ); + header ( "Cache-Control: s-maxage={$this->mCacheDuration}," . + "public,max-age={$this->mCacheDuration}" ); } } else { @@ -207,7 +206,7 @@ class AjaxResponse { * possible. If successful, the AjaxResponse is disabled so that * any future call to AjaxResponse::printText() have no effect. * - * @param $timestamp string + * @param string $timestamp * @return bool Returns true if the response code was set to 304 Not Modified. */ function checkLastModified( $timestamp ) { @@ -237,17 +236,22 @@ class AjaxResponse { wfDebug( "$fname: -- client send If-Modified-Since: " . $modsince . "\n", 'log' ); wfDebug( "$fname: -- we might send Last-Modified : $lastmod\n", 'log' ); - if ( ( $ismodsince >= $timestamp ) && $wgUser->validateCache( $ismodsince ) && $ismodsince >= $wgCacheEpoch ) { + if ( ( $ismodsince >= $timestamp ) + && $wgUser->validateCache( $ismodsince ) && + $ismodsince >= $wgCacheEpoch + ) { ini_set( 'zlib.output_compression', 0 ); $this->setResponseCode( "304 Not Modified" ); $this->disable(); $this->mLastModified = $lastmod; - wfDebug( "$fname: CACHED client: $ismodsince ; user: {$wgUser->getTouched()} ; page: $timestamp ; site $wgCacheEpoch\n", 'log' ); + wfDebug( "$fname: CACHED client: $ismodsince ; user: {$wgUser->getTouched()} ; " . + "page: $timestamp ; site $wgCacheEpoch\n", 'log' ); return true; } else { - wfDebug( "$fname: READY client: $ismodsince ; user: {$wgUser->getTouched()} ; page: $timestamp ; site $wgCacheEpoch\n", 'log' ); + wfDebug( "$fname: READY client: $ismodsince ; user: {$wgUser->getTouched()} ; " . + "page: $timestamp ; site $wgCacheEpoch\n", 'log' ); $this->mLastModified = $lastmod; } } else { @@ -258,8 +262,8 @@ class AjaxResponse { } /** - * @param $mckey string - * @param $touched int + * @param string $mckey + * @param int $touched * @return bool */ function loadFromMemcached( $mckey, $touched ) { @@ -286,8 +290,8 @@ class AjaxResponse { } /** - * @param $mckey string - * @param $expiry int + * @param string $mckey + * @param int $expiry * @return bool */ function storeInMemcached( $mckey, $expiry = 86400 ) {