1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-22 16:33:00 +00:00

Add search time header for analysis purposes

This commit is contained in:
Starbeamrainbowlabs 2018-06-26 00:11:01 +01:00
parent 75b6b6c55f
commit 67648199d7
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
3 changed files with 10 additions and 6 deletions

View file

@ -397,7 +397,7 @@ if($settings->sessionprefix == "auto")
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/** The version of Pepperminty Wiki currently running. */ /** The version of Pepperminty Wiki currently running. */
$version = "v0.17-dev"; $version = "v0.17-dev";
$commit = "93494b672938d2fb456138e03db5be3803bc51b7"; $commit = "75b6b6c55fa9710d82b6623971581db7c6c5309b";
/// Environment /// /// Environment ///
/** Holds information about the current request environment. */ /** Holds information about the current request environment. */
$env = new stdClass(); $env = new stdClass();
@ -3789,6 +3789,10 @@ register_module([
); );
} }
$env->perfdata->search_time = round((microtime(true) - $search_start)*1000, 3);
header("x-search-time: {$env->perfdata->search_time}ms");
if(!empty($_GET["format"]) && $_GET["format"] == "json") { if(!empty($_GET["format"]) && $_GET["format"] == "json") {
header("content-type: application/json"); header("content-type: application/json");
$json_results = new stdClass(); $json_results = new stdClass();
@ -3796,8 +3800,6 @@ register_module([
exit(json_encode($json_results)); exit(json_encode($json_results));
} }
$env->perfdata->search_time = round((microtime(true) - $search_start)*1000, 3);
$title = $_GET["query"] . " - Search results - $settings->sitename"; $title = $_GET["query"] . " - Search results - $settings->sitename";
$content = "<section>\n"; $content = "<section>\n";

View file

@ -104,7 +104,7 @@
"author": "Starbeamrainbowlabs", "author": "Starbeamrainbowlabs",
"description": "Adds proper search functionality to Pepperminty Wiki using an inverted index to provide a full text search engine. If pages don't show up, then you might have hit a stop word. If not, try requesting the `invindex-rebuild` action to rebuild the inverted index from scratch.", "description": "Adds proper search functionality to Pepperminty Wiki using an inverted index to provide a full text search engine. If pages don't show up, then you might have hit a stop word. If not, try requesting the `invindex-rebuild` action to rebuild the inverted index from scratch.",
"id": "feature-search", "id": "feature-search",
"lastupdate": 1529967930, "lastupdate": 1529968213,
"optional": false "optional": false
}, },
{ {

View file

@ -145,6 +145,10 @@ register_module([
); );
} }
$env->perfdata->search_time = round((microtime(true) - $search_start)*1000, 3);
header("x-search-time: {$env->perfdata->search_time}ms");
if(!empty($_GET["format"]) && $_GET["format"] == "json") { if(!empty($_GET["format"]) && $_GET["format"] == "json") {
header("content-type: application/json"); header("content-type: application/json");
$json_results = new stdClass(); $json_results = new stdClass();
@ -152,8 +156,6 @@ register_module([
exit(json_encode($json_results)); exit(json_encode($json_results));
} }
$env->perfdata->search_time = round((microtime(true) - $search_start)*1000, 3);
$title = $_GET["query"] . " - Search results - $settings->sitename"; $title = $_GET["query"] . " - Search results - $settings->sitename";
$content = "<section>\n"; $content = "<section>\n";