Add generation time to preview generation.

Also fixed an inconsistency in the global timing system.
This commit is contained in:
Starbeamrainbowlabs 2016-04-06 18:30:11 +01:00
parent f9d30bc9c5
commit d4769658f7
4 changed files with 7 additions and 5 deletions

View File

@ -1,5 +1,5 @@
<?php
$start_time = time(true);
$start_time = microtime(true);
/*
@ -2593,7 +2593,7 @@ register_module([
* ██ ██ ██ ███████ ████ ██ ███████ ███ ███
*/
add_action("preview", function() {
global $settings, $env, $pageindex;
global $settings, $env, $pageindex, $start_time;
$filepath = $env->storage_prefix . $pageindex->{$env->page}->uploadedfilepath;
$mime_type = $pageindex->{$env->page}->uploadedfilemime;
@ -2657,6 +2657,7 @@ register_module([
// Send the completed preview image to the user
header("content-type: $output_mime");
header("x-generation-time: " . (microtime(true) - $start_time) . "s");
$preview_image->setImageFormat(substr($output_mime, strpos($output_mime, "/") + 1));
echo($preview_image->getImageBlob());
});

View File

@ -1,5 +1,5 @@
<?php
$start_time = time(true);
$start_time = microtime(true);
{settings}

View File

@ -68,7 +68,7 @@
"author": "Starbeamrainbowlabs",
"description": "Adds the ability to upload files to Pepperminty Wiki. Uploaded files act as pages and have the special 'File:' prefix.",
"id": "feature-upload",
"lastupdate": 1459956868,
"lastupdate": 1459963545,
"optional": false
},
{

View File

@ -180,7 +180,7 @@ register_module([
* ██ ██ ██ ███████ ████ ██ ███████ ███ ███
*/
add_action("preview", function() {
global $settings, $env, $pageindex;
global $settings, $env, $pageindex, $start_time;
$filepath = $env->storage_prefix . $pageindex->{$env->page}->uploadedfilepath;
$mime_type = $pageindex->{$env->page}->uploadedfilemime;
@ -244,6 +244,7 @@ register_module([
// Send the completed preview image to the user
header("content-type: $output_mime");
header("x-generation-time: " . (microtime(true) - $start_time) . "s");
$preview_image->setImageFormat(substr($output_mime, strpos($output_mime, "/") + 1));
echo($preview_image->getImageBlob());
});