[2.0] New event hooks for plugin installation/update
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
[2.0] New event hooks for plugin installation/update
Hi!
Timbalu proposed a while ago to add new methods for when a plugin is installed/updated. Currently, plugins like serendipity_event_staticpage execute their own method on each call to see if they are running the latest version.
I have now added new event hooks to the core:
* backend_templates_install
Executed when a new template is selected.
$eventData: Name of the template
$addData: Array of template information (fetchTemplateInfo)
* backend_plugins_install
Executed after a new plugin was (possibly downloaded) installed. This is on top of $plugin->install(), the hook is executed after this. This hook is actually NOT meant for the plugin itself to hook into, but for other plugins to possibly perform actions when a compatible plugin is installed - like, serendiity_event_staticpage could create additional SQL tables, if serendipity_event_freetag is installed. Then the plugin would not need to check everytime if the serendipity_event_freetag plugin is loaded and the tables already exist.
$eventData: Name of the plugin
$addData: Array of $serendipity plus GET data
* backend_plugins_update
Executed after an existing plugin was updated. Plugins can check for updates to their own files by hooking into this, but also for other plugins that may have been updated.
$eventData: Name of the plugin
$addData: Array of $serendipity plus GET data
I am not really sure if this is the best way to solve plugin updates. If the upgrade process somehow fails, or timeouts, maybe this event hook might never get executed - the current way plugins check every time again and again if they are the most recent version is much safer - however, also much more impactful to performance. So let's see how this goes.
Regards,
Garvin
Timbalu proposed a while ago to add new methods for when a plugin is installed/updated. Currently, plugins like serendipity_event_staticpage execute their own method on each call to see if they are running the latest version.
I have now added new event hooks to the core:
* backend_templates_install
Executed when a new template is selected.
$eventData: Name of the template
$addData: Array of template information (fetchTemplateInfo)
* backend_plugins_install
Executed after a new plugin was (possibly downloaded) installed. This is on top of $plugin->install(), the hook is executed after this. This hook is actually NOT meant for the plugin itself to hook into, but for other plugins to possibly perform actions when a compatible plugin is installed - like, serendiity_event_staticpage could create additional SQL tables, if serendipity_event_freetag is installed. Then the plugin would not need to check everytime if the serendipity_event_freetag plugin is loaded and the tables already exist.
$eventData: Name of the plugin
$addData: Array of $serendipity plus GET data
* backend_plugins_update
Executed after an existing plugin was updated. Plugins can check for updates to their own files by hooking into this, but also for other plugins that may have been updated.
$eventData: Name of the plugin
$addData: Array of $serendipity plus GET data
I am not really sure if this is the best way to solve plugin updates. If the upgrade process somehow fails, or timeouts, maybe this event hook might never get executed - the current way plugins check every time again and again if they are the most recent version is much safer - however, also much more impactful to performance. So let's see how this goes.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: [2.0] New event hooks for plugin installation/update
Sounds exiting! +1
Thank you!
Could we at least downport the last hook (backend_plugins_update) to work with it right now?
Thank you!
Could we at least downport the last hook (backend_plugins_update) to work with it right now?
Regards,
Ian
Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Ian
Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: [2.0] New event hooks for plugin installation/update
Hi!
I did. Would you like to test if it works?
(Plugins need to have a fallback for serendipity <= 1.7.1 at least for some time!)
Regards,
Garvin
I did. Would you like to test if it works?
(Plugins need to have a fallback for serendipity <= 1.7.1 at least for some time!)
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: [2.0] New event hooks for plugin installation/update
I definitely will!
I'll try that with ckeditor, but will not do any fallback, since I will bump the required version to 1.7.1
I'll try that with ckeditor, but will not do any fallback, since I will bump the required version to 1.7.1
Regards,
Ian
Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Ian
Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: [2.0] New event hooks for plugin installation/update
That would be a problem, because then you can test this - if you raise to 1.7.1 before 1.7.1 is released, you'd completely disable the plugin for anyone else.I'll try that with ckeditor, but will not do any fallback, since I will bump the required version to 1.7.1
Also, just because of this update method, no plugin should require 1.7.1, think about the users...
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: [2.0] New event hooks for plugin installation/update
Sure, this is true in general.
But in this special case it does not really matter, since ckeditor already is >= 1.7 only and I will not update the ckeditor version until 1.7.1 is out as well.
But in this special case it does not really matter, since ckeditor already is >= 1.7 only and I will not update the ckeditor version until 1.7.1 is out as well.
Regards,
Ian
Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Ian
Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: [2.0] New event hooks for plugin installation/update
Hi!
But 1.7.1 is not a mandatory security-releated upgrade. So some people will still run 1.7. Why exclude them from CKEditor, if their version would perfectly run it?
Regards,
Garvin
But 1.7.1 is not a mandatory security-releated upgrade. So some people will still run 1.7. Why exclude them from CKEditor, if their version would perfectly run it?
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: [2.0] New event hooks for plugin installation/update
Now I see what you mean.... Its about new installations. Right, I don't want to disable that.
I was thinking in terms of updaters only.... (I'll see what I can do about it.)
But still it would be like this. Everybody with 1.7 wanting to use the ckeditor plugin could still do this until 1.7.1 and a new ckeditor Plugin is out. Updaters would profit, the other ones wouldn't notice until they want to try out the updated Plugin as new. They would see the note that 1.7.1 is required to install this plugin.
Would Spartacus or our plugin manager disable already running versions on 1.7 if the required version is bumped up?
If not, it wouldn't be that important, to update to a new Plugin (ckeditor) version...
I was thinking in terms of updaters only.... (I'll see what I can do about it.)
But still it would be like this. Everybody with 1.7 wanting to use the ckeditor plugin could still do this until 1.7.1 and a new ckeditor Plugin is out. Updaters would profit, the other ones wouldn't notice until they want to try out the updated Plugin as new. They would see the note that 1.7.1 is required to install this plugin.
Would Spartacus or our plugin manager disable already running versions on 1.7 if the required version is bumped up?
If not, it wouldn't be that important, to update to a new Plugin (ckeditor) version...
Regards,
Ian
Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Ian
Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: [2.0] New event hooks for plugin installation/update
I was thinking in terms of updaters only.... (I'll see what I can do about it.)
Yes. But nobody with < 1.7.1 could then install CKEditor anymore. That's not good, it's not necessary to punish those users.But still it would be like this. Everybody with 1.7 wanting to use the ckeditor plugin could still do this until 1.7.1 and a new ckeditor Plugin is out. Updaters would profit, the other ones wouldn't notice until they want to try out the updated Plugin as new. They would see the note that 1.7.1 is required to install this plugin.
They cannot upgrade the plugin then.Would Spartacus or our plugin manager disable already running versions on 1.7 if the required version is bumped up?
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: [2.0] New event hooks for plugin installation/update
I never punish users ... its not my naturegarvinhicking wrote:Yes. But nobody with < 1.7.1 could then install CKEditor anymore. That's not good, it's not necessary to punish those users.
though it would be nice to have a required version to install and a required version to update routine in spartacus... then this update hook would really be quite powerful!
Regards,
Ian
Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Ian
Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: [2.0] New event hooks for plugin installation/update
I don't see how this would work? Spartacus only always has the most recent version available.Timbalu wrote:I never punish users ... its not my naturegarvinhicking wrote:Yes. But nobody with < 1.7.1 could then install CKEditor anymore. That's not good, it's not necessary to punish those users.
though it would be nice to have a required version to install and a required version to update routine in spartacus... then this update hook would really be quite powerful!
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: [2.0] New event hooks for plugin installation/update
Maybe I don't understand the purpose of this or it might be going too far, but could this
We have some templates which sort of require certain plugins to be installed, e.g. the magazine templates. I think it would be pretty awesome to have those templates trigger the installation of their required plugins automagically, unless this has security implications or is too much of a hassle to code.
YL
be used or extended to trigger the installation of plugins as well?garvinhicking wrote:* backend_templates_install
Executed when a new template is selected.
We have some templates which sort of require certain plugins to be installed, e.g. the magazine templates. I think it would be pretty awesome to have those templates trigger the installation of their required plugins automagically, unless this has security implications or is too much of a hassle to code.
YL
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: [2.0] New event hooks for plugin installation/update
Hi!
But that's a question for the implementation; the foundation for this is available now, yes.
(Of course, previously a templates config.inc.php could also download, install/enable plugins for a long time...)
Regards,
Garvin
Yes. This would be a bit trickier though because spartacus etc. is not really meant to download and install multiple plugins at once. It could be done, but might possibly be sluggish.be used or extended to trigger the installation of plugins as well?
But that's a question for the implementation; the foundation for this is available now, yes.
(Of course, previously a templates config.inc.php could also download, install/enable plugins for a long time...)
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: [2.0] New event hooks for plugin installation/update
Erm, okay … should I be aware of how that works or is this something which we had for a long time but never used?garvinhicking wrote:(Of course, previously a templates config.inc.php could also download, install/enable plugins for a long time...)
YL
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: [2.0] New event hooks for plugin installation/update
Hi!
You specifically shouldn't be, as it would involve a larger amount of PHP coding. Just saying the foundation/API would also be there to do it.Erm, okay … should I be aware of how that works or is this something which we had for a long time but never used?
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/