24if ( PHP_SAPI !=
'cli-server' ) {
25 die(
"This script can only be run by php's cli-server sapi." );
28if ( !isset( $_SERVER[
'SCRIPT_FILENAME'] ) ) {
42$file = $_SERVER[
'SCRIPT_FILENAME'];
43if ( !is_readable(
$file ) ) {
57 require_once __DIR__ .
"/../../../includes/libs/mime/MimeMap.php";
62 foreach ( \
Wikimedia\Mime\MimeMap::MIME_EXTENSIONS as
$type => $exts ) {
63 if ( in_array(
$ext, $exts ) ) {
69 if ( preg_match(
'#^text/#',
$mime ) ) {
71 header(
"Content-Type: $mime; charset=UTF-8" );
73 header(
"Content-Type: $mime" );
78 header(
'Vary: Accept-Encoding' );
79 $acceptGzip = preg_match(
'/\bgzip\b/', $_SERVER[
'HTTP_ACCEPT_ENCODING'] ??
'' );
82 preg_match(
'/text|javascript|json|css|xml|svg/',
$mime ) &&
87 header(
'Content-Encoding: gzip' );
89 header(
"Content-Length: " . strlen(
$content ) );
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
if(!is_readable( $file)) $ext