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

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

View file

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

View file

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

View file

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