Index: trunk/admin/install.php =================================================================== diff -u -N -r773 -r891 --- trunk/admin/install.php (.../install.php) (revision 773) +++ trunk/admin/install.php (.../install.php) (revision 891) @@ -473,10 +473,56 @@ } $dir_name = $pathtoroot.$p."/admin";///install/upgrades/"; - - $Modules[] = $rs->fields['Name']; - $Texts[] = $rs->fields['Name']." (".$rs->fields['Version']." ".prompt_language("la_to")." ".GetMaxPortalVersion($dir_name).")"; - + + if($rs->fields['Version']!=$newver=GetMaxPortalVersion($dir_name)) + { + +//////////////////// + + $mod_name = strtolower($rs->fields['Name']); + $current_version = $rs->fields['Version']; + if ($mod_name == 'in-portal')$mod_name = ''; + + $dir_name = $pathtoroot.$mod_name."/admin/install/upgrades/"; + $dir = @dir($dir_name); + + $upgrades_arr = Array(); + + $new_version = ''; + while ($file = $dir->read()) { + if ($file != "." && $file != ".." && !is_dir($dir_name.$file)) { + if (strstr($file, 'inportal_check_v')) { + $upgrades_arr[] = $file; + } + } + } + + usort($upgrades_arr, "VersionSort"); + $result=0; + $failCheck=1; + $stopCheck=2; + $CheckErrors = Array(); + + foreach($upgrades_arr as $file) + { + $file_tmp = str_replace("inportal_check_v", "", $file); + $file_tmp = str_replace(".php", "", $file_tmp); + + if (ConvertVersion($file_tmp) > ConvertVersion($current_version)) { + $filename = $pathtoroot.$mod_name."/admin/install/upgrades/$file"; + if(file_exists($filename)) + { + include($filename); + if($result&2)break; + } + } + } + +//////////////////// + + $Modules[] = Array('module'=>$rs->fields['Name'],'curver'=>$rs->fields['Version'],'newver'=>$newver,'error'=>$result!='pass'); +// $Texts[] = $rs->fields['Name']." (".$rs->fields['Version']." ".prompt_language("la_to")." ".GetMaxPortalVersion($dir_name).")"; + } /*$dir = @dir($dir_name); while ($file = $dir->read()) { Index: trunk/admin/install/upgrade_errors.php =================================================================== diff -u -N --- trunk/admin/install/upgrade_errors.php (revision 0) +++ trunk/admin/install/upgrade_errors.php (revision 891) @@ -0,0 +1,209 @@ + $section) + { + foreach($section as $key => $value) + { + $key = "g_".str_replace('-', '', $key); + global $$key; + $$key = $value; + } + } +} +$module_path = $pathtoroot.$mod_name.'/admin/install/'; +$ado =&inst_GetADODBConnection(); +$sql = 'SELECT Version FROM '.$g_TablePrefix.'Modules WHERE Name="'.addslashes($_GET['module']).'" ORDER BY LoadOrder'; +$rs = $ado->Execute($sql); + +$mod_ver = 0; +while ($rs && !$rs->EOF) { + $mod_ver = $rs->fields['Version']; + $rs->MoveNext(); +} + +$p = strtolower($_GET['module']); + +if ($p == 'in-portal')$p = ''; + +$dir_name = $pathtoroot.$p."/admin";///install/upgrades/"; + +$newver=GetMaxPortalVersion($dir_name); + +if($mod_ver!=$newver) +{ + $dir_name = $pathtoroot.$p."/admin/install/upgrades/"; + $dir = @dir($dir_name); + + $upgrades_arr = Array(); + + $new_version = ''; + while ($file = $dir->read()) { + if ($file != "." && $file != ".." && !is_dir($dir_name.$file)) { + if (strstr($file, 'inportal_check_v')) { + $upgrades_arr[] = $file; + } + } + } + usort($upgrades_arr, "VersionSort"); + $result=0; + $failCheck=1; + $stopCheck=2; + $CheckErrors = Array(); + + foreach($upgrades_arr as $file) + { + $file_tmp = str_replace("inportal_check_v", "", $file); + $file_tmp = str_replace(".php", "", $file_tmp); + + if (ConvertVersion($file_tmp) > ConvertVersion($current_version)) { + $filename = $pathtoroot.$mod_name."/admin/install/upgrades/$file"; + if(file_exists($filename)) + { + include($filename); + if($result&2)break; + } + } + } + +} + +function print_pre($s) +{ + echo '
'.print_r($s, true).'
'; +} + +?> + + + In-Portal - Module Errors + + + + + +
+
+ +
+
+
+ + +
+  Module Errors
+
+
+ + + + + +
+ Install + +
+ + + + + + +
+
+'.$error.'
'; + } +?> +
+ +
+ + \ No newline at end of file Index: trunk/admin/install/upgrades/inportal_check_v1.0.10.php =================================================================== diff -u -N --- trunk/admin/install/upgrades/inportal_check_v1.0.10.php (revision 0) +++ trunk/admin/install/upgrades/inportal_check_v1.0.10.php (revision 891) @@ -0,0 +1,24 @@ +1'; +$rs2 = $ado->Execute($sql); +if ($rs2 && !$rs2->EOF) +{ + $result|=$failCheck; + $CheckErrors[] = 'You have duplicate ResourceId in table "'.$g_TablePrefix.'Category"'; +} +$sql='SELECT ResourceId,COUNT(*) as c FROM '.$g_TablePrefix.'PortalGroup GROUP BY 1 HAVING c>1'; +$rs2 = $ado->Execute($sql); +if ($rs2 && !$rs2->EOF) +{ + $result|=$failCheck; + $CheckErrors[] = 'You have duplicate ResourceId in table "'.$g_TablePrefix.'PortalGroup"'; +} +$sql='SELECT ResourceId,COUNT(*) as c FROM '.$g_TablePrefix.'PortalUser GROUP BY 1 HAVING c>1'; +$rs2 = $ado->Execute($sql); +if ($rs2 && !$rs2->EOF) +{ + $result|=$failCheck; + $CheckErrors[] = 'You have duplicate ResourceId in table "'.$g_TablePrefix.'PortalUser"'; +} +?> \ No newline at end of file Index: trunk/admin/install/upgrade.php =================================================================== diff -u -N -r41 -r891 --- trunk/admin/install/upgrade.php (.../upgrade.php) (revision 41) +++ trunk/admin/install/upgrade.php (.../upgrade.php) (revision 891) @@ -17,10 +17,20 @@ foreach($Modules as $m) { echo ""; - echo ""; - echo $Texts[$i]; + if($m['error']) + echo ""; + else + echo ""; + + echo $m['module'].' ('.$m['curver'].' '.prompt_language('la_to').' '.$m['newver'].')'; + + if ($m['error']) + { + $open_url = "install/upgrade_errors.php?module={$m['module']}"; + echo " (Pre-requisit test not passed!)"; + } echo "\n"; - $i++; +// $i++; } ?>