lizmap-web-client icon indicating copy to clipboard operation
lizmap-web-client copied to clipboard

lizmap logs - persistent warning

Open josemvm opened this issue 3 years ago • 6 comments

What is the bug?

persistent warning as relevant log output

Steps to reproduce the issue

load a project

Lizmap version

3.4.8

QGIS desktop version

3.16.15

QGIS server version

3.16.15

Operating system

Ubuntu 20.04

Browsers

Firefox

Browsers version

Firefox 95.0.2

Relevant log output

2022-01-13 20:49:52	xxx.xxx.xxx.xxx warning	2022-01-13 20:49:52	[2]	touch(): Utime failed: Operation not permitted	/var/www/html/lizmap-web-client-3.4.8/lib/jelix-plugins/cache/file/file.cache.php	189

2022-01-13 20:49:52	xxx.xxx.xxx.xxx	warning	2022-01-13 20:49:52	[2]	touch(): Utime failed: Operation not permitted	/var/www/html/lizmap-web-client-3.4.8/lib/jelix-plugins/cache/file/file.cache.php	183

josemvm avatar Jan 13 '22 19:01 josemvm

Verify that there are enough rights into lizmap/var/cache/ to be modified by the user who runs PHP (most of time, www-data on linux).

The class inside file.cache.php is called each time Lizmap want to store some cache into files. Without a stack trace, I cannot know if there is a bug somewhere.

laurentj avatar Jan 27 '22 10:01 laurentj

it seems the cache directory is missing from a fresh installation... i just created it now and the warning is gone

josemvm avatar Jan 27 '22 11:01 josemvm

i can confirm from another installation, the folder is not created at the moment of lizmap installation

josemvm avatar Jan 27 '22 12:01 josemvm

I also got the issue, I was trying a quick fix to raise a better warning with the folder name for instance :

diff --git a/lib/installwizard/jtpl/locales/en.php b/lib/installwizard/jtpl/locales/en.php
index d89a49bad..670d492f5 100644
--- a/lib/installwizard/jtpl/locales/en.php
+++ b/lib/installwizard/jtpl/locales/en.php
@@ -3,7 +3,8 @@
 jTplConfig::$localizedMessages =array(
     'file.directory.notexists'=>'The directory (%s) doesn\'t exist',
     'file.directory.notwritable'=>'Impossible to write into the file %s, verify that rights are enabled',
-    'file.write.error'=>'A problem has occured during the writing of the file %s by using the temporary file %s',
+    'file.write.error'=>'A problem has occurred during the writing of the file %s by using the temporary file %s',
+    'directory.write.error'=>'A problem has occurred during the writing of the directory %s',
 
     'errors.tpl.tag.syntax.invalid'=>'In the template %2$s, invalid syntax on tag %1$s',
     'errors.tpl.tag.function.invalid'=>'In the template %2$s, invalid syntax on the function %1$s',
diff --git a/lib/jelix/utils/jFile.class.php b/lib/jelix/utils/jFile.class.php
index 182a144e1..9ea9631eb 100644
--- a/lib/jelix/utils/jFile.class.php
+++ b/lib/jelix/utils/jFile.class.php
@@ -94,7 +94,15 @@ class jFile {
         // so should do own recursion
         if (!file_exists($dir)) {
             self::createDir(dirname($dir), $chmod);
+            if (!file_exists(dirname($dir))){
+                // Not enough rights to create the parent directory
+                throw new jException('jelix~errors.directory.write.error', dirname($dir));
+            }
             mkdir($dir, ($chmod?$chmod:jApp::config()->chmodDir));
+            if (!file_exists($dir)){
+                // Not enough rights to create the parent directory
+                throw new jException('jelix~errors.directory.write.error', $dir);
+            }
             // php mkdir apply umask on the given mode, so we must to
             // do a chmod manually.
             chmod($dir, ($chmod?$chmod:jApp::config()->chmodDir));

Gustry avatar Apr 12 '22 15:04 Gustry

the folder is not created

Which folder? I said a wrong thing in my last comment: lizmap/var/cache/ is not used by Lizmap. By default it is temp/lizmap/www/cache. It the missing folder is lizmap/var/cache/ , so it is because you indicated it yourself into the var/config/profiles.ini.php (cache_dir of the jcache:myapp section?). If you indicated it yourself, you must then create the directory and set rights on it. The cache plugin try to create it, but most of time, the PHP process has no rights on the var/ directory.

laurentj avatar Apr 25 '22 12:04 laurentj

@laurentj this warning persists on version 3.5.6 my cache_dir parameter is cache_dir=

josemvm avatar Sep 26 '22 08:09 josemvm

Does issue still occur?

nboisteault avatar Nov 30 '23 14:11 nboisteault

This issue is missing some feedbacks. 👻 Please have a look to the discussion, thanks. 🦎

github-actions[bot] avatar Jan 23 '24 04:01 github-actions[bot]