Plugin version numbers?

Found a bug? Tell us!!
Post Reply
Tys
Regular
Posts: 36
Joined: Thu Feb 24, 2005 5:18 am

Plugin version numbers?

Post by Tys »

It seems that Spartacus checks version information just on a string comparision. Any chance of trying to convert the versions to numbers (and if it fails, then just do a string match), or splitting on the . and comparing per level (ie 1.1 < 1.3, 1.1.1 < 1.1.3, 1.1 < 1.1.1)?

Sidebar Hider Upgrade
Shrinks Sidebars to just their titles. Extra configuration in Entries -> Manage Sidebars in the Admin Suite.
Author: Tys von Gaza; version: 1.3; Upgrade to version 1.1
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Plugin version numbers?

Post by garvinhicking »

Yes, you're right, we currently only use exact stringmatching in spartacus, line 222:

Code: Select all

                        if ($bag->get('version') == $pluginstack[$i]['version']) {
                            $installable = false;
                        } else {
                            $pluginstack[$i]['upgradable']      = true;
                            $pluginstack[$i]['upgrade_version'] = $pluginstack[$i]['version'];
                            $pluginstack[$i]['version']         = $bag->get('version');
                            $upgradeLink                        = '&serendipity[spartacus_upgrade]=true';
                        }
which may be patched to this:

Code: Select all

                        if ($bag->get('version') == $pluginstack[$i]['version']) {
                            $installable = false;
                        } elseif (version_compare($bag->get('version'), $pluginstack[$i]['version'], '<')) {
                            $pluginstack[$i]['upgradable']      = true;
                            $pluginstack[$i]['upgrade_version'] = $pluginstack[$i]['version'];
                            $pluginstack[$i]['version']         = $bag->get('version');
                            $upgradeLink                        = '&serendipity[spartacus_upgrade]=true';
                        }
We should be able to use version_compare logic there easily, but I'm afraid it might break some stuff.

As the problem only arises when you locally develop plugins and not have them in the repository yet, I'd like to postpone a bugfix until Serendipity 0.9 development begins (in 1-2 weeks)

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