Conversation
|
Thanks @tswfi for submitting this. We'll discuss it with other @PrestaShop/prestashop-maintainers now :) |
eternoendless
left a comment
There was a problem hiding this comment.
May I suggest
- /modules/[modulename] is where the module's CODE goes (and can no longer be written into)
- /var/modules/[modulename] is where modules can READ & WRITE to filesystem
- Inside that folder, you get three subdirectories:
cache,privateandpubliccacheis for, obviously, cached data. Cached data exists for performance reasons and cleared up at any time. The module must be able to reconstruct it at any time.privateis for private scratch data, like configuration, private keys, non public data, etc. To access this data publicly, the module must implement a dedicated fetch method that validates access to the requested file path.publicis for public assets, like js, CSS and images. The public path to this folder should not be guessable.
| * Module api provides a method `getPublicStorageFolder()` | ||
| * Core prepares new folder for the module in `var/public/modules/[modulename]/` | ||
| * Module can use that folder as they want (create new subfolders, create files, delete files) | ||
| * This folder is publicly accessible in `[shopurl]/var/storage/modules/[modulename]` |
There was a problem hiding this comment.
The path to files should ideally be randomly generated to avoid scraping and/or data leaks (eg to know which module the shop has installed)
|
|
||
| * Public files | ||
| * Module api provides a method `getPublicStorageFolder()` | ||
| * Core prepares new folder for the module in `var/public/modules/[modulename]/` |
There was a problem hiding this comment.
I think this would be better
| * Core prepares new folder for the module in `var/public/modules/[modulename]/` | |
| * Core prepares new folder for the module in `var/modules/[modulename]/public/` |
There was a problem hiding this comment.
Depends on the public data. If it is static assets like images that are distributed with the module then yes. If it is public data that was uploaded by the merchant/storefront user it should not live inside the module code. Quite a few modules for example create css files according to some settings and those files are specific for that shop.
There was a problem hiding this comment.
Exactly, what came with the module should stay there. What was created after (whatever way)č, in the new folders.
|
@PrestaShop/committers Hi guys, can we extend on this and possibly push it to finish before v9? The propositions before sound good, maybe with a slight change to cache directory:
Question:
|
This is a first draft for the specification for discussion.
Inspired by discussion here: https://prestashop.slack.com/archives/C010UHP5PAR/p1685442917263009