* @ingroup Ajax
*/
class AjaxResponse {
-
/**
* Number of seconds to get the response cached by a proxy
* @var int $mCacheDuration
/**
* Date for the HTTP header Last-modified
- * @var string|false $mLastModified
+ * @var string|bool $mLastModified
*/
private $mLastModified;
private $mText;
/**
- * @param $text string|null
+ * @param string|null $text
*/
function __construct( $text = null ) {
$this->mCacheDuration = null;
/**
* 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;
/**
* Set the HTTP Vary header
- * @param $vary string
+ * @param string $vary
*/
function setVary( $vary ) {
$this->mVary = $vary;
/**
* Set the HTTP response code
- * @param $code string
+ * @param string $code
*/
function setResponseCode( $code ) {
$this->mResponseCode = $code;
/**
* Set the HTTP header Content-Type
- * @param $type string
+ * @param string $type
*/
function setContentType( $type ) {
$this->mContentType = $type;
/**
* Add content to the response
- * @param $text string
+ * @param string $text
*/
function addText( $text ) {
if ( ! $this->mDisabled && $text ) {
}
} 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 {
* 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 ) {
$fname = 'AjaxResponse::checkLastModified';
if ( !$timestamp || $timestamp == '19700101000000' ) {
- wfDebug( "$fname: CACHE DISABLED, NO TIMESTAMP\n" );
+ wfDebug( "$fname: CACHE DISABLED, NO TIMESTAMP\n", 'log' );
return false;
}
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 {
}
/**
- * @param $mckey string
- * @param $touched int
+ * @param string $mckey
+ * @param int $touched
* @return bool
*/
function loadFromMemcached( $mckey, $touched ) {
}
/**
- * @param $mckey string
- * @param $expiry int
+ * @param string $mckey
+ * @param int $expiry
* @return bool
*/
function storeInMemcached( $mckey, $expiry = 86400 ) {