MyBB Community Forums

Full Version: Give each plugin it's own folder
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
For small plugins a single file suffice but for complex plugins it's better to split up logic into multiple files and then it's cleaner that the plugin is in it's own folder. This can already be done now but there must be a file with the plugin_info() function in the plugins root folder in order for it to work. I have had people who forgot to copy the folder resulting in a failure.

It would be great if MyBB supports both methods. The single file in the inc/plugins/ folder and a separate folder for a plugin.

Regards,
Aries-Belgium.
I actually prefer the simple way of all main plugin files in a single folder and any extras go into a subfolder.

If the user forgets to copy the folder its their fault, especially if the instructions clearly indicate to upload the folder and its contents.

You could put a simple test in the plugin code to see if the folder exists and then allow it to be activated if so. that will reduce your errors and be a simple way to minimzing such support requests you get. If the activate/install can't find the fodler, admin_redirect and flash a error message
Wasteful to have 2 methods of plugins. And if you write your plugin to MyBB standards you won't have a problem with using it how it is. At worst you place some files in root directory instead of having it all in the plugin file hooking into a page. Honestly what you propose is not necessary for any plugin.
Even if a plugin has only one file, there's almost a 100% chance that sometime, someone will ask why it doesn't work, and it turns out they forgot to upload the one and only file... Wink ...and the more files you have (plugin files, language files, javascript files, ...) the higher the probability that something will be missing somewhere.

Still, I'd use it. If there was an official method of support for plugin directories, I'd use that instead of implementing my own. Only condition is that as before, MyBB should only load one PHP file per plugin and leave the decision whether or not to load the other files, to the plugin itself.
What would make the "failed to upload all of the files" problem drastically reduced is if users could just upload a properly formatted .zip file through the AdminCP and MyBB would automatically unzip it into the forum root. This would work for themes too if MyBB automatically parses theme.xml.

I imagine something like this:
plugin.zip:
/root/
-/images/
--/...
-/inc/plugins/
--/plugin.php
-/pluginpage.php
/meta/
-/add.php
-/remove.php
-/info.xml

add and remove are run on extraction and deletion, respectively. These are meant to clean up files and whatnot.

It would work for themes too if you put {theme}.xml in meta.
^^this

much like WordPress does it (as I posted in another thread about new features)

however, the way it is works fine, and those of us that need folder support can easily add it. No need to a folder it the plugin is a single file.
There's a plugin like this, downside is that for this to work, you need to chmod all the files and folders that need to be written to...
Don't know if you're referring to my Plugin Uploader, but that just requires you to CHMOD the ./inc/plugins/temp/ folder to 777.
I say it's all up to the dev...
A logic developer should make a folder with a big plugin...
I like the idea. The files would be easier to upload, modify and delete.

Backing MyBB would be easier as you won't have to distinguish between MyBB default files and plugin files on the server.

If writing plugins would be more difficult even by a tiny amount, better leave it this way.
Pages: 1 2 3 4 5 6