PluginLibrary 13
Another great update frostschutz. I just wish more people actually used this.
I think the new features are really cool, but I have some questions.

If the user edits a template in the ACP, MyBB writes the current MyBB version code to the template record. There is no support for user versions (e.g. multiple edits within a given MyBB version/release).

I looked at PL6 and noticed it was pushing version = 1 for sid = -2 (master template) but that wont let the Find Updated work since it requires the master version to be g.t. than the edited template version

	$compare_version = $mybb->version_code;
	$query = $db->query("
		SELECT COUNT(*) AS updated_count
		FROM ".TABLE_PREFIX."templates t 
		LEFT JOIN ".TABLE_PREFIX."templates m ON (m.title=t.title AND m.sid=-2 AND m.version > t.version)
		WHERE t.sid > 0 AND m.template != t.template

Those version numbers refer to MyBB versions exclusively. This is because this feature is originally intended for MyBB only, and templates only change when MyBB gets updated (which also changes the MyBB version). So if a user edits templates today, it will have the version 1605, and when MyBB 1.6.6 gets released any updated templates there will have the version code 1606 which will be larger than the user edited one...

This just doesn't work for plugin template versions, since plugins can update any time regardless of MyBB version. So instead of using MyBB version numbers, PluginLibrary simply uses 0 or 1 for version numbers and considers any template change as an update. So when PluginLibrary updates a template, it sets the user edited template version to 0. And since the master template has version 1, it'll show up in the updated templates.

This works fine in most cases; the only case that is not covered here that I can think of, is importing themes. It's possible to import an outdated plugin template which then won't show up in find updated templates - it's impossible to tell which plugin version it once belonged to because MyBB sets it to the MyBB version instead.
this plugin is not installing what is the problem in it when i install it. nothing happens
It's not really a plugin, but rather a library for other plugins. You just put it in your plugins folder, and it will show up in the list (mainly to show you that it's there and which version of it you currently have). You don't have to install/activate it, and if you try it should show you an OK message telling you that it doesn't have to be activated in order to work.

Plugins using this library just load it whenever they actually need it.
Can/should we ship PluginLibrary with our plugins? Or should installing it be a requirement?
You can, but you really shouldn't ship it with your plugin. Sooner or later there may be a new version of PluginLibrary. But your plugin keeps shipping the old one until you also update it - which could cause problem for plugins that depend on the new version. And chances are you won't be able to update yours because you were killed by a piano which fell from the sky or something.
A plugin that depends on another plugin (e.g. PluginLibrary), should never ship it in the download. You should just clearly state the dependency in the description.

In an ideal world, you could specify dependencies in your plugin_info() function and boards owners could search & install plugins (including their dependencies) directly from their ACP.
Creativity is a drug I cannot live without.
[Image: 1]Support PM will be ignored
Is there any function to check if a desired patch is applied? I want to hide the *Apply Patch* link if it is already applied just like google seo.

But the example hello plugin doesn´t show that.
Yes, you can check like so:

if(edit_core($yourname, $yourfile, $youredits) === true)
    echo "Our patch is already applied.";

The return value is explained in the documentation. I'll try to put this example into the hello_pl plugin sometime.

Forum Jump:

Users browsing this thread: 1 Guest(s)