Index: trunk/admin/install.php =================================================================== diff -u -r410 -r415 --- trunk/admin/install.php (.../install.php) (revision 410) +++ trunk/admin/install.php (.../install.php) (revision 415) @@ -429,12 +429,12 @@ $Modules = array(); $Texts = array(); - if (str_replace('.', '', GetMaxPortalVersion($pathtoroot.$admin)) >= 105 && ($g_LicenseCode == '' && $g_License != '')) { + if (ConvertVersion(GetMaxPortalVersion($pathtoroot.$admin)) >= ConvertVersion("1.0.5") && ($g_LicenseCode == '' && $g_License != '')) { $state = 'reinstall'; $inst_error = "Your license must be updated before you can upgrade. Please don't use 'Existing License' option, instead either Download from Intechnic or Upload a new license file!"; } else { - $sql = "SELECT Name, Version FROM ".$g_TablePrefix."Modules"; + $sql = "SELECT Name, Version FROM ".$g_TablePrefix."Modules ORDER BY LoadOrder asc"; $rs = $ado->Execute($sql); @@ -485,8 +485,8 @@ if ($state == "upgrade_process") { $ado =& inst_GetADODBConnection(); - $mod_arr = $_POST['modules']; - + $mod_arr = $_POST['modules']; + foreach($mod_arr as $p) { $mod_name = strtolower($p); @@ -503,31 +503,38 @@ $dir_name = $pathtoroot.$mod_name."/admin/install/upgrades/"; $dir = @dir($dir_name); + $upgrades_arr = Array(); + $new_version = ''; - $tmp1 = 0; - $tmp2 = 0; while ($file = $dir->read()) { - if ($file != "." && $file != ".." && !is_dir($dir_name.$file)) { + if ($file != "." && $file != ".." && !is_dir($dir_name.$file)) { if (strstr($file, 'inportal_upgrade_v')) { - $file_tmp = str_replace("inportal_upgrade_v", "", $file); - $file_tmp = str_replace(".sql", "", $file_tmp); - - if (ConvertVersion($file_tmp) > ConvertVersion($current_version)) { - $filename = $pathtoroot.$mod_name."/admin/install/upgrades/$file"; - //echo "Running: $filename
"; - if(file_exists($filename)) - { - RunSQLFile($ado, $filename); - set_ini_value("Module Versions", $p, $try_version); - save_values(); - } + $upgrades_arr[] = $file; } - } - //$tmp2 = $tmp1; - } + } } + + usort($upgrades_arr, "VersionSort"); + + foreach($upgrades_arr as $file) { + $file_tmp = str_replace("inportal_upgrade_v", "", $file); + $file_tmp = str_replace(".sql", "", $file_tmp); + + if (ConvertVersion($file_tmp) > ConvertVersion($current_version)) { + $filename = $pathtoroot.$mod_name."/admin/install/upgrades/$file"; + //echo "Running: $filename
"; + if(file_exists($filename)) + { + RunSQLFile($ado, $filename); + } + } + } + + set_ini_value("Module Versions", $p, GetMaxPortalVersion($pathtoroot.$mod_name."/admin/")); + save_values(); } - $state = 'languagepack_upgrade'; + + $state = 'languagepack_upgrade'; } // upgrade language pack @@ -1104,6 +1111,12 @@ } if ($state == "finish") { + $ado =& inst_GetADODBConnection(); + $PhraseTable = GetTablePrefix()."ImportPhrases"; + $EventTable = GetTablePrefix()."ImportEvents"; + $ado->Execute("DROP TABLE IF EXISTS $PhraseTable"); + $ado->Execute("DROP TABLE IF EXISTS $EventTable"); + $include_file = $pathtoroot.$admin."/install/install_finish.php"; }