Updating Core Plugins

Discussion corner for Developers of Serendipity.
Post Reply
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Updating Core Plugins

Post by blog.brockha.us »

I found a problem with updating core plugins. Normal plugins shipped via Spartacus do have an update function, that is executed after the update of a plugin. Core Plugins are updated manually by uploading/installing the files on the web server.

I upgraded my S9Y installation to 1.5 Alpha. The core plugin static_pages is part of this and was upgraded by uploading, too. Looking into the code of the plugin I found an important update function, that was never executed on my system.

I think, it would be worth thinking about, how to get an automated update mechanism on the core plugins, too. Perhaps an enhancement inside the pluigin library, making it possible to mark some plugins as "core" or something. These plugins should remember their version number in a hidden config entry, and if a change of version is detected, the update functionality of the plugin should be called. Perhaps while entering the plugin's config screen the first time or better inside the S9Y update routine, that should scan all delivered core plugins and call the update functions after upgrading the s9y database and stuff. Perhaps no "hidden config entry" is needed. The s9y upgrade mechanism should call *all* update functions of plugins where a change of version is detected after upgrading serendipity itself (normally these plugins *are* the core plugins only).

Is there already such a kind of upgrading mechanism and the static_page plugin simply was not linked into it?
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Updating Core Plugins

Post by garvinhicking »

Hi!

There is no core plugin "static_pages"...?!

Actually, plugins must take care of themself updating. The staticpage plugin for examples carries over a "version" configuration variable. Each plugin that requires to perform upgrade procedures would do this as well.

I think you are talking about the statistics plugin and its database indexes? The patch by kris only took care for new installations of it. We were both too lazy to add an upgrade routine to it. But this is simply our fault, not of the plugin API/routine or a core/spartacus separation behind 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/
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Re: Updating Core Plugins

Post by blog.brockha.us »

Of course you are right, I meant the event_statistics plugin. It contains the function updateTables that is adding Indexes *only*.

How is that called, if the plugin is already installed and only upgraded? How are the mechanics for updating core plugins? As far as I understand, only spartacus plugins are called by spartacus to do the upgrading. I don't know where or when the core plugins update functions are called?

What should be changed inside of the event_statistics to make the index creation done automatically?
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Updating Core Plugins

Post by garvinhicking »

Hi!
How is that called, if the plugin is already installed and only upgraded?
It's not. That was what I was trying to say. Nobody coded it similar to how the staticpage-plugin handles its updates.

The plugin has some sort of "Main" function that on ever run checks the contnets of its "version" variable and can detect a change in the stored version and the one saved inside the plugin, and then run some functions, and then save the new version number. Spartacus does not call any update routines.

So best would be if you could have a look at the staticpage event plugin and search for "version"

Best 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/
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Re: Updating Core Plugins

Post by blog.brockha.us »

Okay. But wouldn't it be nice to have a general way to have core plugins automatically updated?
(This was what I tried to say in my first article.. :))
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Updating Core Plugins

Post by garvinhicking »

Hi!

I'm not sure if creating a new API for that is really saving some time, when instead the plugins can handle it with that version property just like the staticpage? And that is much more flexible, because this way people can just update specific plugin files if they want, and the plugin would take care of it. If it were an API update, people would always need to upgrade a full version...

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/
Post Reply