Fix some coding standard violations in the StaticController

This commit is contained in:
Eric Lippmann 2015-08-27 14:15:32 +02:00
parent 22b628c084
commit a8e6daa678

View File

@ -79,10 +79,7 @@ class StaticController extends Controller
header(sprintf('ETag: "%x-%x-%x"', $s['ino'], $s['size'], (float) str_pad($s['mtime'], 16, '0'))); header(sprintf('ETag: "%x-%x-%x"', $s['ino'], $s['size'], (float) str_pad($s['mtime'], 16, '0')));
header('Cache-Control: public, max-age=3600'); header('Cache-Control: public, max-age=3600');
header('Pragma: cache'); header('Pragma: cache');
header('Last-Modified: ' . gmdate( header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $s['mtime']) . ' GMT');
'D, d M Y H:i:s',
$s['mtime']
) . ' GMT');
readfile($filePath); readfile($filePath);
} }
@ -99,7 +96,7 @@ class StaticController extends Controller
$basedir = Icinga::app()->getApplicationDir('../public/js/icinga/components/'); $basedir = Icinga::app()->getApplicationDir('../public/js/icinga/components/');
$filePath = $basedir . $file; $filePath = $basedir . $file;
} else { } else {
if (!Icinga::app()->getModuleManager()->hasEnabled($module)) { if (! Icinga::app()->getModuleManager()->hasEnabled($module)) {
Logger::error( Logger::error(
'Non-existing frontend component "' . $module . '/' . $file 'Non-existing frontend component "' . $module . '/' . $file
. '" was requested. The module "' . $module . '" does not exist or is not active.' . '" was requested. The module "' . $module . '" does not exist or is not active.'
@ -111,7 +108,7 @@ class StaticController extends Controller
$filePath = $basedir . '/public/js/' . $file; $filePath = $basedir . '/public/js/' . $file;
} }
if (!file_exists($filePath)) { if (! file_exists($filePath)) {
Logger::error( Logger::error(
'Non-existing frontend component "' . $module . '/' . $file 'Non-existing frontend component "' . $module . '/' . $file
. '" was requested, which would resolve to the the path: ' . $filePath . '" was requested, which would resolve to the the path: ' . $filePath
@ -125,10 +122,7 @@ class StaticController extends Controller
$response->setHeader( $response->setHeader(
'Last-Modified', 'Last-Modified',
gmdate( gmdate('D, d M Y H:i:s', filemtime($filePath)) . ' GMT'
'D, d M Y H:i:s',
filemtime($filePath)
) . ' GMT'
); );
readfile($filePath); readfile($filePath);
@ -174,7 +168,7 @@ class StaticController extends Controller
} }
} }
$this->_response->setHeader('Content-Type', 'text/css'); $this->getResponse()->setHeader('Content-Type', 'text/css');
$this->setCacheHeader(3600); $this->setCacheHeader(3600);
$lessCompiler->printStack(); $lessCompiler->printStack();