Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Override question_types twig in upload folder for Print Screen

  • cheeseburger
  • cheeseburger's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
1 week 1 day ago #268746 by cheeseburger
Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey Community Edition Version 6.10.0+250106
Own server or LimeSurvey hosting: Own server
Survey theme/template: Vanilla extended into a custom theme
==================
Hi everyone. Around 2022 we were able to take a question_type template from the

themes/survey/vanilla/views/subviews/printanswers/question_types directory

and then make a modification to a file such as "template_list-radio.twig" and place it into 

upload/themes/survey/ourVanillaExtendedTheme/views/subviews/printanswers/question_types

And this would override the core template_list-radio.twig template and utilize our edited version. 

Today, when we attempt the same, any questions that utilize that template on the post submission PRINT SCREEN will be excluded. If we remove this file from the upload directory, those questions will reappear. 

Any ideas for how we can continue to place these question_type files in the upload directory and have them connect like they had been a few yrs ago? 

Our goal is to edit files that are not accessible via the control panel theme editor. We found that when files that are accessible are edited in the theme editor control panel, they are cloned by limesurvey and placed into the upload folder sharing the same directory structure. We also know they are placed in the TMP folder. This is how we figured out this method a few yrs ago. Hopeful there is a solution for today. 

Thank you for any help!

Please Log in to join the conversation.

  • cheeseburger
  • cheeseburger's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
1 week 1 day ago - 1 week 1 day ago #268748 by cheeseburger
I ALMOST figured it out. Was a permissions issue. I had the basic read write execute permissions on but needed to add the rest for a 777. But here's the odd puzzle at this point: 

1. Without the permissions set correctly, the page didn't display the content of the one modified question_type twig. 
2. When setting debug=1, I was able to see the php error which pointed to permissions being the issue
3. Once I updated the permissions on that one twig, and continued to keep debug=1, the php error went away and the page displayed exactly as needed
4. HERE'S WHERE IT GETS WEIRD: But when I set debug back to 0, the page returned to its original issue whereby it doesn't display the questions that utilize the one twig file as a template. When I reset debug=1, it displays fine again. 

Any ideas, why this behavior could be occurring? 
Thanks!
Last edit: 1 week 1 day ago by cheeseburger. Reason: Discovered more challenges

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 week 1 day ago #268751 by tpartner
Try resetting the assets cache.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

  • cheeseburger
  • cheeseburger's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
1 week 11 hours ago - 1 week 7 hours ago #268771 by cheeseburger
Hi Tony and thank you. I cleared the assets cache and have confirmed that it indeed did clear the cache (even though it appeared to timeout) by viewing the change in the TMP directory as well as inspecting assets in the survey in which I see the path has changed from its old TMP directory to a new one. However the issue remains. Here are some things I can add to my previous observations: 

1. The reason why it is working when debug=1 is since this appears to bypass usage of the TMP directory (the cached version) and uses paths direct to the upload DIR. 

2. The reason why it is not working when debug=0, is because it is using the TMP directory and the files that I created and manually placed inside of the question_types folder in the upload folder are not being automatically copied by LimeSurvey into the equivalent TMP directory. Whereby a couple of yrs ago they were automatically copied. 

We are doing everything we can NOT to manually place files into a TMP directory since any update to the cache will break the connection and require another manual copy. The upload directory's files are great since it is maintained by LS in a safe manner. 

Any ideas how we could get the files to be copied to the TMP directory from the uploads dir? 

UPDATE AFTER THIS INITIAL POST: I tested a manual copy of the question_types/template_list-radio.twig to the TMP directory in the correct location where I can see that the files above it are properly working such as printanswers/printanswers_table.twig and even with the proper permissions, in the TMP file correct location, it still isn't accessing the modifications and just chooses to not display the questions that use this file. 

Thanks!
Last edit: 1 week 7 hours ago by cheeseburger.

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
4 days 18 hours ago #268805 by DenisChenu

Try resetting the assets cache.
 
Asset cache are only for CSS/JS/IMG caching. It don't clear twig caching.

I think you need to cleanup manually your tmp/runtime/twig_cache

I think it's a good idea to have a script cleanup all tmp files (except log; rotate did work)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.

Please Log in to join the conversation.

  • cheeseburger
  • cheeseburger's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 days 12 hours ago #268822 by cheeseburger
That's some great insight. Thank you! Is there a function built into the control panel to click and clear the twig cache? or do you manually access the server and remove the most recent tmp folder to allow it to rebuild a new one? or is there another way I need to be aware of? Especially the safest method would be great. I will google around in the meantime and already checked the control panel but didn't see anything there. Thanks for your help!
 

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 days 12 hours ago #268824 by holch
There is no GUI functionality that does this. You'll need to do it manually on the server.

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

  • cheeseburger
  • cheeseburger's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 days 11 hours ago #268826 by cheeseburger
Would this be located in /limesurvey/tmp/runtime/twig_cache 
or
/limesurvey/tmp/(the folder where I find the related twig files for the theme)

and if so, do I simply identify the folder related to the theme and delete it, and then the system will rebuild once it identifies that it is missing? 

Thanks, I want to be very cautious before performing any manual steps that may skew any data that may be in the DB if it includes content related to puzzling the tmp or twig cache together.
 

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
4 days 10 hours ago #268830 by DenisChenu
I think twig cache for template is generated automatically too when you update a twig file via the GUI : directory datetime was updated maybe ?


Else by default : ./tmp/runtime/twig_cache

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.

Please Log in to join the conversation.

  • cheeseburger
  • cheeseburger's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 days 10 hours ago #268834 by cheeseburger
I've tried several ways to clear or to force new cache related to the twig file. It just seems to not want to acknowledge twig files that are not editable and accessible within the LimeSurvey Theme Editor Control Panel.

So if I was to approach this from another angle, is there any known way to modify the twig files inside of /efs/www/html/limesurvey/themes/survey/vanilla/views/subviews/printanswers/question_types? 

Attaching a screen shot to remind us of the twigs that are inside of this folder. It is one per each type of question offered by LimeSurvey. 

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
4 days 8 hours ago #268837 by DenisChenu

I've tried several ways to clear or to force new cache related to the twig file. It just seems to not want to acknowledge twig files that are not editable and accessible within the LimeSurvey Theme Editor Control Panel.
 
I update a lot directly the twig file for question template, plugins or survey template.

See this (for version 5) : gitlab.com/SondagesPro/SurveyThemes/skel...swers?ref_type=heads

Where did you put exactly your twig files ?

Did you try to send any data in
Code:
/subviews/printanswers/printanswers_question.twig for testing ?
 
If it didn't work : it's an issue and must be reported : i do a test this week (whe ni found time).

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.

Please Log in to join the conversation.

  • cheeseburger
  • cheeseburger's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 days 8 hours ago #268839 by cheeseburger
I will try to answer each point below (if I understood correctly): 

1. I am able to make the edits to any of the twig files within the question_type folder (for example, removing the ID of a question from being shown) by downloading them off of the server and then making a copy that I edit 

2. I uploaded the modified twig to a path such as this 

/efs/www/html/limesurvey/upload/themes/survey/MyCustomTheme/views/subviews/printanswers/question_types

and I have also uploaded them directly to a TMP folder where I am seeing other twig files that are part of the same file path structure such as 

/efs/www/html/limesurvey/tmp/assets/9f317068/views/subviews/printanswers/question_types/I_place_them_in_here

3. If I place them in the TMP folder manually, they do not get acknowledged

4. If I place them in the uploads folder they will cause an error and not display the questions using the question type twig I uploaded (even if it is just a copy with no edits to it at all)

5. If I set config's debug=1, then it stops using the TMP folder (cache) and it then uses my file in the upload directory AND IT WORKS PERFECTLY

I am just not sure how to get it to work when debug=0 and it wants to use the TMP directory. 

You are thinking that this is a bug of some sort and that I should post it in the bug tracker? 

Thanks!
 

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose