Update notification

Discussion corner for Developers of Serendipity.
Post Reply
User avatar
onli
Regular
Posts: 2203
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Update notification

Post by onli » Fri Jan 15, 2016 5:59 pm

Discussion thread for https://github.com/s9y/Serendipity/issues/94

The request is to have a mechanism to see whether updates are available. I see this mechanism:
That might actually be a bit complicated. At a specific point in the backend (opened dashboard? plugin page?), we'd need to let spartacus do a plugin upgrade check. If there are upgrades, we'd have to set a (setings?) variable. If that variable is set, we'd show the update buttons in the dashboard and mark the update buttons in the plugin page (design might differ).
But I do not see a good execution point for that check. Has someone an idea how to get that feature?

User avatar
yellowled
Regular
Posts: 6996
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: Update notification

Post by yellowled » Fri Jan 15, 2016 6:10 pm

onli wrote:
At a specific point in the backend (opened dashboard? plugin page?), we'd need to let spartacus do a plugin upgrade check.
But I do not see a good execution point for that check. Has someone an idea how to get that feature?
I think it should be both – before showing the dashboard (because it now is a central hub for info about the blog) and before showing the plugins page. Those are the two places in the backend where one would expect to be notified about plugin updates.

We might want to think about adding another point to the Maintenance section, though.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
onli
Regular
Posts: 2203
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Update notification

Post by onli » Fri Jan 15, 2016 6:50 pm

That is not what I mean. The buttons could be anywhere, but yes, I agree that those are the good places :)
But s9y has to know that upgrades exist. For that, spartacus has to run a "are there upgrades" function. I do not see where and how to add that call.

In the dbcron plugin and start bundling that with the core?

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Update notification

Post by Timbalu » Fri Jan 15, 2016 7:03 pm

We could very easily check, if files https://github.com/s9y/additional_plugi ... Sevent.xml (or package_sidebar.xml) were changed by an Automagic XML sync, compared to last check of the backend tasks.

That would give us a hint about something having changed.

Then run a loop with (fakecode)

Code: Select all

$xml = new SimpleXmlElement($data, LIBXML_NOCDATA);
foreach ($xml->channel->item as $item) {
    $timestamp   = strtotime($item->pubDate);
    if ($timestamp is in the date range beween last check and this files timestamp) {
        return the plugin items which was updated
    }
}
which would give us the plugin being updated etc.

Then we could check if an old version of this plugin is installed and let the upgrade Button(s) pop up to run spartacus on clients demand.

Couldn't we?!
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
onli
Regular
Posts: 2203
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Update notification

Post by onli » Fri Jan 15, 2016 7:04 pm

Depends on how much time it takes. The network call alone make it impractical to run this on each dashboard load for example.

Apart from that yeah, that sounds possible (and about what spartacus would do for us)

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Update notification

Post by Timbalu » Fri Jan 15, 2016 7:14 pm

That does not really make a difference, I can tell from my experiences (since I am currently playing around with a rss feed test plugin for the dashboard, which hasn't even got a cache for a day option yet).
And this cache for a day would be the one in favour -like for the autoupate and dashboard check.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
onli
Regular
Posts: 2203
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Update notification

Post by onli » Fri Jan 15, 2016 7:20 pm

The XML parsing could take a lot of time. If we just want to try it out on dashboard open, we will see how much it costs. I'm okay with trying.

User avatar
onli
Regular
Posts: 2203
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Update notification

Post by onli » Sat Jan 16, 2016 12:39 pm

We could start the update fetch in an ajax call. That way, the load time of the dashboard won't be any longer than before.

User avatar
garvinhicking
Core Developer
Posts: 30014
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Update notification

Post by garvinhicking » Tue Jan 19, 2016 5:43 pm

onli wrote:We could start the update fetch in an ajax call. That way, the load time of the dashboard won't be any longer than before.
Personally I would prefer for it to work like this:

First, the spartacus plugin gets its own event like "crontab_check_sidebar" and "crontab_check_event" (or even only one), and this would simply execute the same features like we currently to do list the available plugin updates.

Second, we enhance the actual execution of the spartacus plugin, so that when it is performed, we create/update a new temporary database table (or extend the serendipity_pluginlist DB table) and permanently store the results of the last update. It might even already do that currenty, but I couldn't check right now.

Third, we add a new event to list the temporarily stored remote plugin version updates, and this event could be triggered by the dashboard and other places. Since we'd do no remote checks, that should work quickly.

Fourth, we add the two crontab functions to our dbcron plugin so that regular update queries can be performed at convenient times.
# 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/

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Update notification

Post by Timbalu » Tue Feb 02, 2016 8:33 pm

Fifth: Do what I did testwise.
Take what we have already and use it in a new plugin. Shall I paste that testwise to 2.1 plugins?
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
garvinhicking
Core Developer
Posts: 30014
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Update notification

Post by garvinhicking » Wed Feb 10, 2016 2:41 pm

Timbalu wrote:Fifth: Do what I did testwise.
Take what we have already and use it in a new plugin. Shall I paste that testwise to 2.1 plugins?
Not sure what you mean? Duplicate spartacus code as a new plugin? I think we should do it properly, and not by duplicating spartacus code...
# 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/

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Update notification

Post by Timbalu » Wed Feb 10, 2016 2:43 pm

No. Not duplicate. Read: USE spartacus code (spartacus_remote) very nice! :)
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
garvinhicking
Core Developer
Posts: 30014
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Update notification

Post by garvinhicking » Wed Feb 10, 2016 2:50 pm

Ah, I see. Yeah. Completely forgot about this one. We then already have a stub for this, yay. However the performance of this would suck, we'd definitely need an intermediate cache to not fetch and parse the XML time and again...
# 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/

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Update notification

Post by Timbalu » Wed Feb 10, 2016 2:57 pm

Got that already. Set to 6 hours. Its not really an XML, it is a plain txt file, which could even be made more simple for this case.

The culprit for my plugin is, you have to have activated the spartacus plugin and have to allow that option yourself. I don't think that dependency is too bad, since you have to want this feature in the dashboard by installing this plugin to the Dashboard. :)
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

Post Reply