-
Notifications
You must be signed in to change notification settings - Fork 3
DataFolder
Within the jail, the data folder is a place to store persistent data that should, well, persist if your server program was to randomly crash. It can be saved in any format you wish, although JSON or plain text is the current convention. You should not try to write to anywhere other than the data/
folder in your jail, because although it may currently work, it will break in the future and is bad practice. Your data folder belongs to your module only, and you do not share it with any other modules.
Within the data folder, there are several special folders, created by the framework. Theses folders provide solutions to common limitations of the data folder, and provide ways to serve custom js, css, images, or templates. They also provide a means to share data between modules when required.
This is the shared data folder, and it stores all of the data that is shared between modules. You should, at least theoretically, be weary about trusting the contents of this folder from a security standpoint. Try to store as little data as you can in here, and always store it in a module-specific subfolder in order to avoid conflicts. Note: This is actually a symlink to another folder, and all changes by all modules are reflected instantaneously. You need not worry about delays in updates.
The data/img folder provides a way for modules to allow upload of user-generated images, and serve them to users without actually having to serve them itself. Save images in data/img/base/something.jpg
in order to have them reflected in both desktop and mobile layouts. You will eventually be able to save them in data/img/desktop
or data/img/mobile
, but this is not implemented. The images are then served at /img/<modulename>/data/something.jpg
.
The tmpl data directory provides perhaps the most useful special folder within the data directory- one that allows custom templates. This is currently used in the pages (and thus events) module, to allow for user-generated pages that can be included in templates. Same caveat as above, this uses a layout folder tree, but the desktop and mobile layouts are not implemented.