|
View:
New views
20 Messages
—
Rating Filter:
Alert me
|
| < Prev | 1 - 2 - 3 - 4 - 5 | Next > |
|
|
Plugin dependency checkingFirst of all, great to see WP 2.8 finally comming out. In the official blog
post, dependency checking was mentioned at the end. What I have in mind might not be the same thing but it is related, so here goes: I have a plugin toolkit called scbFramework<http://scribu.net/wordpress/scb-framework>, which I would like to package as a base plugin. The solution I found involves two steps: 1. Get the base plugin to be the first plugin that is loaded, so that the classes are available to all the rest of the plugins. This is done here<http://plugins.trac.wordpress.org/browser/scb-framework/trunk/plugin.php> . 2. In each child plugin, check if the base plugin is installed. If not, deactivate the child plugin and issue a notice. This is done in scb-check.php<http://plugins.trac.wordpress.org/browser/scb-framework/trunk/scb-check.php> . Step two requires ticket #9991 <http://core.trac.wordpress.org/ticket/9991>to be fixed, so that the user doesn't get two notices when he tries to activate the child plugin. Any thoughts on this method? Are there any plans to have an equivalent mechanism in WP 2.9? -- http://scribu.net _______________________________________________ wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Plugin dependency checkingI have a similar issue with one of my plugins. I have classes in my
plugin that extend native buddypress classes. There were some issues early on where the user loaded the plugins out of sequence. So now we have a standard way of determining if bp is installed and loaded at the time of dependent plugin load. function oci_load_buddypress() { // check to see if bp is already loaded if ( function_exists( 'bp_core_setup_globals' ) ) return true; /* Get the list of active sitewide plugins */ $active_sitewide_plugins = maybe_unserialize( get_site_option( 'active_sitewide_plugins' ) ); // not activated if ( !isset( $active_sidewide_plugins['buddypress/bp-loader.php'] ) ) return false; // activated but not loaded yet if ( isset( $active_sidewide_plugins['buddypress/bp-loader.php'] ) && !function_exists( 'bp_core_setup_globals' ) ) { require_once( WP_PLUGIN_DIR . '/buddypress/bp-loader.php' ); return true; } return false; } So the fn returns true if it's ok to continue with dependent plugin load and false if we need a graceful exit. It doesn't require rearranging the list of active plugins. scribu wrote: > First of all, great to see WP 2.8 finally comming out. In the official blog > post, dependency checking was mentioned at the end. What I have in mind > might not be the same thing but it is related, so here goes: > > I have a plugin toolkit called > scbFramework<http://scribu.net/wordpress/scb-framework>, > which I would like to package as a base plugin. > > The solution I found involves two steps: > > 1. Get the base plugin to be the first plugin that is loaded, so that the > classes are available to all the rest of the plugins. This is done > here<http://plugins.trac.wordpress.org/browser/scb-framework/trunk/plugin.php> > . > 2. In each child plugin, check if the base plugin is installed. If not, > deactivate the child plugin and issue a notice. This is done in > scb-check.php<http://plugins.trac.wordpress.org/browser/scb-framework/trunk/scb-check.php> > . > > Step two requires ticket #9991 > <http://core.trac.wordpress.org/ticket/9991>to be fixed, so that the > user doesn't get two notices when he tries to > activate the child plugin. > > Any thoughts on this method? Are there any plans to have an equivalent > mechanism in WP 2.9? > > > -- Code Is Freedom Burt Adsit _______________________________________________ wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Plugin dependency checkingInteresting solution. The bigger problem, at least for me, is the graceful
exit, i.e. how to let the user know why one or more plugins aren't working and what to do next. If you have a lot of dependant plugins, you end up copying the same code over and over again, so the less code you have to write for a graceful exit, the better. This is why I think 1 or two functions added to core would help. Something like plugin_dependency_warning($plugin, $version = '0'); -- http://scribu.net _______________________________________________ wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Plugin dependency checkingBtw, I noticed you have to hardcode 'buddypress/bp-loader.php'.
It's a ((minor) problem because if either the buddypress folder is renamed or bp-loader.php is replaced with something else, the dependant plugin will break. -- http://scribu.net _______________________________________________ wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Plugin dependency checkingWell, ya but there's a catch 22 there. Without having bp loaded I can't
check for the bp plugin dir const. The plugin has to tell me those things. If it's loaded I don't have to, if it isn't I can't. :) scribu wrote: > Btw, I noticed you have to hardcode 'buddypress/bp-loader.php'. > > It's a ((minor) problem because if either the buddypress folder is renamed > or bp-loader.php is replaced with something else, the dependant plugin will > break. > > -- Code Is Freedom Burt Adsit _______________________________________________ wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Plugin dependency checkingYeah, that's why I said you "have" to hardcode it. There simply isn't a
better way at the moment. Perhaps using the plugin guid that was proposed on the list recently. -- http://scribu.net _______________________________________________ wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
row output on wp-admin/users.phpCurrently there's a filter for adding the column headers
(manage_users_columns) but nothing (AFAIK) for the row output. Right now I'm modifying core to accomplish what we need. Thanks in advance. My diff for the 2.8 wp-core update is below (starts on 356 in WP 2.7): Index: wp-admin/users.php =================================================================== --- wp-admin/users.php (revision 4) +++ wp-admin/users.php (working copy) @@ -357,7 +357,7 @@ $role = array_shift($roles); $style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"'; - echo "\n\t" . user_row($user_object, $style, $role); + echo "\n\t" . apply_filters( 'user_row', user_row($user_object, $style, $role), $userid ); } ?> </tbody> -- // Dan Cameron SproutVenture // grow your business http://sproutventure.com _______________________________________________ wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Plugin dependency checkingSomething you might try is make the plugin do nothing but hook a
function to run at plugins_loaded. Then in that function you check that the "master" plugin is running, and if it is, load the dependent stuff. There are some limitation to this since "plugins_loaded" doesn't run immediately after plugins are loaded (a bug IMO). for example, the "pluggable.php" file is loaded between plugins loading and the "plugins_loaded" hook firing. Also I think some caching stuff happens in between. Stephen -- Stephen Rider http://striderweb.com/ On Jun 11, 2009, at 10:31 AM, scribu wrote: > Yeah, that's why I said you "have" to hardcode it. There simply > isn't a > better way at the moment. > > Perhaps using the plugin guid that was proposed on the list recently. > > -- > http://scribu.net > _______________________________________________ > wp-hackers mailing list > wp-hackers@... > http://lists.automattic.com/mailman/listinfo/wp-hackers _______________________________________________ wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Plugin dependency checkingThe main problem with that approach is that you can't use
register_activation_hook() and the like, which is a deal breaker for a lot of plugins. -- http://scribu.net _______________________________________________ wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Plugin dependency checkingI've been pondering the concept of sub-plugins lately. There was a
discussion about such a few weeks back. The idea is that plugins such as Spam Karma, which has plugins of its own, could be set up so that the Spam Karma plugins are just regular WP plugins that are "subsidiary" to Spam Karma. Ideally, I think, in the Manage Plugins page, Spam Karma would have a little open/close control that would use Ajax to reveal/hide the sub- plugins. This same idea would work for your "dependent" plugins. It's the same idea, just different wording. I may submit a patch enabling that ability. I'm pretty sure I can do the actual sub-plugin checking, but the Ajaxy stuff for the Admin is outside my area.... Stephen -- Stephen Rider http://striderweb.com/ _______________________________________________ wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Plugin dependency checking>
> Ideally, I think, in the Manage Plugins page, Spam Karma would have a > little open/close control that would use Ajax to reveal/hide the > sub-plugins. That would be nice. The plugins page needs a restyling anyway. > This same idea would work for your "dependent" plugins. It's the same > idea, just different wording. Yes, it's the same concept: plugins that depend on a base / toolkit / framework plugin. I may submit a patch enabling that ability. I'm pretty sure I can do the > actual sub-plugin checking, but the Ajaxy stuff for the Admin is outside my > area.... > Sure would be nice to have at least a starting patch. A new field in the plugin header would be nice: /* Plugin Name: My Plugin Depends On: Spam Karma, scbFramework */ WP would check if each plugin in the list is installed and active and takes care of the loading order. After we got that working we could start on the user experience. -- http://scribu.net _______________________________________________ wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Plugin dependency checkingHey all,
I've been toying with this idea while on the phone with a client this afternoon and I have a proof of concept I'd like to have you look at. Please let me know what you think. Example at: http://fullthrottledevelopment.com/creating-dependent-wordpress-plugins SneakPeak: 1. Copy the code at the top of hello_dolly.txt and paste it into the top of your Hello Dolly plugin 2. Try to activate Hello Dolly without Akismet activated. 3. Activate Akismet and try to activate Hello Dolly 4. Deactivate Akismet and confirm that Hello Dolly has been deactivated Glenn Ansley http://fullthrottledevelopment.com http://twitter.com/full_throttle http://twitter.com/glennansley On Thu, Jun 11, 2009 at 4:00 PM, scribu<scribu@...> wrote: >> >> Ideally, I think, in the Manage Plugins page, Spam Karma would have a >> little open/close control that would use Ajax to reveal/hide the >> sub-plugins. > > > That would be nice. The plugins page needs a restyling anyway. > > >> This same idea would work for your "dependent" plugins. It's the same >> idea, just different wording. > > > Yes, it's the same concept: plugins that depend on a base / toolkit / > framework plugin. > > I may submit a patch enabling that ability. I'm pretty sure I can do the >> actual sub-plugin checking, but the Ajaxy stuff for the Admin is outside my >> area.... >> > > Sure would be nice to have at least a starting patch. > > A new field in the plugin header would be nice: > > /* > Plugin Name: My Plugin > Depends On: Spam Karma, scbFramework > */ > > WP would check if each plugin in the list is installed and active and takes > care of the loading order. > > After we got that working we could start on the user experience. > > > -- > http://scribu.net > _______________________________________________ > wp-hackers mailing list > wp-hackers@... > http://lists.automattic.com/mailman/listinfo/wp-hackers > wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Plugin dependency checkingOn Jun 11, 2009, at 3:00 PM, scribu wrote: > A new field in the plugin header would be nice: > > /* > Plugin Name: My Plugin > Depends On: Spam Karma, scbFramework > */ > > WP would check if each plugin in the list is installed and active > and takes > care of the loading order. Two possibilities: 1) You can make a sub plugin for a plugin that registers itself as "sub-able". Then you could do a header like your example. 2) otherwise you do a header like this: Depends On: spam-karma/spam_karma_plugin.php Both 1 and 2 should work. WordPress strongly follows a pattern like #1, but #2 would allow for more flexibility I think. I can certainly imagine making a plugin that depends on another, even if the author of that other plugin doesn't anticipate that.... ** ALSO: Scribu -- I will definitely have to keep in mind your example, and the possibility that a plugin might be dependent on ***more than one*** other plugin. In that situation the strict "sub plugin" concept doesn't quite work. I think what I could do is set up the "dependency' system, and on top of that would be a second layer implementing the "sub plugin" idea. The dependency part is universal, while the sub-plugin part really only affects how it appears under the Manage Plugins page. That is, a sub-plugin is a special kind of dependent plugin. In terms of interface, sub-plugins would fall under the collapsable area under their Master plugin. Simply dependent plugins would look like regular plugins on the list. ** What happens when I activate a dependent plugin and the master plugin is not active? Automatically activate the master also? Or give a "you can't do that" message? ** ONE LAST THING: You would have to be able to specify a minimum *version* of the master plugin. "Depends on Spam Karma v2.0". Don't want to run a plugin that needs v2.0 of another one, when v1.3 of that other is installed. Stephen -- Stephen Rider http://striderweb.com/ _______________________________________________ wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| < Prev | 1 - 2 - 3 - 4 - 5 | Next > |
| Free embeddable forum powered by Nabble | Forum Help |