PDF memory optimizations (#2736)
This commit is contained in:
@@ -12,12 +12,13 @@ As announced in the [README](README.md) I only support the latest available rele
|
|||||||
|
|
||||||
## Reporting a Vulnerability
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
Please report any security related vulnerability in the [advisories section at GitHub](https://github.com/kevinpapst/kimai2/security/advisories) or via email to info@keleo.de or kpapst@gmx.net.
|
Please read the [Bughunter](https://www.kimai.org/documentation/bughunter.html) documentation before posting,
|
||||||
|
and then you can report any security related vulnerability in the [advisories section at GitHub](https://github.com/kevinpapst/kimai2/security/advisories) or via email to kpapst@gmx.net.
|
||||||
|
|
||||||
I will work as fast as I can to fix the problem and publish a bugfix release / security update.
|
I will work as fast as I can to fix the problem and publish a bugfix release / security update.
|
||||||
Depending on the size of the required fixes, this might take a couple of hours or a couple of days.
|
Depending on the size of the required fixes, this might take a couple of hours or a couple of days.
|
||||||
|
|
||||||
You can expect that your message will be answered ASAP, but please take into account that I am living in the timezone CET.
|
You can expect that your message will be answered ASAP.
|
||||||
|
|
||||||
If your issue is valid and after I verified and fixed it, you will be mentioned in the release notes.
|
If your issue is valid and after I verified and fixed it, you will be mentioned in the release notes.
|
||||||
I am grateful for any (discrete) disclosure of vulnerabilities!
|
I am grateful for any (discrete) disclosure of vulnerabilities!
|
||||||
@@ -74,11 +74,23 @@ class MPdfConverter implements HtmlToPdfConverter
|
|||||||
@ini_set('pcre.backtrack_limit', '1000000');
|
@ini_set('pcre.backtrack_limit', '1000000');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// large amount of data take time
|
||||||
|
@ini_set('max_execution_time', '120');
|
||||||
|
|
||||||
// reduce the size of content parts that are passed to MPDF, to prevent
|
// reduce the size of content parts that are passed to MPDF, to prevent
|
||||||
// https://mpdf.github.io/troubleshooting/known-issues.html#blank-pages-or-some-sections-missing
|
// https://mpdf.github.io/troubleshooting/known-issues.html#blank-pages-or-some-sections-missing
|
||||||
$parts = explode('<pagebreak>', $html);
|
$parts = explode('<pagebreak>', $html);
|
||||||
for ($i = 0; $i < \count($parts); $i++) {
|
for ($i = 0; $i < \count($parts); $i++) {
|
||||||
$mpdf->WriteHTML($parts[$i]);
|
if (stripos($parts[$i], '<!-- CONTENT_PART -->') !== false) {
|
||||||
|
$subParts = explode('<!-- CONTENT_PART -->', $parts[$i]);
|
||||||
|
$run = 0;
|
||||||
|
foreach ($subParts as $subPart) {
|
||||||
|
$mpdf->WriteHTML($subPart);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$mpdf->WriteHTML($parts[$i]);
|
||||||
|
}
|
||||||
|
|
||||||
if ($i < \count($parts) - 1) {
|
if ($i < \count($parts) - 1) {
|
||||||
$mpdf->WriteHTML('<pagebreak>');
|
$mpdf->WriteHTML('<pagebreak>');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ mpdf-->
|
|||||||
{% set totalInternalRate = 0 %}
|
{% set totalInternalRate = 0 %}
|
||||||
{% set totalRate = 0 %}
|
{% set totalRate = 0 %}
|
||||||
{% for id, summary in summaries %}
|
{% for id, summary in summaries %}
|
||||||
|
<!-- CONTENT_PART -->
|
||||||
{% set totalDuration = totalDuration + summary.duration %}
|
{% set totalDuration = totalDuration + summary.duration %}
|
||||||
{% set totalInternalRate = totalInternalRate + summary.rate_internal %}
|
{% set totalInternalRate = totalInternalRate + summary.rate_internal %}
|
||||||
{% set totalRate = totalRate + summary.rate %}
|
{% set totalRate = totalRate + summary.rate %}
|
||||||
@@ -274,6 +275,7 @@ mpdf-->
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for entry in entries %}
|
{% for entry in entries %}
|
||||||
|
<!-- CONTENT_PART -->
|
||||||
{% set duration = duration + entry.duration %}
|
{% set duration = duration + entry.duration %}
|
||||||
{% if currency is same as(false) %}
|
{% if currency is same as(false) %}
|
||||||
{% set currency = entry.project.customer.currency %}
|
{% set currency = entry.project.customer.currency %}
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ mpdf-->
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for id, entry in model.calculator.entries %}
|
{% for id, entry in model.calculator.entries %}
|
||||||
|
<!-- CONTENT_PART -->
|
||||||
{% set duration = entry.duration|duration(isDecimal) %}
|
{% set duration = entry.duration|duration(isDecimal) %}
|
||||||
{% if entry.fixedRate %}
|
{% if entry.fixedRate %}
|
||||||
{% set rate = entry.fixedRate %}
|
{% set rate = entry.fixedRate %}
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ mpdf-->
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for entry in model.calculator.entries %}
|
{% for entry in model.calculator.entries %}
|
||||||
|
<!-- CONTENT_PART -->
|
||||||
{% set duration = entry.duration|duration(isDecimal) %}
|
{% set duration = entry.duration|duration(isDecimal) %}
|
||||||
{% if entry.fixedRate is not null %}
|
{% if entry.fixedRate is not null %}
|
||||||
{% set rate = entry.fixedRate %}
|
{% set rate = entry.fixedRate %}
|
||||||
|
|||||||
Reference in New Issue
Block a user