Is it save to use the tmp-directory?

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
pengels
Forum Members
Forum Members
Posts: 34
Joined: Sat Dec 01, 2012 9:22 pm
Location: Germany, RLP

Is it save to use the tmp-directory?

Post by pengels »

Hi all,

background: The Showtime2 module (and previous Showtime) use a subdirectory css, where the corresponding css-files are stored for the different slideshows. This works fine. Disadvantage: this directory will be exported to the xml-file and therefore probably overwrite the settings of the users. One solution would be to delete this folder before exporting to xml. But then I have to recreate my own settings.

Therefore my idea is to place this folder inside the tmp-folder, eg. tmp/Showtime2/css.

Any reason speaking against this?

Regards Peter
Regards from Germany, Peter
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: Is it save to use the tmp-directory?

Post by Rolf »

I don't see a problem, only delete the folder and files at uninstall.
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Is it save to use the tmp-directory?

Post by velden »

this directory will be exported to the xml-file and therefore probably overwrite the settings of the users
I think (and I expect many others with me) that users should never ever have to change anything in the module's folder. If they do, they deserve the settings to be overwritten on update ;D

CSS, by design, allows styles to be overruled by another stylesheet. So that should be the way to go for users I think.

Disclaimer: I never used the Showtime(2) module.
Last edited by velden on Mon Apr 25, 2016 10:17 am, edited 1 time in total.
Reason: typo
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Is it save to use the tmp-directory?

Post by calguy1000 »

a: modules should be using the PUBLIC_CACHE directory if writing files that need to be web accessible. but users should not be editing files directly in that folder.

b: If you have files that are distributed with your system that your users may edit you shoulde use the module_custom approach. i.e module_custom/<myModule>/templates or module_custom/<myModule>/css
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
pengels
Forum Members
Forum Members
Posts: 34
Joined: Sat Dec 01, 2012 9:22 pm
Location: Germany, RLP

Re: Is it save to use the tmp-directory?

Post by pengels »

Hi calguy1000,

just to get things clearer: Do you mean, I should check for an existing directory module_custom inside modules and create it, if it does not exists and store the files inside here?

And where can I find the PUBLIC_CACHE directory? I have none and have never heared of it.

The only thing I need, is some kind of working-directory for the module outside the module-directory.

Thanks.

Regards Peter
Regards from Germany, Peter
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1922
Joined: Mon Jan 29, 2007 4:47 pm

Re: Is it save to use the tmp-directory?

Post by Jo Morg »

If I understood your 1st post correctly, both velden and Calguy1000 provided alternative solutions to the problem. I personally think that most users will use velden's solution as it is the more intuitive one to use, others may chose Calguy1000's solution as it has other advantages, but the fact that ALL modules can benefit from either is what makes CMSMS and its modules so versatile. The module install/upgrade methods provide the users with default settings that the user can override WITHOUT ever having to touch any of the files inside the modules' own directory. In most cases (if not all of them) doing so renders an installation not valid for support from either the core Dev Team and or the module developer.
The correct way to customize the module css (when not available through Design Manager) is by using either of the above solutions, and that is something that shouldn't worry the module developer. If the users implement either of the above the module will never overwrite any customization on install or upgrade.
pengels wrote:And where can I find the PUBLIC_CACHE directory? I have none and have never heared of it.
That's currently the tmp folder.
pengels wrote:The only thing I need, is some kind of working-directory for the module outside the module-directory.
Again, if understood correctly, that's what the users need, not the module itself, and that would be module_custom/<myModule>/templates or module_custom/<myModule>/css as calguy100 specified.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
pengels
Forum Members
Forum Members
Posts: 34
Joined: Sat Dec 01, 2012 9:22 pm
Location: Germany, RLP

Re: Is it save to use the tmp-directory?

Post by pengels »

Hi Jo,

thanks for your response. I have now moved the folder /modules/Showtime2/templates/css to modules_custom/Showtime2/css.

regards Peter
Regards from Germany, Peter
Post Reply

Return to “Developers Discussion”