From 1297b3df9b57babc75cae7ddd182a8a73755640d Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Sat, 21 Apr 2018 10:17:11 -0500 Subject: [PATCH] Minor: add proper warning if test2pdf plugin cannot write icons to main/img/ - refs #2490 --- plugin/test2pdf/src/test2pdf_plugin.class.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugin/test2pdf/src/test2pdf_plugin.class.php b/plugin/test2pdf/src/test2pdf_plugin.class.php index 8f4d8f83ee..d31345ea3f 100644 --- a/plugin/test2pdf/src/test2pdf_plugin.class.php +++ b/plugin/test2pdf/src/test2pdf_plugin.class.php @@ -45,9 +45,14 @@ class Test2pdfPlugin extends Plugin $dstfile1 = __DIR__.'/../../../main/img/icons/64/test2pdf.png'; $dstfile2 = __DIR__.'/../../../main/img/icons/64/test2pdf_na.png'; $dstfile3 = __DIR__.'/../../../main/img/test2pdf.png'; - copy($srcfile1, $dstfile1); - copy($srcfile2, $dstfile2); - copy($srcfile3, $dstfile3); + $res1 = @copy($srcfile1, $dstfile1); + $res2 = @copy($srcfile2, $dstfile2); + $res3 = @copy($srcfile3, $dstfile3); + if (!$res1 || !$res2 || !$res3) { + $warning = 'Test2PDF plugin icons could not be copied to main/img/ because of folder permissions. To fix, give web server user permissions to write to main/img/ before enabling this plugin.'; + Display::addFlash($warning); + error_log($warning); + } } /**