[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [FIX] pdflib: Ensure temp/pdfimg files are deleted even with permission issues
"Domeshow Emmanuel \(@Domeshow\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6a199ab34cdb1_38193a4815079@gitlab-sidekiq-low-urgency-cpu-bound-v2-6b99557b78-v9x7n.mail> |
Domeshow Emmanuel pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki
Commits:
c5146065 by Domeshow Emmanuel at 2026-05-29T16:47:31+03:00
[FIX] pdflib: Ensure temp/pdfimg files are deleted even with permission issues
---
* [FIX] pdflib: Ensure temp/pdfimg files are deleted even with permission issues
---
* [FIX] pdflib: Ensure temp/pdfimg files are deleted even with permission issues
See merge request tikiwiki/tiki!9374
(cherry picked from commit bcc4b2157eff2be53ab3aeb01bbf4f4958cf3b6c)
See merge request tikiwiki/tiki!10403
- - - - -
2 changed files:
- lib/pdflib.php
- path_constants.php
Changes:
=====================================
lib/pdflib.php
=====================================
@@ -446,6 +446,7 @@ class PdfGenerator
if (empty($isPermissionToViewPage)) {
$title = tr('PDF Cover Page Error');
$mes = tr('PDF generation failed because you do not have permission to view the specified cover page: %0', $coverWikiPage);
+ $this->clearTempImg($tempImgArr);
Feedback::error(['mes' => $mes, 'title' => $title]);
TikiLib::lib('access')->redirect($params['page'] ?? '');
die();
@@ -1136,9 +1137,9 @@ class PdfGenerator
if (! $internalImg) {
$url = $base_url . $url;
}
- if (! file_exists('temp/pdfimg')) {
- mkdir('temp/pdfimg');
- chmod('temp/pdfimg', 0755);
+ if (! file_exists(TEMP_PDFIMG_PATH)) {
+ mkdir(TEMP_PDFIMG_PATH);
+ chmod(TEMP_PDFIMG_PATH, 0755);
}
$cookie = isset($_SERVER['HTTP_COOKIE']) ? $_SERVER['HTTP_COOKIE'] : '';
$opts = [];
@@ -1154,7 +1155,7 @@ class PdfGenerator
if (gettype($data) == 'boolean' && ! $data) {
return '';
}
- $newFile = 'temp/pdfimg/pdfimg' . mt_rand(9999, 999999) . '.png';
+ $newFile = TEMP_PDFIMG_PATH . '/pdfimg' . mt_rand(9999, 999999) . '.png';
file_put_contents($newFile, $data);
chmod($newFile, 0755);
return $newFile;
=====================================
path_constants.php
=====================================
@@ -97,6 +97,7 @@ const TEMP_CACHE_PATH = 'temp/cache';
const TEMP_PUBLIC_PATH = 'temp/public';
const TEMP_MAIL_DEBUG = 'temp/mail_debug';
const HTMLPURIFIERCACHE_CACHE_PATH = 'temp/cache/HTMLPurifierCache';
+const TEMP_PDFIMG_PATH = 'temp/pdfimg';
const WIKIPLUGINS_SRC_PATH = 'lib/wiki-plugins';
//Question: where is the string or constant that generates these files?
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/c51460655ebf0687b3ce4c4a9eec9e84e179f9c1
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/c51460655ebf0687b3ce4c4a9eec9e84e179f9c1
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs