Commit 835ec8ff authored by Dominik Hebeler's avatar Dominik Hebeler

Merge branch '1005-optimize-timings' into 'development'

Resolve "Optimize timings"

Closes #1005

See merge request !1666
parents 85b514b3 72ce4e84
......@@ -143,7 +143,13 @@ class MetaGerSearch extends Controller
$counter = $registry->getOrRegisterCounter('metager', 'query_counter', 'counts total number of search queries', []);
$counter->inc();
return $resultpage;
// Splitting the response return into multiple parts.
// This might speed up page view time for users with slow network
$responseArray = str_split($resultpage->render(), 1024);
foreach ($responseArray as $responsePart) {
echo ($responsePart);
flush();
}
}
public function searchTimings(Request $request, MetaGer $metager)
......
......@@ -16,6 +16,11 @@ class BrowserVerification
*/
public function handle($request, Closure $next)
{
ini_set('zlib.output_compression', 'Off');
ini_set('output_buffering', 'Off');
ini_set('output_handler', '');
ob_end_clean();
$bvEnabled = config("metager.metager.browserverification_enabled");
if (empty($bvEnabled) || !$bvEnabled) {
return $next($request);
......@@ -37,11 +42,6 @@ class BrowserVerification
header('Content-type: text/html; charset=utf-8');
header('X-Accel-Buffering: no');
ini_set('zlib.output_compression', 'Off');
ini_set('output_buffering', 'Off');
ini_set('output_handler', '');
ob_end_clean();
$key = md5($request->ip() . microtime(true));
......@@ -51,6 +51,9 @@ class BrowserVerification
$answer = boolval(Redis::connection("cache")->blpop($key, 2));
if ($answer === true) {
echo (view('layouts.resultpage.resources')->render());
flush();
$request->request->add(["headerPrinted" => true]);
return $next($request);
}
......
......@@ -899,7 +899,6 @@ class MetaGer
public function parseFormData(Request $request)
{
# Sichert, dass der request in UTF-8 formatiert ist
if ($request->input('encoding', 'utf8') !== "utf8") {
# In früheren Versionen, als es den Encoding Parameter noch nicht gab, wurden die Daten in ISO-8859-1 übertragen
......@@ -909,6 +908,8 @@ class MetaGer
}
$request->replace($input);
}
$this->headerPrinted = $request->input("headerPrinted", false);
$request->request->remove("headerPrinted");
$this->url = $request->url();
$this->fullUrl = $request->fullUrl();
# Zunächst überprüfen wir die eingegebenen Einstellungen:
......@@ -1827,6 +1828,11 @@ class MetaGer
return $this->framed;
}
public function isHeaderPrinted()
{
return $this->headerPrinted;
}
/**
* Used by JS result loader to restore MetaGer Object of previous request
*/
......
@if(empty(config("metager.metager.browserverification_enabled")) || !config("metager.metager.browserverification_enabled"))
@if(!$metager->isHeaderPrinted())
<!DOCTYPE html>
<html lang="{!! trans('staticPages.meta.language') !!}">
<head>
<meta charset="utf-8">
@endif
<title>{{ $eingabe }} - MetaGer</title>
<link href="/favicon.ico" rel="icon" type="image/x-icon" />
<link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<link rel="apple-touch-icon" href="/img/apple/touch-icon.png">
......@@ -16,6 +14,14 @@
<link rel="apple-touch-icon" sizes="144x144" href="/img/apple/touch-icon-144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/img/apple/touch-icon-152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple/touch-icon-180.png">
<link rel="search" type="application/opensearchdescription+xml" title="{!! trans('resultPage.opensearch') !!}" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), action('StartpageController@loadPlugin')) }}">
<link href="/fonts/liberationsans/stylesheet.css" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="{{ mix('css/fontawesome.css') }}" />
<link type="text/css" rel="stylesheet" href="{{ mix('css/fontawesome-solid.css') }}" />
<link type="text/css" rel="stylesheet alternate" href="{{ mix('css/themes/metager-dark.css') }}" title="MetaGer Dark"/>
<link type="text/css" rel="stylesheet" href="{{ mix('css/themes/metager.css') }}" title="MetaGer"/>
@endif
<title>{{ $eingabe }} - MetaGer</title>
<meta content="width=device-width, initial-scale=1.0, user-scalable=no" name="viewport" />
<meta name="p" content="{{ getmypid() }}" />
<meta name="q" content="{{ $eingabe }}" />
......@@ -23,12 +29,6 @@
<meta name="mm" content="{{ $metager->getVerificationId() }}" />
<meta name="mn" content="{{ $metager->getVerificationCount() }}" />
<meta name="searchkey" content="{{ $metager->getSearchUid() }}" />
<link rel="search" type="application/opensearchdescription+xml" title="{!! trans('resultPage.opensearch') !!}" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), action('StartpageController@loadPlugin')) }}">
<link href="/fonts/liberationsans/stylesheet.css" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="{{ mix('css/fontawesome.css') }}" />
<link type="text/css" rel="stylesheet" href="{{ mix('css/fontawesome-solid.css') }}" />
<link type="text/css" rel="stylesheet alternate" href="{{ mix('css/themes/metager-dark.css') }}" title="MetaGer Dark"/>
<link type="text/css" rel="stylesheet" href="{{ mix('css/themes/metager.css') }}" title="MetaGer"/>
<meta name="referrer" content="origin">
<meta name="age-meta-label" content="age=18"/>
@include('parts.utility')
......
<link href="/favicon.ico" rel="icon" type="image/x-icon" />
<link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<link rel="apple-touch-icon" href="/img/apple/touch-icon.png">
<link rel="apple-touch-icon" sizes="57x57" href="/img/apple/touch-icon-57.png">
<link rel="apple-touch-icon" sizes="72x72" href="/img/apple/touch-icon-72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/img/apple/touch-icon-76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/img/apple/touch-icon-114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/img/apple/touch-icon-120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/img/apple/touch-icon-144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/img/apple/touch-icon-152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple/touch-icon-180.png">
<link rel="search" type="application/opensearchdescription+xml" title="{!! trans('resultPage.opensearch') !!}" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), action('StartpageController@loadPlugin')) }}">
<link href="/fonts/liberationsans/stylesheet.css" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="{{ mix('css/fontawesome.css') }}" />
<link type="text/css" rel="stylesheet" href="{{ mix('css/fontawesome-solid.css') }}" />
<link type="text/css" rel="stylesheet alternate" href="{{ mix('css/themes/metager-dark.css') }}" title="MetaGer Dark"/>
<link type="text/css" rel="stylesheet" href="{{ mix('css/themes/metager.css') }}" title="MetaGer"/>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment