From 71b7c21416752c0aaa7d9f5169d9486899b26b1d Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Tue, 30 Jun 2015 02:12:40 +0100 Subject: [PATCH] resourceloader: Move applyFilter() stats back to filter() Follow-up b88e88b, which converted the count stats to include timing information but incidentally moved the gathering point inside the method, which meant it now also applied to uncached minifications from logged-in user html views (called from one branch higher in the filter method). This should reset the 'resourceloader_cache.minify-js.miss.count' back to normal levels. Change-Id: I7761242f016e9026f5012352ec2f7297c1753f25 --- includes/resourceloader/ResourceLoader.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 3d49d9497e..04b6fec399 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -215,7 +215,12 @@ class ResourceLoader implements LoggerAwareInterface { } $result = ''; try { + $stats = RequestContext::getMain()->getStats(); + $statStart = microtime( true ); + $result = $this->applyFilter( $filter, $data ); + + $stats->timing( "resourceloader_cache.$filter.miss", microtime( true ) - $statStart ); if ( $options['cacheReport'] ) { $result .= "\n/* cache key: $key */"; } @@ -233,22 +238,16 @@ class ResourceLoader implements LoggerAwareInterface { } private function applyFilter( $filter, $data ) { - $stats = RequestContext::getMain()->getStats(); - $statStart = microtime( true ); - switch ( $filter ) { case 'minify-js': - $data = JavaScriptMinifier::minify( $data, + return JavaScriptMinifier::minify( $data, $this->config->get( 'ResourceLoaderMinifierStatementsOnOwnLine' ), $this->config->get( 'ResourceLoaderMinifierMaxLineLength' ) ); - break; case 'minify-css': - $data = CSSMin::minify( $data ); - break; + return CSSMin::minify( $data ); } - $stats->timing( "resourceloader_cache.$filter.miss", microtime( true ) - $statStart ); return $data; } -- 2.20.1