-
Notifications
You must be signed in to change notification settings - Fork 83
Description
In our reviews we already say:
Saving data in the plugin folder and/or asking users to edit/write to plugin.
We cannot accept a plugin that forces (or tells) users to edit the plugin files in order to function, or saves data in the plugin folder.
Plugin folders are deleted when upgraded, so using them to store any data is problematic. Also bear in mind, any data saved in a plugin folder is accessible by the public. This means anyone can read it and use it without the site-owner’s permission.
It is preferable that you save your information to the database, via the Settings API, especially if it’s privileged data. If that’s not possible, because you’re uploading media files, you should use the media uploader.
If you can’t do either of those, you must save the data outside the plugins folder. We recommend using the uploads directory, creating a folder there with the slug of your plugin as name, as that will make your plugin compatible with multisite and other one-off configurations.
Please refer to the following links:
https://developer.wordpress.org/plugins/settings/
https://developer.wordpress.org/reference/functions/media_handle_upload/
https://developer.wordpress.org/reference/functions/wp_handle_upload/
https://developer.wordpress.org/reference/functions/wp_upload_dir/
We warn developers to use properly folders to save their data. This check could have positives, so maybe we should use a 6 severity and error.
We should check the functions: 'fwrite', 'fputs', 'file_put_contents', 'copy', 'rename', 'copy_dir', 'move_dir', and wp_filesystem. Finally, detect the place that they are using to save the data.