Page MenuHomeWickedGov Phorge

SpecialRecordImpression.php
No OneTemporary

Size
999 B
Referenced Files
None
Subscribers
None

SpecialRecordImpression.php

<?php
use MediaWiki\SpecialPage\UnlistedSpecialPage;
/**
* Null endpoint. This is a workaround to simplify analytics.
*/
class SpecialRecordImpression extends UnlistedSpecialPage {
// Cache this blank response for a day or so (60 * 60 * 24 s.)
public const CACHE_EXPIRY = 86400;
public function __construct() {
// Register special page
parent::__construct( "RecordImpression" );
}
public function execute( $par ) {
$this->getOutput()->disable();
$this->sendHeaders();
// Output nothing else.
}
/**
* Generate the HTTP response headers for the banner file
*/
private function sendHeaders() {
$expiry = static::CACHE_EXPIRY;
header( "Content-Type: image/png" );
// If we have a logged in user; do not cache (default for special pages)
// lest we capture a set-cookie header. Otherwise cache so we don't have
// too big of a DDoS hole.
if ( !$this->getUser()->isRegistered() ) {
header( "Cache-Control: public, s-maxage={$expiry}, max-age=0" );
}
}
}

File Metadata

Mime Type
text/x-php
Expires
Sat, Oct 3, 05:49 (2 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
45/de/587c8e86f00a2324777af5ae565e
Default Alt Text
SpecialRecordImpression.php (999 B)

Event Timeline