Changeset 8743 for trunk/MagicSoft/Mars/datacenter/db/resetseq.php
- Timestamp:
- 09/06/07 15:12:26 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/db/resetseq.php
r8737 r8743 11 11 mysql_select_db($db); 12 12 13 $query1="SELECT MAX(fStartDate) FROM MarsVersion"; 14 $dateresult=mysql_query($query1); 15 $row = mysql_fetch_row($dateresult); 16 $date=$row[0]; 13 $query1="SELECT fMarsVersionName, fStartDate FROM MarsVersion ORDER BY fMarsVersion DESC LIMIT 0,1"; 14 $marsresult=mysql_query($query1); 15 $row = mysql_fetch_row($marsresult); 16 $mars=$row[0]; 17 $date=$row[1]; 17 18 if (mysql_errno()>0) 18 19 printf(" Error-Number: %s <br>", mysql_errno()); … … 21 22 if (mysql_info()!="") 22 23 printf(" Mysql-Info: %s <br>", mysql_info()); 23 mysql_free_result($ dateresult);24 if (empty($ date))25 { 26 printf("Could not get date of latest Mars version fromdatabase.");24 mysql_free_result($marsresult); 25 if (empty($mars)) 26 { 27 printf("Could not get information for latest Mars version from the database."); 27 28 return; 28 29 } … … 30 31 if (empty($_GET["insert"])) 31 32 { 32 $query0 = "SELECT fSequenceFirst, "; 33 $query0 .= "if (fCallisto " . " < '" . $date . "', 'callisto to be resetted', "; 34 $query0 .= "if (not isnull(fCallisto), 'callisto already processed with new release', "; 35 $query0 .= "if (fStartTime > ADDDATE(Now(), INTERVAL -1 DAY) AND isnull(fFailedTime), 'callisto running',"; 36 $query0 .= "if (isnull(fFailedTime), 'callisto already resetted for new release', "; 37 $query0 .= " 'callisto crashed or failed')))) as 'calstat', "; 38 $query0 .= "if (fStar " . " < '" . $date . "', 'star to be resetted', "; 39 $query0 .= "if (not isnull(fStar), 'star already processed with new release', "; 40 $query0 .= "if (fStartTime > ADDDATE(Now(), INTERVAL -1 DAY) AND isnull(fFailedTime), 'star running',"; 41 $query0 .= "if (isnull(fFailedTime), 'star already resetted for new release', "; 42 $query0 .= " 'star crashed or failed')))) as 'starstat' "; 33 $query0 = "SELECT SequenceProcessStatus.fSequenceFirst, "; 34 // $query0 .= "if (fCallisto " . " < '" . $date . "', 'to be resetted', "; 35 $query0 .= "if (fCallisto " . " < '" . $date . "', CONCAT('outdated (', (SELECT fMarsVersionName FROM MarsVersion WHERE fCallisto > fStartDate ORDER BY fMarsVersion DESC LIMIT 0,1), ')'), "; 36 $query0 .= "if (not isnull(fCallisto), 'up to date (" . $mars . ")', "; 37 $query0 .= "if (fStartTime > ADDDATE(Now(), INTERVAL -1 DAY) AND isnull(fFailedTime), 'running (" . $mars . ")',"; 38 $query0 .= "if (isnull(fFailedTime), 'already resetted', "; 39 $query0 .= " 'crashed or failed')))) as 'calstat', "; 40 // $query0 .= "if (fStar " . " < '" . $date . "', 'to be resetted', "; 41 $query0 .= "if (fStar " . " < '" . $date . "', CONCAT('outdated (', (SELECT fMarsVersionName FROM MarsVersion WHERE fStar > fStartDate ORDER BY fMarsVersion DESC LIMIT 0,1), ')'), "; 42 $query0 .= "if (not isnull(fStar), 'up to date (" . $mars . ")', "; 43 $query0 .= "if (fStartTime > ADDDATE(Now(), INTERVAL -1 DAY) AND isnull(fFailedTime) AND not isnull(fCallisto), 'running (" . $mars . ")',"; 44 $query0 .= "if (isnull(fFailedTime), 'already resetted', "; 45 $query0 .= " 'crashed or failed')))) as 'starstat', fProjectName, fRunStart "; 43 46 $query0 .= "FROM SequenceProcessStatus "; 47 $query0 .= "LEFT JOIN Sequences ON Sequences.fSequenceFirst=SequenceProcessStatus.fSequenceFirst "; 48 $query0 .= "LEFT JOIN Project ON Project.fProjectKEY=Sequences.fProjectKEY "; 44 49 } 45 50 else … … 63 68 if (ereg("^([ ]*[0-9]{5,8}[ ]*[,])*[ ]*[0-9]{5,8}[ ]*$",$_GET["Seqs"])) 64 69 { 65 if (strpos($query0, " WHERE ")==FALSE )70 if (strpos($query0, " WHERE ")==FALSE || (strpos($query0, " CONCAT(")==TRUE && strpos($query0, " WHERE ")==TRUE)) 66 71 $query0 .= " WHERE "; 67 72 else 68 73 $query0 .= " AND "; 69 $query0 .=" fSequenceFirst IN (" . $_GET["Seqs"] . ")";74 $query0 .=" SequenceProcessStatus.fSequenceFirst IN (" . $_GET["Seqs"] . ")"; 70 75 } 71 76 else … … 101 106 return; 102 107 } 103 echo "The status of the sequences you entered: <br>\n";108 // echo "The status of the sequences you entered: <br>\n"; 104 109 $star=""; 105 110 $callisto=""; … … 110 115 $col = FALSE; 111 116 $bgcolor='#C0C0C0'; 112 printf("<table border='0'>\n"); 113 printf("<tr bgcolor='%s'>\n<th style='padding-left:1ex;padding-right:1ex'>\n<u>Sequence</u>\n</th>\n<th>\n<u>Status Callisto</u>\n</th>\n<th>\n<u>Status Star</u>\n</th>\n</tr>\n", $bgcolor); 117 $checked=0; 118 printf("<table border='0' align='center'>\n"); 119 printf("<tr bgcolor='%s'>\n<th style='padding-left:1ex;padding-right:1ex'>\n<u>Sequence</u>\n</th>\n", $bgcolor); 120 printf("\n<th>\n<u>ProjectName</u>\n</th>\n"); 121 printf("<th>\n<u>Status Callisto</u>\n</th>"); 122 printf("\n<th>\n<u>Status Star</u>\n</th>\n"); 123 printf("\n<th>\n<u>Starttime</u>\n</th>\n"); 124 printf("</tr>\n"); 114 125 while ($row = mysql_fetch_row($result0)) 115 126 { 116 if ( $row[2]=='star to be resetted'&& $_GET["step"]=='star')127 if (ereg('outdated', $row[2]) && $_GET["step"]=='star') 117 128 { 118 129 $star[]=$row[0]; 119 130 $starcolor='green'; 120 $style='bold'; 131 $style='bold'; 132 $row[2]=str_replace('outdated', 'marked for reset', $row[2]); 121 133 } 122 if ( $row[1]=='callisto to be resetted'&& $_GET["step"]=='callisto')134 if (ereg('outdated', $row[1]) && $_GET["step"]=='callisto') 123 135 { 124 136 $callisto[]=$row[0]; 125 137 $calcolor='green'; 138 $starcolor='green'; 126 139 $style='bold'; 127 140 } 128 if (($row[1]=='c allisto crashed or failed' || $row[2]=='starcrashed or failed') && $_GET["step"]=='crashed')141 if (($row[1]=='crashed or failed' || $row[2]=='crashed or failed') && $_GET["step"]=='crashed') 129 142 { 130 143 $crashed[]=$row[0]; 131 if ($row[1]=='c allisto crashed or failed')144 if ($row[1]=='crashed or failed') 132 145 { 133 146 $calcolor='green'; … … 146 159 $col = !$col; 147 160 printf("<tr bgcolor='%s'>\n<td align='center' style='font-weight:%s'>\n%s \n</td>\n", $bgcolor, $style, $row[0]); 161 printf("<td style='padding-left:1ex;padding-right:1ex'>\n %s \n</td>\n", $row[3]); 148 162 printf("<td style='padding-left:1ex;padding-right:1ex'>\n <font color='%s'>%s </font>\n</td>\n", $calcolor, $row[1]); 149 printf("<td style='padding-left:1ex;padding-right:1ex'>\n <font color='%s'>%s </font>\n</td>\n</tr>\n", $starcolor, $row[2]); 163 printf("<td style='padding-left:1ex;padding-right:1ex'>\n <font color='%s'>%s </font>\n</td>\n", $starcolor, $row[2]); 164 printf("<td style='padding-left:1ex;padding-right:1ex'>\n %s \n</td>\n", $row[4]); 165 printf("</tr>\n"); 150 166 $calcolor='black'; 151 167 $starcolor='black'; 152 168 $style='normal'; 169 $checked+=1; 153 170 } 154 171 printf("</table>\n"); … … 157 174 printf("<br>\n You chose to reset only the sequences which are crashed or failed.<br>\n"); 158 175 else 159 printf("<br>\n Only the sequences which have not yet been processed or resetted, will be resetted.<br>\n"); 160 printf("To <b>reset</b> them, please check the insert checkbox and submit again.<br><br>\n"); 161 176 printf("<br>\n Only the sequences which are not 'up to date', 'running' or 'resetted', can be resetted.<br>\n"); 162 177 if (empty($star) && empty($callisto) && empty($crashed)) 163 178 echo "With your choice no sequences would be resetted."; 164 179 else 165 echo "With your choice the following sequences would be resetted: "; 180 echo "With your choice the following sequences would be resetted:\n "; 181 $marked=0; 166 182 if (!empty($star)) 183 { 167 184 foreach($star as $num => $seq) 168 185 echo $seq . " "; 186 $marked+=count($star); 187 } 169 188 if (!empty($callisto)) 189 { 170 190 foreach($callisto as $num => $seq) 171 191 echo $seq . " "; 192 $marked+=count($callisto); 193 } 172 194 if (!empty($crashed)) 195 { 173 196 foreach($crashed as $num => $seq) 174 197 echo $seq . " "; 198 $marked+=count($crashed); 199 } 200 printf("<br>\n Listed: %d <br> Marked: %d", $checked, $marked); 201 printf("<br>\n<br>\nTo <b>reset</b> the <font color='green'>green marked entries</font>, please press the button 'Reset Sequences'.<br><br>\n"); 202 175 203 mysql_free_result($result0); 176 printf("<br>\n<br>\n<input type='button' value='Reset Sequences' onClick='self.location.href=\"%s&insert=On\"'> \n", htmlspecialchars($_SERVER["REQUEST_URI"])); 204 printf("<input type='button' value='Reset Sequences' onClick='self.location.href=\"%s&insert=On\"'> \n", htmlspecialchars($_SERVER["REQUEST_URI"])); 205 177 206 } 178 207 mysql_close($db_id); … … 192 221 echo (file_get_contents("index-header.html")); 193 222 194 $ips=array("91.64.78.187", "132.187.47.10", "132.187.47.67" );223 $ips=array("91.64.78.187", "132.187.47.10", "132.187.47.67", "132.187.47.63", "129.217.160.151"); 195 224 if (!in_array($_SERVER['REMOTE_ADDR'], $ips)) 196 225 { … … 217 246 printf("<input type='radio' name='step' value='star' %s> star<br>", $_GET["step"]=="star" ? "checked" : ""); 218 247 219 printf("<table>\n<tr>\n<td align='left'>\nSequences: \n</td>\n</t d>\n</tr>\n<tr>\n<td valign='left'>\n");220 printf("<input name='Seqs' type='text' size=' 75' maxlength='300' value='%s'>\n</td>\n</tr>\n</table>\n<br>\n", $_GET["Seqs"]);248 printf("<table>\n<tr>\n<td align='left'>\nSequences: \n</td>\n</tr>\n<tr>\n<td>\n"); 249 printf("<input name='Seqs' type='text' size='80' maxlength='300' value='%s'>\n</td>\n</tr>\n</table>\n<br>\n", $_GET["Seqs"]); 221 250 222 251 ini_set("mysql.trace_mode", "Off"); 223 252 // ini_set("display_errors", "Off"); 224 253 225 printf("<input type='submit' value=' Reset Sequences in DB'> \n");226 printf("<input class='Width' type='button' value=' Reset' onClick='self.location.href=\"resetseq.php\"'> \n");254 printf("<input type='submit' value='Check Sequence Status'> \n"); 255 printf("<input class='Width' type='button' value='Clear Form' onClick='self.location.href=\"resetseq.php\"'> \n"); 227 256 // if (!empty($_GET["step"]) && ereg("^([ ]*[0-9]{5,8}[ ]*[,])*[ ]*[0-9]{5,8}[ ]*$",$_GET["Seqs"])) 228 257 // printf("<input type='checkbox' name='insert' value='On'>insert\n");
Note:
See TracChangeset
for help on using the changeset viewer.