Welcome to Geeklog, Anonymous Monday, December 23 2024 @ 09:43 am EST
Geeklog Forums
How Geeklog v1.4+ determines if a plugins needs to be updated
Status: offline
mevans
Forum User
Full Member
Registered: 02/08/04
Posts: 393
Location:Texas
I just released a new development version of the Media Gallery plugin with the version number of 1.3.10 and found that in Geeklog v1.4+ in the Plugin List it would show that the plugin needed to be updated (old version was v1.3.9) but when I went into the Plugin Editor, the Update button did not display.
In looking at the Geeklog code, it looks like Geeklog uses 2 different methods to determine when Update should be shown. In the Plugin List it uses the following code (from system/lib-admin.php):
$pi_installed_version = $A['pi_version'];
if (empty ($plugin_code_version) ||
($pi_installed_version == $code_version)) {
$retval = $pi_installed_version;
} else {
$retval = "{$LANG32[37]}: $pi_installed_version, {$LANG32[36]}: $plugin_code_version";
if ($A['pi_enabled'] == 1) {
$retval .= " <b>{$LANG32[38]}</b>";
}
}
So basically it looks to make sure the version is not blank and if it is not equal to the current plugin version, display the Update! text in the listing.
But, in admin/plugins.php, the following code is used in the Plugin Editor to determine if the Update button should appear:
$plugin_code_version = PLG_chkVersion($pi_name);
if ($plugin_code_version == '') {
$plugin_code_version = 'N/A';
}
if ($plugin_code_version != 'N/A' AND $plugin_code_version > $A['pi_version']) {
$plg_templates->set_var ('update_option', '<input type="submit" value="'
. $LANG32[34] . '" name="mode">');
} else {
$plg_templates->set_var ('update_option', '');
}
Here Geeklog actually tries to compare the two version numbers. Since I'm using 1.3.9 and 1.3.10, the compare believes that 1.3.9 is greater than 1.3.10 (makes sense, it is using a string compare).
My point here is that it is inconsistent, the Update! will show in the Plugin List, but no Update button in the Plugin Editor. Should it be handled the same in both locations?
Thanks!
Mark
In looking at the Geeklog code, it looks like Geeklog uses 2 different methods to determine when Update should be shown. In the Plugin List it uses the following code (from system/lib-admin.php):
Text Formatted Code
$pi_installed_version = $A['pi_version'];
if (empty ($plugin_code_version) ||
($pi_installed_version == $code_version)) {
$retval = $pi_installed_version;
} else {
$retval = "{$LANG32[37]}: $pi_installed_version, {$LANG32[36]}: $plugin_code_version";
if ($A['pi_enabled'] == 1) {
$retval .= " <b>{$LANG32[38]}</b>";
}
}
So basically it looks to make sure the version is not blank and if it is not equal to the current plugin version, display the Update! text in the listing.
But, in admin/plugins.php, the following code is used in the Plugin Editor to determine if the Update button should appear:
Text Formatted Code
$plugin_code_version = PLG_chkVersion($pi_name);
if ($plugin_code_version == '') {
$plugin_code_version = 'N/A';
}
if ($plugin_code_version != 'N/A' AND $plugin_code_version > $A['pi_version']) {
$plg_templates->set_var ('update_option', '<input type="submit" value="'
. $LANG32[34] . '" name="mode">');
} else {
$plg_templates->set_var ('update_option', '');
}
Here Geeklog actually tries to compare the two version numbers. Since I'm using 1.3.9 and 1.3.10, the compare believes that 1.3.9 is greater than 1.3.10 (makes sense, it is using a string compare).
My point here is that it is inconsistent, the Update! will show in the Plugin List, but no Update button in the Plugin Editor. Should it be handled the same in both locations?
Thanks!
Mark
8
6
Quote
All times are EST. The time is now 09:43 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content