0)
printf(" Error-Number: %s
", mysql_errno());
if (mysql_error()!="")
printf(" Error-Message: %s
", mysql_error());
if (mysql_info()!="")
printf(" Mysql-Info: %s
", mysql_info());
mysql_free_result($dateresult);
if (empty($date))
{
printf("Could not get date of latest Mars version from database.");
return;
}
if (empty($_GET["insert"]))
{
$query0 = "SELECT fSequenceFirst, ";
$query0 .= "if (fCallisto " . " < '" . $date . "', 'callisto to be resetted', ";
$query0 .= "if (not isnull(fCallisto), 'callisto already processed with new release', ";
$query0 .= "if (fStartTime > ADDDATE(Now(), INTERVAL -1 DAY) AND isnull(fFailedTime), 'callisto running',";
$query0 .= "if (isnull(fFailedTime), 'callisto already resetted for new release', ";
$query0 .= " 'callisto crashed or failed')))) as 'calstat', ";
$query0 .= "if (fStar " . " < '" . $date . "', 'star to be resetted', ";
$query0 .= "if (not isnull(fStar), 'star already processed with new release', ";
$query0 .= "if (fStartTime > ADDDATE(Now(), INTERVAL -1 DAY) AND isnull(fFailedTime), 'star running',";
$query0 .= "if (isnull(fFailedTime), 'star already resetted for new release', ";
$query0 .= " 'star crashed or failed')))) as 'starstat' ";
$query0 .= "FROM SequenceProcessStatus ";
}
else
{
$query0 = "UPDATE SequenceProcessStatus SET ";
if ($_GET["step"]=="callisto")
$query0 .="fCallisto=NULL, fFillCallisto=NULL, fStar=NULL, fFillStar=NULL, ";
else
if ($_GET["step"]=="star")
$query0 .="fStar=NULL, fFillStar=NULL, ";
$query0 .="fStartTime=NULL, fFailedTime=NULL, fFailedCode=NULL, fFailedCodeAdd=NULL, fReturnCode=NULL ";
if ($_GET["step"]=="callisto")
$query0 .= " WHERE fCallisto " . " < '" . $date . "'";
else
if ($_GET["step"]=="star")
$query0 .= " WHERE fStar " . " < '" . $date . "'";
else
$query0 .= " WHERE (NOT ISNULL(fFailedTime) OR fStartTime < ADDDATE(Now(), INTERVAL -1 DAY))";
}
if (ereg("^([ ]*[0-9]{5,8}[ ]*[,])*[ ]*[0-9]{5,8}[ ]*$",$_GET["Seqs"]))
{
if (strpos($query0, " WHERE ")==FALSE)
$query0 .= " WHERE ";
else
$query0 .= " AND ";
$query0 .=" fSequenceFirst IN (" . $_GET["Seqs"] . ")";
}
else
{
echo "You have to give the sequences, which you want to reset, in the correct format, i.e. sequence numbers separated by ','.
";
return;
}
if (empty($_GET["step"]))
{
echo "Please choose what you want to reset:
";
echo "crashed processes (i.e. running longer than 1 day or failed), callisto or star.
";
return;
}
$result0=mysql_query($query0);
if (mysql_errno()>0)
printf(" Errorno: %s
", mysql_errno());
if (mysql_error()!="")
printf(" Errormsg: %s
", mysql_error());
if (!empty($_GET["insert"]) && !empty($_GET["step"]))
{
printf("%s Sequences have been resetted.
\n", mysql_affected_rows());
if (mysql_info()!="")
printf("Mysql-Info: %s
\n", mysql_info());
}
else
{
if (mysql_affected_rows()==0)
{
echo "No sequence to reset.
";
echo "The sequences you listed are already resetted.
";
mysql_free_result($result0);
return;
}
echo "The status of the sequences you entered:
\n";
$star="";
$callisto="";
$crashed="";
$calcolor='black';
$starcolor='black';
$style='normal';
$col = FALSE;
$bgcolor='#C0C0C0';
printf("
\nSequence\n | \n\nStatus Callisto\n | \n\nStatus Star\n | \n
---|---|---|
\n%s \n | \n", $bgcolor, $style, $row[0]); printf("\n %s \n | \n", $calcolor, $row[1]); printf("\n %s \n | \n