Here is my proposal for the issue described, though I haven't been able to reproduce the issue on a clean nor upgraded site. Would appreciate feedback.
in admin/includes/init_includes/init_user_tracking.php
Locate this portion of the code:
And modify/replace to like the below (with code that causes a difference highlighted in red):Code:$installers = scandir($module_installer_directory, 1);
$file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.'));
while (substr($installers[0], strrpos($installers[0], '.')) != $file_extension || preg_match('~^[^\._].*\.php$~i', $installers[0]) <= 0 || $installers[0] == 'empty.txt') {
unset($installers[0]);
if (sizeof($installers) == 0) {
break;
}
$installers = array_values($installers);
}
if (sizeof($installers) > 0) {
$newest_version = $installers[0];
$newest_version = substr($newest_version, 0, -4);
sort($installers);
if (version_compare($newest_version, $current_version) > 0) {
foreach ($installers as $installer) {
if (substr($installer, strrpos($installer, '.')) == $file_extension && (preg_match('~^[^\._].*\.php$~i', $installer) > 0 || $installer != 'empty.txt')) {
if (version_compare($newest_version, substr($installer, 0, -4)) >= 0 && version_compare($current_version, substr($installer, 0, -4)) < 0) {
include($module_installer_directory . '/' . $installer);
$current_version = str_replace("_", ".", substr($installer, 0, -4));
$db->Execute("UPDATE " . TABLE_CONFIGURATION . " SET configuration_value = '" . $current_version . "', set_function = 'zen_cfg_select_option(array(\'" . $current_version . "\'),' WHERE configuration_key = 'CONFIG_" . $module_constant . "_VERSION' LIMIT 1;");
$messageStack->add("Installed " . $module_name . " v" . $current_version, 'success');
}
}
}
}
}
Code:// Obtain a list of files in the installer directory.
if (is_dir($module_installer_directory)) {
$installers = scandir($module_installer_directory, 1);
// Determine the extension of this file to be used for comparison on the others.
$file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.'));
$file_extension_len = strlen($file_extension);
// sequence the installer files to support stepping through them.
if (sizeof($installers) > 0) {
sort($installers);
}
// Step through each installer file to establish the first file that matches the search criteria.
$newest_version = $installers[0];
$newest_version = substr($newest_version, 0, -1 * $file_extension_len);
while (substr($installers[0], strrpos($installers[0], '.')) != $file_extension || preg_match('~^[^\._].*\.php$~i', $installers[0]) <= 0 || $installers[0] == 'empty.txt' || version_compare($newest_version, $current_version) <= 0) {
unset($installers[0]);
if (sizeof($installers) == 0) {
break;
}
$installers = array_values($installers);
$newest_version = $installers[0];
$newest_version = substr($newest_version, 0, -1 * $file_extension_len);
}
// If there are still installer files to process, then do so.
if (sizeof($installers) > 0) {
$newest_version = $installers[0];
$newest_version = substr($newest_version, 0, -1 * $file_extension_len);
if (version_compare($newest_version, $current_version) > 0) {
foreach ($installers as $installer) {
if (substr($installer, strrpos($installer, '.')) == $file_extension && (preg_match('~^[^\._].*\.php$~i', $installer) > 0 || $installer != 'empty.txt')) {
if (version_compare($newest_version, substr($installer, 0, -1 * $file_extension_len)) >= 0 && version_compare($current_version, substr($installer, 0, -1 * $file_extension_len)) < 0) {
include($module_installer_directory . '/' . $installer);
$current_version = str_replace("_", ".", substr($installer, 0, -1 * $file_extension_len));
$db->Execute("UPDATE " . TABLE_CONFIGURATION . " SET configuration_value = '" . $current_version . "', set_function = 'zen_cfg_select_option(array(\'" . $current_version . "\'),' WHERE configuration_key = '" . $module_constant . "_VERSION' LIMIT 1;");
$messageStack->add("Installed " . $module_name . " v" . $current_version, 'success');
}
}
}
}
}
}