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

Bugfix: Clean up correctly if the external renderer burps

This is especialyl important for the exteernal renderer cache directory, 
which is assumed to contain exclusively valid rendered outputs.
This commit is contained in:
Starbeamrainbowlabs 2019-10-21 00:41:14 +01:00
parent b7cb9741de
commit 0744498570
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
2 changed files with 10 additions and 1 deletions

View file

@ -337,7 +337,7 @@
"version": "0.10",
"author": "Emanuil Rusev & Starbeamrainbowlabs",
"description": "An upgraded (now default!) parser based on Emanuil Rusev's Parsedown Extra PHP library (https:\/\/github.com\/erusev\/parsedown-extra), which is licensed MIT. Please be careful, as this module adds some weight to your installation.",
"lastupdate": 1571614194,
"lastupdate": 1571614692,
"optional": false,
"extra_data": {
"Parsedown.php": "https:\/\/raw.githubusercontent.com\/erusev\/parsedown\/fe7a50eceb4a3c867cc9fa9c0aa906b1067d1955\/Parsedown.php",

View file

@ -135,6 +135,12 @@ register_module([
null // environment variables
);
if(!is_resource($process_handle)) {
fclose($dest_handle);
fclose($source_handle);
fclose($error_text_handle);
unlink($cache_file_location);
http_response_code(503);
header("cache-control: no-cache, no-store, must-revalidate");
header("content-type: image/png");
@ -152,6 +158,9 @@ register_module([
if($exit_code !== 0) {
fseek($error_text_handle, 0);
$error_details = stream_get_contents($error_text_handle);
// Delete the cache file, which is guaranteed to exist because
// we pre-emptively create it above
unlink($cache_file_location);
http_response_code(503);
header("content-type: image/png");